Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matt Stauffer:
How to set up your Laravel application for zero-downtime (Envoyer/Capistrano) deploys
Mar 30, 2017 @ 14:58:35

Matt Stauffer has a post to his site today sharing a step-by-step guide to setting up your Laravel application for zero downtime deploys when using the Envoyer/Capistrano combination.

The reason you're getting zero-downtime deploy from these tools is because the entire deploy process—clone, composer install, etc.—doesn't happen in the directory that is currently serving your site. Instead, each new release gets its own separate "release" directory, all while your site is still being served from its current "release" directory.

All of these release directories are just subdirectories of releases. Each directory here represents one of your deploys, and each directory individually has everything needed to serve your site. [...] So, once the build process is complete for each new release, your deploy tool will delete the current symlink and create a new current symlink that points to your latest release. Boom. Now that release is live.

He then relates this back to the deployment of a Laravel application with Envoyer which already follows this "symlink deploy" method. There's a few caveats he mentions with this deploy, however, including information that shouldn't be removed in each deploy (like caches or configuration files). He then provides the steps (commands) you can follow with the deploy to manually use the "symlink deploy" method in your own scripting.

tagged: laravel deployment envoyer capistrano manual symlink tutorial

Link: https://mattstauffer.co/blog/how-to-set-up-your-laravel-application-for-zero-downtime-envoyer-capistrano-deploys

Dutch Web Alliance:
Capifony, Continuous Deployment and Symfony’s parameter.yml
Dec 15, 2014 @ 18:10:50

On the Dutch Web Alliance site today they've posted a tutorial about their use of Capifony for Symfony application deployment and how it relates to updating the "parameter.yml" file. They describe their current deployment process, how it works with the different environments and how they solved the one manually problem they had.

The actual deployment is thus dealt with by capifony. This is a plugin for capistrano written for deploying Symfony applications. [...] Capifony automatically deals with cloning the correct branch on the servers, installing dependencies through composer, migrating database versions etc etc. Basically we don’t have to care about anything else. However, there is one single thing that still keeps on bugging us: when we want to upgrade to a new parameters.yml, we must do this manually. This means that our builds will break when we deploy a version that requires an updated parameters.yml until we manually solve the issue.

To get around this manual issue, they decided on creating a new Capifony task that does an upload/download of the parameters file, depending on the environment.The continuous deployment can then push or pull the file as needed in a more automatic way.

tagged: continuous deployment paramatersyml configuration capifony capistrano task

Link: https://dutchweballiance.nl/techblog/capifony-continuous-deployment-symfonys-parameter-yml/

AirPair.com:
Automating Laravel Deployments Using Capistrano
Dec 12, 2014 @ 15:15:06

On the AirPair site there's a recent post by Vincent Cardillo showing you how to set up Laravel deployments with Capistrano, a popular Ruby-based deployment automation tool.

Hello friends. In this article we will be discussing automating the deployment of Laravel applications using the Capistrano tool. If you don't know what some of these things are, read on. [...] Why should we bother setting up Capistrano? Can't we just deploy to our servers by hand? Sure, maybe, but this quickly becomes annoying with anything more than a few servers, and isn't a scalable process.

He starts by laying out some of the prerequisites you'll need to get the deployment working: a Laravel application installed, some familiarity with Git/GitHub and a Linux-based system to work from. He talks about two methods of deployment, push and pull, and includes a summary (and illustration) for each. From there he starts to get into the detailed steps of setting up the deployment itself:

  • Protecting sensitive information (like configuration files)
  • Installing Capistrano as a Ruby gem
  • Setting up the SSH keys between systems
  • Setting up the receiving server
  • Setting up the Laravel project in a Capistrano deploy
  • Creating the steps in the deployment workflow
  • Doing the actual deployment

He includes all of the commands and configuration examples you'll need to make the deployment happen. He also finishes off with a few other things Capistrano could do for you including making a "sanity check" file and flushing memcache on deploy.

tagged: laravel deployment capistrano tutorial automate

Link: https://www.airpair.com/laravel/posts/automating-laravel-deployments-using-capistrano

Vic Cherubini:
Expert PHP Deployments
Dec 03, 2014 @ 18:04:22

Vic Cherubini has a recent post on his site sharing for free the contents of a book he'd written previously about "Expert PHP Deployments":

In 2013 I wrote and self-published a book titled “Expert PHP Deployments”. While it was not a smashing success, it sold enough copies to pay for itself, and I was happy to have a published book to my name. Unfortunately, I have not had time to market it, update it, or further improve it, so I am giving it away for free. You can read the book in its entirety below or download it as a PDF.

The book covers a wide range of topics related to deploying PHP applications including:

  • Environment configuration (setting up Vagrant for the developers)
  • Working with the Phing automation tool
  • Building deployments with Capistrano
  • Creating and configuring a production server
  • Ensuring the security of the server
  • Making the actual deployment

The post has the full text of the book in one page but you can grab the PDF if you prefer that format.

tagged: expert deployment book free vagrant phing capistrano tutorial

Link: https://leftnode.org/posts/expert-php-deployments.html

SitePoint PHP Blog:
How to Deploy Symfony Apps with Capifony
Sep 25, 2014 @ 15:55:27

The SitePoint PHP blog has a tutorial today showing you how you can use the popular Capistrano tool to deploy Symfony-based applications. More specifically, it's focused in on one tool, Calpifony, that's a bit more tailored to what a Symfony deployment needs.

Say you have a Symfony application. At some point, you would like to deploy it to your server and show it to the world. Of course, you can do it all manually, but these days you can also choose to use a tool like Capifony. If you have developed Ruby applications in the past, you are perhaps familiar with Capistrano. Capistrano is a tool to deploy your Ruby application to your server. Capifony has been created on top of Capistrano, and is basically a collection of deployment recipes. In this article, we are going to deploy a Symfony application to a server with Capifony.

He starts off with a section giving an overview of how the Capifony tool works and how important the directory structure is. He then guides you through the installation of the tool and configuring your first simple project. He includes an example "deply.rb" configuration and walks through each piece, describing what it does and how to add some additional commands to the list. The post ends with the full updates configuration that makes the connection to the server, downloads a copy of a Git repository and executes Assetic and Bower commands on build.

tagged: tutorial capifony symfony deployment capistrano introduction install configure

Link: http://www.sitepoint.com/deploy-symfony-apps-capifony/

Jeremy Kendall:
PHP and Capistrano 3: Notes to Self
Nov 26, 2013 @ 16:27:18

In a recent post to his blog Jeremy Kendall has posted a guide to deploying a PHP application with Capistrano. There's been enough changes in recent versions of the tool where information and configuration was difficult to find.

I spent quite a bit of my day yesterday trying to work out a painless, scripted, idiot-proof deployment process with Capistrano for my photo-a-day website. I’ve been doing a lot of work on the site lately, which means a lot of deployments, and I’ve been very unhappy with myself for implementing what amounts to “deployment worst practices” when it comes to my personal projects. The last time I worked with Capistrano was about two years ago, and a lot has changed since then. Capistrano v3 was released in June of 2013 and brought with it a lot of great changes, but for a guy who doesn’t know ruby and relies on tutorials and Stack Overflow questions for help, the version bump brought a lot of pain as well.

He starts with a list of some of the immediate challenges he hit against including that every tutorial is wrong (because they're for v2) and that the Capistrano v3 official documentation is lacking. From there he shares the steps he followed to get the whole process working:

  • Installing Ruby and Capistrano
  • Preparing the configuration files for the deploy
  • Server configuration/SSH forwarding
  • Getting Composer to work on deploy (with a Ruby gem)

There's also a few other random helpful hints around linked files/directories and variables.

tagged: capistrano v3 deployment application configuration installation notes

Link: http://jeremykendall.net/2013/11/24/php-and-capistrano-3-notes-to-self/

NetTuts.com:
Deploying a Laravel Application Using Capistrano
Nov 25, 2013 @ 18:02:47

NetTuts.com has posted a tutorial for the Laravel users out there showing how to deploy with Capistrano, a Ruby-based automation tool used to deploy to and configure remote systems.

So you’ve just built a fancy web application and you’re planning to put it online. This can be done in many ways. In this article, we’ll cover one approach to deploy your backend system to your production server. We’ll go through the following steps through the example of a Laravel application, but this can be applied to any other language or technology.

It's a pretty straight forward post, starting with what you'll need on the server and on your local machine as well as a sample "Capfile" to configure the process. There's also a bit at the end with some other things to consider like prompting for a password, running migrations and the command to do a rollback.

tagged: laravel application capistrano deployment tutorial

Link: http://net.tutsplus.com/tutorials/php/deploying-a-laravel-application-using-capistrano/

DZone.com:
Deploying PHP Projects with Webistrano
Nov 02, 2012 @ 14:46:51

On DZone.com there's a recent article posted by Kasia Gogolek that walks you through the deployment of a web application with the Webistrano tool, a web UI for working with Capistrano. This follows the first article where they talk about the Webistrano installation.

Most of the applications I write, are PHP based, so all of my examples will be based on that assumption, but you can re-use the ideas mentioned for software written in any other programming language. The setup [in the example] discusses just the deployment to the test project. Deployment to the production will be similar, and by the end of the article, you should understand what differences it will require.

She walks you through the creation of a new project, an example of the contents of the "base.rb" configuration file and how to create the stages (environments) to deploy to. Next up is the "recipes" themselves - the configuration steps for the deployment process. In their examples they show how to set permissions, update a database, manage asset files and a bit more to get Plesk installed on a server.

tagged: webistrano capistrano deployment tutorial web ui recipe

Link:

Dave Gardner's Blog:
PHP Deployment with Capistrano
Feb 15, 2012 @ 18:11:10

Dave Gardner has put together a guide to deploying PHP applications with the help of Capistrano, a Ruby-based deployment tool (including some example "recipes").

Capistrano is written in Ruby and offers up a basic DSL from which you can craft quite flexible deployment scripts. [...] That said, it’s very flexible. In my current setup I have it deploying to multiple environments (dev, staging, production), building code (think Phing), running tests on the servers before finalising the deploy and then restarting worker processes on completion.

He starts by introducing some of the commands that you can perform with the "cap" command line client and links to an example PHP project structure you cn base your deployment off of. He also includes a bit about multi-stage deployments, tag (version) selection and the full source of his build script.

tagged: capistrano introduction deployment ruby tool

Link:

Theme.fm:
Deploying WordPress with Capistrano
Aug 25, 2011 @ 17:14:18

In this recent post to Theme.fm they have a guide to deploying your WordPress site (or really any sort of PHP-driven site) with Capistrano. There's some WordPress specific bits in there, but it's a good overall guide to deployment with this handy tool.

I’m not a Capistrano expert (yet) and in this post I’ll try to give you an overview how to set it up and how to deploy WordPress applications (websites) in seconds. We’ll work with only one server today but the principles in deploying to two or more are pretty much the same.

He starts by introducing Capistrano and talking about some of the major benefits it can bring to you and your project (most importantly - simple deployments). The tutorial helps you install Capistrano and get it set up to work with your Github repository to pull the source. The WordPress specific bit has to do with configuration files and suggests an "if" check to see if there's local config first. Also included are the updates you'll need to make to the Capistrano config file and the commands to push the latest as well as rollback to your previous version.

tagged: deployment capistrano wordpress tutorial configuration

Link:


Trending Topics: