dev-master
9999999-dev https://github.com/jsefton/laravel-remote-deployDeploy Laravel sites to a remote server directly from Artisan
MIT
The Requires
by Jamie Sefton
laravel artisan deployment deploy build production go live
Wallogit.com
2017 © Pedro Peláez
Deploy Laravel sites to a remote server directly from Artisan
This package allows you to define a remote server and directory that you can then push your changes to with a simple command directly from your local., (*1)
It allows you to create groups of commands into tasks so they can easily be ran on a remote server. This can be used for deployment, provisioning, health checks and much more., (*2)
You will need composer to install this package (get composer). Then run:, (*3)
composer require jsefton/laravel-remote-deploy
Add the below into your config/app.php within providers array, (*4)
Jsefton\LaravelRemoteDeploy\LaravelRemoteDeployProvider::class
After installation you will need to publish the config file which will allow you to specify your own list of environments. To do this run:, (*5)
php artisan vendor:publish --tag=laravel-remote-deploy
This will create the file config/laravel-remote-deploy.php where you can configure your list of environments., (*6)
Inside config/laravel-remote-deploy.php you will have 2 sets of configurations., (*7)
This includes servers, which is an array of all the possible connections you will want to create and connect too., (*8)
This also includes a set of tasks that you can then select from to run. It can contain multiple commands and feature file uploads. Below is an example config for setup and deploy:, (*9)
'setup' => [
'directory' => '/',
'commands' => [
"ssh-keygen -f ~/.ssh/id_rsa -t rsa -N '' " => [
'confirm' => 'Do you want to create an ssh key'
],
'cat ~/.ssh/id_rsa.pub',
'cd /var/www/html',
'git clone' => [
'confirm' => 'Have you installed your ssh key with the repository yet?',
'prompt' => 'Please enter a url for the git repository'
]
]
],
'deploy' => [
'directory' => '/var/www/html',
'commands' => [
'cd' => [
'prompt' => 'Please enter a folder name of the site'
],
'git pull origin master'
]
]
When in the CLI run the below to execute the command and begin the prompts, (*10)
php artisan remote:tasks
To clear out any stored credentials in temporary files run:, (*11)
php artisan remote:clear
THIS IS CURRENTLY IN DEVELOPMENT, (*12)
By adding the below in your tasks config it will allow you to provision a basic LEMP stack, (*13)
'reboot' => [
'directory' => '/',
'commands' => [
'reboot'
]
],
'provision' => [
'directory' => '/',
'commands' => [
'sudo apt-get update',
'sudo apt-get install nginx -y',
'sudo apt-get install mysql-server -y',
'sudo apt-get install php-fpm php-mysql -y'
],
'files' => [
[
'path' => '/etc/nginx/sites-available/default',
'content' => 'server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name server_domain_or_IP;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}',
'after' => [
'sudo nginx -t',
'sudo systemctl reload nginx'
]
]
]
]
Deploy Laravel sites to a remote server directly from Artisan
MIT
laravel artisan deployment deploy build production go live