-
Notifications
You must be signed in to change notification settings - Fork 14
/
deploy.php
123 lines (98 loc) · 3.11 KB
/
deploy.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
namespace Deployer;
require 'recipe/common.php';
require 'vendor/studio24/deployer-recipes/recipe/common.php';
/**
* Deployment configuration variables - set on a per-project basis
*/
/**
* Apply configuration to Deployer
*
* Don't edit beneath here unless you know what you're doing!
*
* DO NOT store the Slack hook in a public repo
*/
set('application', 'W3C Frontend');
set('repository', '[email protected]:w3c/w3c-website-frontend.git');
set('shared_files', ['.env.local']);
set('shared_dirs', [
'var/log',
'var/sessions'
]);
set('writable_dirs', ['var/cache']);
set('http_user', 'www-data');
set('webroot', 'public');
set('git_tty', true);
set('allow_anonymous_stats', false);
set('git_ssh_command', 'ssh');
set( 'writable_mode', 'acl');
/*
* Host information
* These settings should not need amending
* Additional hosts and stages can be added
* by copying the entire host block
* Host, stage and deploy path must be unique
*/
host('production')
->set('labels', ['stage' => 'production'])
->set('remote_user', 'studio24')
->set('hostname', 'leda.w3.internal')
->set('deploy_path', '/var/www/frontend')
->set('url', 'https://www.w3.org');
// Currently not in use
// host('staging')
// ->stage('staging')
// ->user('studio24')
// ->hostname('128.30.54.149')
// ->set('deploy_path', '/var/www/frontend-staging')
// ->set('url', 'https://www-staging.w3.org')
// ->set('composer_options', '{{composer_action}} --no-dev --verbose --no-progress --no-interaction --optimize-autoloader');
host('development')
->set('labels', ['stage' => 'development'])
->set('remote_user', 'studio24')
->set('hostname', 'thebe.w3.internal')
->set('deploy_path', '/var/www/frontend-dev')
->set('url', 'https://www-dev.w3.org')
->set('branch', 'update/deployer-7')
->set('composer_options', '--optimize-autoloader');
/**
* Deployment task
* The task that will be run when using dep deploy
*/
desc('Deploy ' . get('application'));
task('deploy', [
// Run initial checks
'deploy:prepare',
// Remind user to check that the remote .env is up to date (development and staging (default N)
'env-reminder',
'deploy:vendors',
// Dump environment file
// 'dump-env',
// Run deployment
'deploy:clear_paths',
'deploy:publish'
]);
/**
* Custom Tasks
*/
// Reminder to ensure remote .env file is upto date
desc('Remind user to update remote .env before continuing');
task('env-reminder', function () {
$stage = get('hostname');
writeln(' ');
writeln("<fg=green;options=bold>Please double check whether you need to edit the .env.local file on the server for $stage</>");
writeln(' ');
if (!askConfirmation('Continue with deployment?')) {
die('Ok, deployment cancelled.');
}
});
desc('Dump env details for deployment');
task('dump-env', function () {
writeln('composer dump-env');
});
desc('Clear cache after Composer install');
task('cache-clear', function () {
writeln('php bin/console cache:clear');
});
// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');