Search code examples
phpdeploymentlaravelweb-deployment

Laravel deployment... there is a standard way?


I'm starting to use Laravel 4 seriously in my projects. I understand that this framework offers many advantages when developing RESTful applications. But I understand that there is no consensus about how do deployment / publishing and app using Laravel. I am still using FTP to transfer files to my Production host. But my question is, Is there any standard way to do the same but from Laravel? I am faithful believing that with a little ingenuity one can create something like php artisan publish [Production server name and SSH credentials] as parameters.

I have read something interesting from Anahkiasen/rocketeer and Christopher Pitt, both great sources but there is a consensus or standard way to publish applications using laravel?


Solution

  • This is not really a Laravel problem/question, you have to ask on a dev-ops forum what they would do to deploy a PHP application like yours.

    Your Laravel application is basically PHP application, some packages are provided by Composer, so it's more a Composer application than a Laravel one, but you might have some Laravel needs, like executing php artisan migrate, or any other artisan command to post-deploy your application, or not, so, it's more a requirement of your application than Laravel, right?

    I developed a package to do my deployments, Deeployer. The intent of this package is, everytime I push my application to the production (or staging) branch, Github will fire a hook that tells my server to do whatever it needs to deploy my application to my own VPS. In a basic deployment it will:

    1) git pull the repository

    2) Execute composer update to update my vendor folder

    3) Execute bower update to download whatever js or css I've installed

    4) Execute php artisan migrate to upgrade my database schema

    5) Execute chmod and chown to fix whatever permission mess those commands might have made to my directories while downloading files

    See? Those are things that are very particular to my deployment structure, that's why I don't really think you are going to find consensus about a deployment app. When Anahkiasen first build Rocketeer, someone shout: "Why are you doing this if we already have Capistrano?".

    Yesterday I bumped into this one: http://www.deployhq.com/packages, used by Ben Corlet from Cartalyst and other nice guys.

    There's also Rocketeer: http://rocketeer.autopergamene.eu/.

    Don't forget that Laravel itself has it's own SSH Remote component (I used it on Deeployer and Rocketeer uses it too), that might help you do whatever you need to deploy your app.

    So, you better think what are your deployment needs and find your way, using a package, app or just Laravel.