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?
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.
There are a lot of deployment tool, like Capistrano. I recommend you to take a look at Deployer: it's has simple api, bundled with recipes for popular frameworks and apps, and can do 100% parallel task execution. Also it requires only for PHP.
Here is an example of simple task:
task('my_task', function () {
// Your tasks code...
});
Also it has a good quality code:
You may want to check out Rocketeer: http://rocketeer.autopergamene.eu/
If you are asking for a standard, I don't think there is one. But an alternative from FTP, well, have you considered using git as a way to deploy your site to production?
Here is how you do it:
http://danbarber.me/using-git-for-deployment/ (Link is broken)
https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
Basically the summary is that you have a bare git repository
, your own local repository
and your production repository
.. now by configuring the correct hooks, when you push to the bare git repository
, a hook in it will tell the production repository to pull the most recent changes you commited down to the production. And in addition, setting up the correct credentials in your config depending on the environment.. you can create a new folder ex. app/config/production
and app/config/stage
so that you can easily run the application even while switching on both servers..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With