-
Notifications
You must be signed in to change notification settings - Fork 4
/
stratus.php
80 lines (69 loc) · 2.21 KB
/
stratus.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
<?php
declare(strict_types=1);
namespace Deployer;
set('stratus_cli', '/usr/share/stratus/cli');
desc('Stratus clear all caches');
task('stratus:cc', function () {
if (!isDev()) {
run('{{stratus_cli}} cache.all.clear;');
}
});
desc('Stratus Cloudfront clear');
task('stratus:cloudfront', function () {
if (!isDev()) {
run('{{stratus_cli}} cache.cloudfront.invalidate');
}
});
desc('Stratus Varnish clear');
task('stratus:varnish', function () {
if (!isDev()) {
run('{{stratus_cli}} cache.varnish.clear');
}
});
desc('Stratus Nginx Reload');
task('stratus:nginx:update', function () {
if (!isDev()) {
run('{{stratus_cli}} nginx.update');
}
});
desc('Turn off cron before deploy');
task('stratus:cron_disable', function () {
if (isProduction()) {
writeln('<info>Disabling crons...</info>');
run('{{stratus_cli}} crons.stop;');
}
});
desc('Turn on cron after deploy');
task('stratus:cron_enable', function () {
if (isProduction()) {
writeln('<info>Enabling crons...</info>');
run('{{stratus_cli}} crons.start;');
}
});
desc('Zero Downtime Deployment Init (Blue/Green)');
task('stratus:zdd:init', function () {
run('{{stratus_cli}} zerodowntime.init');
});
desc('Zero Downtime Deployment Switch (Blue/Green)');
task('stratus:zdd:switch', function () {
run('{{stratus_cli}} zerodowntime.switch');
});
desc('Sync scaled php-fpm pods with new codebase Autoscaling depreciated method');
task('stratus:autoscale:reinit', function () {
run('{{stratus_cli}} autoscaling.reinit && sleep 120s');
});
desc('Handle Webscale Stratus autoscaling');
task('stratus:autoscale', function () {
if (!isDev()) {
writeln('<info>Clearing caches...</info>');
invoke('stratus:cc');
writeln('<info>Initializing zero downtime...</info>');
invoke('stratus:zdd:init');
writeln('<info>Switching to new code base</info>');
invoke('stratus:zdd:switch');
writeln('<info>Reload Nginx in case of Docroot symlink change</info>');
invoke('stratus:nginx:update');
writeln('<info>Clearing caches one more time after blue or green switched...</info>');
invoke('stratus:cc');
}
});