Use this package to automate the deployment process of your Laravel project that are hosted on Gitlab. Just follow the installation instructions. Don't forget to check the configuration file for the deployment options!
Require this package with composer:
composer require mikevrind/deployer
After updating composer, add the DeployerServiceProvider to the providers array in config/app.php
MikeVrind\Deployer\DeployerServiceProvider::class,
The setup of the deployer can (and should be) changed by publishing the configuration file.
You should use Artisan to copy the default configuration file from the /vendor
directory to /config/deployer.php
with the following command:
php artisan vendor:publish --provider="MikeVrind\Deployer\DeployerServiceProvider"
It's advised to define the settings via your .env file so that it's possible to change the behavior of the deployer per environment
Update the VerifyCsrfToken middleware by adding '_deployer/deploy'
to the $except
array.
Without this exception, all webhooks will fail because of a missing token in each request.
Add the following lines to your .env(.example) file. The DEPLOYER_REMOTE_*
settings are used to establish a CLI connection with the server.
DEPLOYER_ENABLED=true
DEPLOYER_MAIL_ENABLED=true
DEPLOYER_REPO_BRANCH=
DEPLOYER_REPO_PROJECT_ID=
DEPLOYER_REPO_REPOSITORY=
DEPLOYER_REMOTE_HOST=
DEPLOYER_REMOTE_USER=
DEPLOYER_REMOTE_PWD=
DEPLOYER_REMOTE_KEY=
DEPLOYER_REMOTE_KEYTEXT=
DEPLOYER_REMOTE_KEYPHRASE=
DEPLOYER_REMOTE_TIMEOUT=
Determines if the deployer should be enabled for this environment
Determines if after deployment has been completed a mail should be send to the configured recipients
Determines to which branch the deployer should listen to when the web hook is fired
Determines to which project ID the deployer should listen to when the web hook is fired
DEPLOYER_REPO_REPOSITORY (default; [email protected]/group/project.git)
Determines to which project ID the deployer should listen to when the web hook is fired
Determines to which HOST the SSH connection should be established
Determines the user that should be used for the SSH connection
Determines the password for the user that should be used for the SSH connection
Determines the public_key filename for the user that should be used for the SSH connection
Determines the public_key for the user that should be used for the SSH connection
Determines the password for the public_key
Determines how long the connection should wait for your commands. Settings this to 0
will wait indefinitely for your command to finish.
Open your project and go to Settings -> Web hooks. This package listens to the _deployer/deploy
route.
So add something like http(s)://www.domain.tld/_deployer/deploy
as the URL.
In most cases, the Push events
trigger will be oke to use. Now add the new webhook and you're done!
Please see CONTRIBUTING for details.
If you discover any (security related) issues, please create an issue in the the issue tracker.
The MIT License (MIT). Please see License File for more information.