1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the nodika project. |
5
|
|
|
* |
6
|
|
|
* (c) Florian Moser <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Deployer; |
13
|
|
|
|
14
|
|
|
require 'vendor/deployer/deployer/recipe/symfony4.php'; |
15
|
|
|
|
16
|
|
|
set('bin_dir', 'bin'); |
17
|
|
|
set('var_dir', 'var'); |
18
|
|
|
|
19
|
|
|
// Configuration |
20
|
|
|
set('repository', '[email protected]:TheAlternativeZurich/feedback.git'); |
21
|
|
|
set('shared_files', array_merge(get('shared_files'), ['var/data.sqlite'])); |
|
|
|
|
22
|
|
|
set('shared_dirs', array_merge(get('shared_dirs'), ['public/upload'])); |
23
|
|
|
set('symfony_env_file', '.env'); |
24
|
|
|
set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-scripts'); |
25
|
|
|
set('env_file_path', '.env'); |
26
|
|
|
|
27
|
|
|
// import servers |
28
|
|
|
inventory('servers.yml'); |
29
|
|
|
|
30
|
|
|
//stages: dev, testing, production |
31
|
|
|
set('default_stage', 'dev'); |
32
|
|
|
//only keep two releases |
33
|
|
|
set('keep_releases', 2); |
34
|
|
|
|
35
|
|
|
//use php 7.2 |
36
|
|
|
set( |
37
|
|
|
'bin/php', |
38
|
|
|
'/usr/local/php72/bin/php' |
39
|
|
|
); |
40
|
|
|
|
41
|
|
|
//build yarn stuff & upload |
42
|
|
|
task('frontend:build', function () { |
43
|
|
|
runLocally('yarn install'); |
44
|
|
|
runLocally('yarn run encore production'); |
45
|
|
|
runLocally('rsync -azP public/dist {{user}}@{{hostname}}:{{release_path}}/public'); |
46
|
|
|
})->desc('Build frontend assets'); |
47
|
|
|
|
48
|
|
|
// kill php processes to ensure symlinks are refreshed |
49
|
|
|
task('deploy:refresh_symlink', function () { |
50
|
|
|
run('killall -9 php-cgi'); //kill all php processes so symlink is refreshed |
51
|
|
|
})->desc('Refreshing symlink'); |
52
|
|
|
//frontend stuff |
53
|
|
|
after('deploy:vendors', 'frontend:build'); |
54
|
|
|
// migrations |
55
|
|
|
after('deploy:vendors', 'database:migrate'); |
56
|
|
|
// refresh symlink |
57
|
|
|
after('deploy:symlink', 'deploy:refresh_symlink'); |
58
|
|
|
|