Using Envoyer With Forge Servers

Taylor Otwell
2 min readMay 16, 2017

Laravel Forge provisions PHP 7 servers and allows you to easily manage them. Forge can do a variety of things: add sub-domains, install SSL certificates, create queue workers, create Cron jobs, etc. In fact, Forge can even deploy your code every time you push to GitHub, Bitbucket, or GitLab. However, for sites that require zero-downtime during their deployments, you need a more robust deployment solution.

Envoyer.io allows you to deploy any PHP application with zero-downtime. For my own projects, I typically use Forge to provision and manage my servers, then pair those servers with Envoyer to achieve zero-downtime deployments. Since many people have asked me how to use Envoyer with Forge provisioned servers, I’m writing this post as a short tutorial!

Update The Web Directory

Envoyer uses two directories to manage your deployments: “current” and “releases”. The “current” directory is actually a symbolic link that points to a specific release within the “releases” directory. Each directory in the “releases” directory is named based on the UNIX timestamp of its creation. So, in Forge, we need to make sure that our “web directory” is /current/public instead of just /public. We can update this on the “Meta” tab of the site’s management pane:

Connecting The Server To Envoyer

Next, we can add the server to our Envoyer project:

Once the server has been added, Envoyer will present you with an SSH key. You should copy this SSH key and add it to your Forge server. You can do this on the “SSH Keys” tab of the server’s management pane:

Once you’ve done this, you’re ready to deploy from Envoyer! Once you start using Envoyer for deployment, make sure to disable the “Quick Deploy” feature within Forge so that you are not deploying your code twice each time you push to your source control provider.

--

--