Deploying Laravel with Capistrano

Standard

I am always looking for better ways of deploying me code. In the past I have used Fabric to create a deployment process. Although I use git, I have never used it for deployments. With Fabric I copied my code to another folder, did any processing such as removing files, or setting a environment variable and then uploaded the package. I was able to create versioning. Each deployment went to it’s own folder and symlinks to the document root were created. In the event the deployment gets botched I can easily login and re-link to the previous deployment.

On a new project I recently launched I have started using Capistrano. If you are a Laravel user check out this tutorial from TutsPlus.

Using Capistrano, I can run a command and it will rollback for me. With the default setup I have also switched to git based deployments. Both GitHub and Bitbucket allow you to enter deployment keys for your server. These are SSH keys but have read-only access to pull down the changes.

What I like with this approach is that the client side deployment script only relies on having access to the server. No longer am I defining paths where to copy files to if I have to deploy from my laptop versus my desktop.

What I don’t like is the “config” folder in my root project. It’s quite vague but I haven’t looked to see if I can change the name. One thing I am looking to do is write the release name to a php file so I can use it for things like cache busting.

Leave a Reply

Your email address will not be published.