-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.php
49 lines (41 loc) · 1.42 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
<?php
namespace Deployer;
require 'recipe/common.php';
// Config
set('application', 'craftcms5');
set('repository', '[email protected]:duikb00t/craft5-starter.git');
set('git_tty', true);
set('keep_releases', 5);
set('shared_files', ['.env']);
set('shared_dirs', ['storage']);
set('writable_dirs', ['storage', 'web/cpresources']);
set('allow_anonymous_stats', false);
// Hosts
host('production')
->setHostname('yourserver.com')
->set('remote_user', 'deployuser')
->set('deploy_path', '/var/www/craftcms5');
// Tasks
desc('Install dependencies');
task('deploy:vendors', function () {
run('cd {{release_path}} && composer install --no-dev --quiet --prefer-dist --optimize-autoloader');
});
desc('Craft CMS: run project config sync');
task('craft:project-config-sync', function () {
run('cd {{release_path}} && php craft project-config/sync --force');
});
desc('Craft CMS: clear caches');
task('craft:clear-caches', function () {
run('cd {{release_path}} && php craft cache/flush-all');
});
desc('Craft CMS: apply all pending migrations');
task('craft:migrate', function () {
run('cd {{release_path}} && php craft migrate/all');
});
// Hooks
after('deploy:shared', 'deploy:vendors');
after('deploy:vendors', 'craft:migrate');
after('craft:migrate', 'craft:project-config-sync');
after('craft:project-config-sync', 'craft:clear-caches');
after('deploy:failed', 'deploy:unlock');
after('deploy:symlink', 'craft:clear-caches');