How I Automated Symfony Deployment with Envoyer
Tags: symfony, php, webdev, showdev
Published: 2017-12-28 13:00:19

---
title: How I Automated Symfony Deployment with Envoyer
published: true
description: 
tags: symfony, php,  webdev, showdev
cover_image: https://www.cloudways.com/blog/wp-content/uploads/symfony_banner.jpg
---

Developers have different options and tools to create automatic deployments for their projects. These automatic deployments options ensure that no time is wasted on adding new coding blocks manually between the files. The good news is that developers cold choose from a lot of deployment tools now including DeployBot and DeployHQ.

For the purpose of this article, I’ve picked the popular zero-time deployment tool ‘Envoyer’, created by Laravel’s creator Taylor Otwell. While Envoyer is considered the “default” option for deploying Laravel apps, I will demonstrate its capabilities of [deploying Symfony applications on Cloudways](https://www.cloudways.com/blog/host-symfony-on-linode/).

The team behind Symfony recently published the latest versions of Symfony, 3.4 and 4.0. These versions have different structure when compared to the standard release versions. I will not go into the details of [Symfony 4](http://symfony.com/4). Similarly, if you wish to upgrade Symfony 3.x to version 4, follow this [detailed upgrade guide](https://github.com/symfony/symfony/blob/master/UPGRADE-4.0.md).

So now, back to the point.

Envoyer is a deployment tool used for the deployment of PHP applications. The best thing about the tool is the zero downtime during deployment. This means that your application and the customers using it are not even aware of the fact that a new version has been pushed. Envoyer works well with major repository management platforms such as Github, GitLab, and Bitbucket. Other benefits include unlimited deployments and team members. 

The following tutorial will guide you through the process of deploying Symfony applications on Cloudways using Envoyer.

##Create an Envoyer Account and Add a Project

Create an Envoyer account and login to it. Next, add a new project. For the purpose of this tutorial, I am signing in using my Github account.

![](https://www.cloudways.com/blog/wp-content/uploads/image2-68.png)

##Connect GitHub Repository	

Next, connect your Github Repository. Just copy the username/repository for Github repo URL and paste it into the input box. Since I am not deploying a Laravel app, choose the Other radio button, and hit the Save Project button.

![](https://www.cloudways.com/blog/wp-content/uploads/image5-42.png)

The project will be added to the account and the GitHub repository will now be connected to Envoyer.

![](https://www.cloudways.com/blog/wp-content/uploads/image10-63.png)

##Add the Server

The next step is to integrate the Cloudways server. For this, head to the Server tab and click the Add Server button.


![](https://www.cloudways.com/blog/wp-content/uploads/image12-44.png)

Next, login to your Cloudways account and get the credentials for adding the server from the Master Credentials section inside the Server Management tab of the Cloudways Console.

![](https://www.cloudways.com/blog/wp-content/uploads/image9-27.png)

Fill out all the required fields and enter the complete absolute path of your Cloudways application and save the server.

![](https://www.cloudways.com/blog/wp-content/uploads/image8-31.png)

After saving the server, you will be provided with an SSH key.

![](https://www.cloudways.com/blog/wp-content/uploads/image13-38.png)

Copy the key and head over to your Cloudways Console and click the ‘SSH Public Keys’ button. Give a label to your key and click Submit.

![](https://www.cloudways.com/blog/wp-content/uploads/image1-72.png)

After adding the SSH key, you should be able to connect to your server. Click the tiny Refresh button to test the connection status.

##Final Deployment

At this point, everything is correctly set up. The final step is to click the Deploy button for actual project deployment. You can also deploy applications via Git Push by selecting ‘Deploy when the code is pushed’ option in the settings.

![](https://www.cloudways.com/blog/wp-content/uploads/image2-68.png)

Envoyer will ask you from which branch or tag you need to deploy the application code. I selected the Default Branch, which is the master branch as well.

![](https://www.cloudways.com/blog/wp-content/uploads/image4-55.png)

Hit the Deploy button now.The deployment process could be viewed in the deployment tab. You can get additional information related to deployment by clicking the arrow button next to the deployment status.

![](https://www.cloudways.com/blog/wp-content/uploads/image7-30.png)

You can clearly see that Envoyer takes minimal time to deploy the application on your server.

##Deployment Folders on Cloudways

Once deployed, login to the SSH terminal on Cloudways, and move to your application folder. You will find two folders, current & releases.  

![](https://www.cloudways.com/blog/wp-content/uploads/image14-33.png)

The current folder have the main application which is in development and the release folder contains the previous releases folder named with date and time of the deployments.

![](https://www.cloudways.com/blog/wp-content/uploads/image11-49.png)

You could check the status of your application from three locations(New York, London, Singapore). In case of a disaster, you have the option of rolling back the current deployment. For this, enable this option by providing the health check URL in the settings. Additionally, you can set up heartbeats to monitor cron jobs for your application. You could also set up a notification channel like Slack and Hipchat to receive deployment related notifications.

![](https://www.cloudways.com/blog/wp-content/uploads/image6-41.png)

##Wrapping it all up

As you could see, Envoyer is a great option for deploying PHP apps. The process is simple and you could directly connect the process to a version control platform to ensure that the latest version of the app is deployed at all times. If you need help with the process, do post a comment, and I will get back to you.