Created
November 19, 2018 07:24
-
-
Save artemrogov/64c085af2abfedfb4ab4f6651dad37ea to your computer and use it in GitHub Desktop.
Настройка расширения deployer для разворачивания фреймворка Laravel 5.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Deployer; | |
require 'recipe/laravel.php'; | |
// Project name | |
set('application', 'qian'); | |
// Project repository | |
set('repository', '[email protected]:chine_shop/backend.git'); | |
// [Optional] Allocate tty for git clone. Default value is false. | |
set('git_tty', false); | |
// Shared files/dirs between deploys | |
add('shared_files', [ | |
'.env' | |
]); | |
add('shared_dirs', [ | |
'storage' | |
]); | |
add('writable_dirs', [ | |
'bootstrap/cache', | |
'storage', | |
'storage/app', | |
'storage/app/public', | |
'storage/framework', | |
'storage/framework/cache', | |
'storage/framework/sessions', | |
'storage/framework/views', | |
'storage/logs', | |
]); | |
// Hosts | |
host('176.57.215.185') | |
->user('qian') | |
->port(22) | |
->identityFile('~/.ssh/id_rsa') | |
->forwardAgent(true) | |
->multiplexing(true) | |
->addSshOption('UserKnownHostsFile', '/dev/null') | |
->addSshOption('StrictHostKeyChecking', 'no') | |
->set('deploy_path', '/home/qian/app'); | |
// Tasks | |
desc('Restart PHP-FPM service'); | |
task('php-fpm:restart', function () { | |
// The user must have rights for restart service | |
// /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service | |
run('sudo systemctl restart php7.2-fpm.service'); | |
}); | |
after('deploy:symlink', 'php-fpm:restart'); | |
task('upload:env', function () { | |
upload('.env.production', '{{deploy_path}}/shared/.env'); | |
})->desc('Environment setup'); | |
// [Optional] if deploy fails automatically unlock. | |
after('deploy:failed', 'deploy:unlock'); | |
task('deploy', [ | |
'deploy:prepare', | |
'deploy:lock', | |
'deploy:release', | |
'deploy:update_code', | |
'upload:env', | |
'deploy:shared', | |
'deploy:vendors', | |
'deploy:writable', | |
'artisan:storage:link', | |
'artisan:view:clear', | |
'artisan:cache:clear', | |
'artisan:config:cache', | |
'artisan:migrate', | |
'deploy:symlink', | |
'php-fpm:restart', | |
'deploy:unlock', | |
'cleanup', | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment