-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.php
131 lines (109 loc) · 2.75 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
124
125
126
127
128
129
130
131
<?php
namespace Deployer;
require 'recipe/common.php';
// Project name
set('application', 'eh-innenarchitektur');
// Project repository
set('repository', '[email protected]:ugrupp/eh-innenarchitektur.git');
// Override php and composer binaries
set('bin/composer', '/usr/bin/php8.2-cli ~/composer.phar');
set('bin/php', '/usr/bin/php8.2-cli');
// Shared files/dirs between deploys
set('shared_files', [
'.env',
'config/license.key'
]);
set('shared_dirs', [
'storage',
'web/cpresources',
'web/images',
'web/imager',
'web/photos',
'web/icons',
'web/pictograms',
'web/files',
'web/videos',
'web/user-uploads'
]);
// Writable dirs by web server
set('writable_dirs', [
'storage',
'storage/backups',
'storage/composer-backups',
'storage/config-backups',
'storage/logs',
'storage/runtime',
'config/project',
'web/cpresources',
'web/images',
'web/imager',
'web/photos',
'web/icons',
'web/pictograms',
'web/files',
'web/videos',
'web/user-uploads'
]);
set('writable_mode', 'chmod');
set('allow_anonymous_stats', false);
// Only keep 2 releases
set('keep_releases', 2);
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', false);
// Set the default deploy environment to staging
set('default_stage', 'production');
// Hosts
host('production')
->hostname('eh')
->stage('production')
->set('deploy_path', '~/relaunch2021/production');
// Tasks
desc('Execute migrations');
task('craft:migrate', function () {
run('{{release_path}}/craft migrate/up');
})->once();
desc('Clear Craft caches');
task('craft:clear_caches', function () {
run('{{release_path}}/craft clear-caches/all');
});
desc('Clear Vite file cache');
task('craft:clear_vite_cache', function () {
run('{{bin/php}} {{release_path}}/craft clear-caches/vite-file-cache');
});
desc('Build assets locally');
task('build', function () {
run('npm run build');
})->local();
desc('Upload assets');
task('upload', function () {
upload(__DIR__ . "/web/dist/", '{{release_path}}/web/dist/');
});
desc('Build and deploy your project');
task('go', [
'build',
'deploy'
]);
desc('Deploy your project');
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'upload',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
'deploy:symlink',
'deploy:unlock',
'cleanup',
'success'
]);
after('deploy:symlink', 'craft:clear_vite_cache');
// [Optional] Run migrations
// after('deploy:vendors', 'craft:migrate');
// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
// Run with '--parallel'
// dep deploy --parallel