I decided to give Envoyer a try the other day and found its set up process and documentation lacking - as I’m guessing you have - which is most likely why you’re reading this. :)
If you’re having difficulty setting up Envoyer with ServerPilot, read on.
Sign up with Envoyer and click the big, red Add Project button to add your first project. A modal will open; fill in the necessary information and click save.
Click the big, red arrow button to continue.
Add a Server
Once you’ve added a project you’re ready to add a server. This is where the docs are lacking.
Click on the Servers tab, then click the Add Server button. Fill in the information, and under Connect As, enter your app username. Under Project Path, enter the path to your app directory, such as:
Click the Save Server button and you’ll be presented with your Public SSH Key. Copy this key to your clipboard or store it in a file.
Close the modal.
Click the pencil icon to the right of your server name.
According to ServerPilot support: “No services, including PHP-FPM, should need to be restarted when deploying new code. Envoyer shouldn’t need to modify any server configurations or restart services.” So go ahead and uncheck Restart FPM After Deployments in the Deployments section.
Under the System section, enter
php as the PHP Path (this is what works for me), and if you’re running PHP 7, enter
composer7.0-sp as the Composer Path. Refer to How to Use Composer for PHP Dependency Management for your version of PHP.
Click Save Server.
SSH Into Your Server
SSH into your server as the
app user, not the
$ ssh [email protected]
Add Public SSH Key
Add your Public SSH Key to
$ nano .ssh/authorized_keys
Paste the key into the
authorized_keys file, then save and close.
Envoyer puts each deployment inside a
releases directory, which then has a symlink - named
current - that points to the most recent deployment. Your web root on ServerPilot is named
public, so in order for your app to serve files without modifying your nginx config you need to create your own symlink to Envoyer’s
current symlink and name it
But first, you need to either delete the default
public directory, or rename it.
rm apps/APPNAME/public/index.php rmdir apps/APPNAME/public
mv apps/APPNAME/public apps/APPNAME/-public
Now add the symlink to the
$ ln -s current/public apps/APPNAME/public
To make sure your connection is working properly, head back to Envoyer and click the chasing arrows icon under Connection Status; if everything went according to plan the little circle will turn green.
That’s it! You’re now ready to deploy your app!