Helper for Laravel to deploy from artisan
Compatible with Laravel 5.1, 5.4 and higher.
For Laravel 5.1 use branch 5.1 and tag v0.5.x
LDH is a Laravel package that helps with deploying your website without the usage of FTP.
The LDH packages uses SSH to build a deployment environment on the server for zero-downtime deployments
and rollback functionality.
Everyone is allowed to help getting this package bigger and better! ;-)
$ composer require daltcore/laravel-deploy-helper
In your config/app.php
$ php artisan vendor:publish --tag=ldh-config
Deploy to server
Deploy full instance to the remote server
php artisan ldh:deploy --stage=production --branch=develop
Patch to server
Push a simple patch to the remote server (minor changes only)
php artisan ldh:patch --stage=production --branch=patch
Rollback one instance
Something went horrably wrong, go back in history
php artisan ldh:rollback --stage=production
In the stages section you have to define your stages information.
You can use git's http url with basic auth. Example: https://username:email@example.com/repo/name.git .
You can use git's ssh. Example: firstname.lastname@example.org:repo/name.git
In the connection section you can add your ssh details for deploying
Here you can put the root directory where LDH can set up it's directory structure
This is a array with commands that needs to be executed from the /current directory
This is te section with directories that needs to be copied from the previous deploy to the next one
The same as with the directories, but then with files.
Here you can optionally put some dependencies (applications) that you want to use for deploy.
You can use this for checking if everything on the server is setup correctly with the versions.
You may want use 'true' for no version checking, but instead just checking if the application exists.
How many 'shadow' copies of the old deploys needs to exist. These come in handy for the rollback feature.
<?php return [ 'default' => [ 'stage' => 'production', ], 'stages' => [ 'production' => [ 'git' => '', 'branch' => '', 'connection' => [ 'host' => '', 'username' => '', 'password' => '', // 'key' => '', // 'keytext' => '', // 'keyphrase' => '', // 'agent' => '', 'timeout' => 10, ], 'remote' => [ 'root' => '/var/www', ], 'commands' => [ 'composer install', ], 'shared' => [ 'directories' => [ 'public', 'storage', ], 'files' => [ '.env', ], ], 'config' => [ 'dependencies' => [ 'php' => '>=5.6', 'git' => true, ], 'keep' => 4, ], ], ], ];
LDH deploys the following directory structure on first deploy
. ├── current -> /var/www/vhosts/example.org/releases/1498833243 ├── ldh.json ├── patches │ └── 0001-Update-readme.md.patch ├── releases │ └── 1498833243 └── shared
As you can see, LDH makes a static link from
You you only have to point your vhost to the
/current/public for your Laravel website to work.