|
| 1 | +<?php |
| 2 | +namespace Deployer; |
| 3 | + |
| 4 | +require 'recipe/common.php'; |
| 5 | + |
| 6 | +// Project name |
| 7 | +set('application', 'UF Learn 6'); |
| 8 | + |
| 9 | +// Project repository |
| 10 | +set('repository', 'https://github.com/userfrosting/learn.git'); |
| 11 | +set('branch', 'main'); |
| 12 | +set('update_code_strategy', 'clone'); // Required for submodules |
| 13 | + |
| 14 | +// Writable dirs by web server |
| 15 | +set('writable_dirs', [ |
| 16 | + 'app/cache', |
| 17 | + 'app/logs', |
| 18 | + 'app/sessions', |
| 19 | +]); |
| 20 | +set('allow_anonymous_stats', false); |
| 21 | + |
| 22 | +// Hosts |
| 23 | +host('prod') |
| 24 | + ->set('remote_user', 'deploy-learn') |
| 25 | + ->set('hostname', '157.245.12.207') |
| 26 | + ->set('deploy_path', '/var/www/learn6') |
| 27 | + ->set('identity_file', '~/.ssh/deploy_rsa'); |
| 28 | + |
| 29 | +// UF Bakery task |
| 30 | +task('bakery:bake', function () { |
| 31 | + within('{{release_path}}', function () { |
| 32 | + run('php bakery bake'); |
| 33 | + }); |
| 34 | +}); |
| 35 | +task('composer:update', function () { |
| 36 | + within('{{release_path}}', function () { |
| 37 | + run('composer update --no-dev -o'); |
| 38 | + }); |
| 39 | +}); |
| 40 | +task('bakery:setenv', function () { |
| 41 | + within('{{release_path}}', function () { |
| 42 | + run('php bakery setup:env --mode=production'); |
| 43 | + }); |
| 44 | +}); |
| 45 | + |
| 46 | +// Git submodule task |
| 47 | +task('npm:update', function () { |
| 48 | + within('{{release_path}}', function () { |
| 49 | + run('npm update'); |
| 50 | + }); |
| 51 | +}); |
| 52 | + |
| 53 | +// Tasks |
| 54 | +desc('Deploy your project'); |
| 55 | +task('deploy', [ |
| 56 | + 'deploy:prepare', |
| 57 | + 'deploy:clear_paths', |
| 58 | + 'composer:update', |
| 59 | + 'npm:update', |
| 60 | + 'bakery:setenv', |
| 61 | + 'bakery:bake', |
| 62 | + 'deploy:symlink', |
| 63 | + 'deploy:unlock', |
| 64 | + 'deploy:cleanup', |
| 65 | + 'deploy:success' |
| 66 | +]); |
| 67 | + |
| 68 | +// [Optional] If deploy fails automatically unlock. |
| 69 | +after('deploy:failed', 'deploy:unlock'); |
0 commit comments