@@ -59,7 +59,7 @@ |
||
59 | 59 | $hosts = $this->selectHosts($input, $output); |
60 | 60 | $this->applyOverrides($hosts, $input->getOption('option')); |
61 | 61 | |
62 | - $task = new Task($command, function () use ($command, $hosts) { |
|
62 | + $task = new Task($command, function() use ($command, $hosts) { |
|
63 | 63 | run($command); |
64 | 64 | }); |
65 | 65 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | public function start() |
41 | 41 | { |
42 | 42 | $this->loop = React\EventLoop\Factory::create(); |
43 | - $server = new React\Http\Server($this->loop, function (ServerRequestInterface $request) { |
|
43 | + $server = new React\Http\Server($this->loop, function(ServerRequestInterface $request) { |
|
44 | 44 | try { |
45 | 45 | return $this->router($request); |
46 | 46 | } catch (Throwable $exception) { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | function spinner($message = '') |
25 | 25 | { |
26 | - $frame = FRAMES[(int)(microtime(true) * 10) % count(FRAMES)]; |
|
26 | + $frame = FRAMES[(int) (microtime(true) * 10) % count(FRAMES)]; |
|
27 | 27 | return " $frame $message\r"; |
28 | 28 | } |
29 | 29 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $plan || $this->server->start(); |
65 | 65 | $plan || $this->connect($hosts); |
66 | 66 | |
67 | - $globalLimit = (int)$this->input->getOption('limit') ?: count($hosts); |
|
67 | + $globalLimit = (int) $this->input->getOption('limit') ?: count($hosts); |
|
68 | 68 | |
69 | 69 | foreach ($tasks as $task) { |
70 | 70 | $plan || $this->messenger->startTask($task); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function connect(array $hosts) |
143 | 143 | { |
144 | - $callback = function (string $output) { |
|
144 | + $callback = function(string $output) { |
|
145 | 145 | $output = preg_replace('/\n$/', '', $output); |
146 | 146 | if (strlen($output) !== 0) { |
147 | 147 | $this->output->writeln($output); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | return 0; |
193 | 193 | } |
194 | 194 | |
195 | - $callback = function (string $output) { |
|
195 | + $callback = function(string $output) { |
|
196 | 196 | $output = preg_replace('/\n$/', '', $output); |
197 | 197 | if (strlen($output) !== 0) { |
198 | 198 | $this->output->writeln($output); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | /** @var Process[] $processes */ |
203 | 203 | $processes = []; |
204 | 204 | |
205 | - $this->server->addTimer(0, function () use(&$processes, $hosts, $task) { |
|
205 | + $this->server->addTimer(0, function() use(&$processes, $hosts, $task) { |
|
206 | 206 | foreach ($hosts as $host) { |
207 | 207 | $processes[] = $this->createProcess($host, $task); |
208 | 208 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | }); |
214 | 214 | |
215 | - $this->server->addPeriodicTimer(0.03, function ($timer) use (&$processes, $callback) { |
|
215 | + $this->server->addPeriodicTimer(0.03, function($timer) use (&$processes, $callback) { |
|
216 | 216 | $this->gatherOutput($processes, $callback); |
217 | 217 | $this->output->write(spinner()); |
218 | 218 | if ($this->allFinished($processes)) { |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | set('writable_dirs', ['var']); |
15 | 15 | set('migrations_config', ''); |
16 | 16 | |
17 | -set('bin/console', function () { |
|
17 | +set('bin/console', function() { |
|
18 | 18 | return parse('{{release_path}}/bin/console'); |
19 | 19 | }); |
20 | 20 | |
21 | -set('console_options', function () { |
|
21 | +set('console_options', function() { |
|
22 | 22 | return '--no-interaction'; |
23 | 23 | }); |
24 | 24 | |
25 | 25 | desc('Migrate database'); |
26 | -task('database:migrate', function () { |
|
26 | +task('database:migrate', function() { |
|
27 | 27 | $options = '--allow-no-migration'; |
28 | 28 | if (get('migrations_config') !== '') { |
29 | 29 | $options = sprintf('%s --configuration={{release_path}}/{{migrations_config}}', $options); |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | }); |
34 | 34 | |
35 | 35 | desc('Clear cache'); |
36 | -task('deploy:cache:clear', function () { |
|
36 | +task('deploy:cache:clear', function() { |
|
37 | 37 | run('{{bin/php}} {{bin/console}} cache:clear {{console_options}} --no-warmup'); |
38 | 38 | }); |
39 | 39 | |
40 | 40 | desc('Warm up cache'); |
41 | -task('deploy:cache:warmup', function () { |
|
41 | +task('deploy:cache:warmup', function() { |
|
42 | 42 | run('{{bin/php}} {{bin/console}} cache:warmup {{console_options}}'); |
43 | 43 | }); |
44 | 44 |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | // Cancel deployment if there would be no change to the codebase. |
14 | 14 | // This avoids unnecessary releases if the latest commit has already been deployed. |
15 | 15 | desc('Check remote head'); |
16 | -task('deploy:check_remote', function () { |
|
16 | +task('deploy:check_remote', function() { |
|
17 | 17 | $repository = get('repository'); |
18 | 18 | if (empty($repository)) { |
19 | 19 | throw new Exception("You need to specify a repository."); |
20 | 20 | } |
21 | 21 | |
22 | 22 | // Skip if there is no current deployment to compare |
23 | - if (! test('[ -d {{deploy_path}}/current/.git ]')) { |
|
23 | + if (!test('[ -d {{deploy_path}}/current/.git ]')) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | $remoteLs = null; |
43 | - on(localhost(), function () use (& $remoteLs, $opt, $repository, $ref) { |
|
43 | + on(localhost(), function() use (& $remoteLs, $opt, $repository, $ref) { |
|
44 | 44 | $getRemoteRevisionCmd = sprintf("%s ls-remote $opt $repository $ref", get('bin/git')); |
45 | 45 | $remoteLs = run($getRemoteRevisionCmd); |
46 | 46 | }); |
@@ -20,13 +20,13 @@ |
||
20 | 20 | */ |
21 | 21 | namespace Deployer; |
22 | 22 | |
23 | -set('bin/yarn', function () { |
|
23 | +set('bin/yarn', function() { |
|
24 | 24 | return run('which yarn'); |
25 | 25 | }); |
26 | 26 | |
27 | 27 | // In there is a {{previous_release}}, node_modules will be copied from it before installing deps with yarn. |
28 | 28 | desc('Install Yarn packages'); |
29 | -task('yarn:install', function () { |
|
29 | +task('yarn:install', function() { |
|
30 | 30 | if (has('previous_release')) { |
31 | 31 | if (test('[ -d {{previous_release}}/node_modules ]')) { |
32 | 32 | run('cp -R {{previous_release}}/node_modules {{release_path}}'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | use Deployer\Utility\Httpie; |
11 | 11 | |
12 | 12 | // Title of project |
13 | -set('chat_title', function () { |
|
13 | +set('chat_title', function() { |
|
14 | 14 | return get('application', 'Project'); |
15 | 15 | }); |
16 | 16 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | set('chat_line2', '{{stage}}'); |
25 | 25 | |
26 | 26 | desc('Notifying Google Hangouts Chat'); |
27 | -task('chat:notify', function () { |
|
27 | +task('chat:notify', function() { |
|
28 | 28 | if (!get('chat_webhook', false)) { |
29 | 29 | return; |
30 | 30 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ->hidden(); |
68 | 68 | |
69 | 69 | desc('Notifying Google Hangouts Chat about deploy finish'); |
70 | -task('chat:notify:success', function () { |
|
70 | +task('chat:notify:success', function() { |
|
71 | 71 | if (!get('chat_webhook', false)) { |
72 | 72 | return; |
73 | 73 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ->hidden(); |
111 | 111 | |
112 | 112 | desc('Notifying Google Hangouts Chat about deploy failure'); |
113 | -task('chat:notify:failure', function () { |
|
113 | +task('chat:notify:failure', function() { |
|
114 | 114 | if (!get('chat_webhook', false)) { |
115 | 115 | return; |
116 | 116 | } |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | */ |
27 | 27 | namespace Deployer; |
28 | 28 | |
29 | -set('bin/npm', function () { |
|
29 | +set('bin/npm', function() { |
|
30 | 30 | return run('which npm'); |
31 | 31 | }); |
32 | 32 | |
33 | 33 | // In there is a {{previous_release}}, node_modules will be copied from it before installing deps. |
34 | 34 | desc('Install npm packages'); |
35 | -task('npm:install', function () { |
|
35 | +task('npm:install', function() { |
|
36 | 36 | if (has('previous_release')) { |
37 | 37 | if (test('[ -d {{previous_release}}/node_modules ]')) { |
38 | 38 | run('cp -R {{previous_release}}/node_modules {{release_path}}'); |
@@ -48,6 +48,6 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | desc('Install npm packages with a clean slate'); |
51 | -task('npm:ci', function () { |
|
51 | +task('npm:ci', function() { |
|
52 | 52 | run("cd {{release_path}} && {{bin/npm}} ci"); |
53 | 53 | }); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | ]); |
29 | 29 | |
30 | 30 | desc('Ensure what provision run as root'); |
31 | -task('provision:switch-user', function () { |
|
31 | +task('provision:switch-user', function() { |
|
32 | 32 | run('whoami'); |
33 | 33 | if (get('remote_user') !== 'root') { |
34 | 34 | set('remote_user', 'root'); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | //Deployer::get()->preTask->add('provision:*', 'provision:switch-user'); |
39 | 39 | |
40 | 40 | desc('Check pre-required state'); |
41 | -task('provision:check', function () { |
|
41 | +task('provision:check', function() { |
|
42 | 42 | $ok = true; |
43 | 43 | if (get('php_version') !== '7.4') { |
44 | 44 | $ok = false; |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | }); |
60 | 60 | |
61 | 61 | desc('Upgrade all packages'); |
62 | -task('provision:upgrade', function () { |
|
62 | +task('provision:upgrade', function() { |
|
63 | 63 | run('apt-get update', ['env' => ['DEBIAN_FRONTEND' => 'noninteractive']]); |
64 | 64 | run('apt-get upgrade -y', ['env' => ['DEBIAN_FRONTEND' => 'noninteractive']]); |
65 | 65 | }); |
66 | 66 | |
67 | 67 | desc('Install base packages'); |
68 | -task('provision:install', function () { |
|
68 | +task('provision:install', function() { |
|
69 | 69 | $packages = [ |
70 | 70 | 'build-essential', |
71 | 71 | 'curl', |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | }); |
89 | 89 | |
90 | 90 | desc('Configure SSH'); |
91 | -task('provision:ssh', function () { |
|
91 | +task('provision:ssh', function() { |
|
92 | 92 | run('sed -i "/PasswordAuthentication yes/d" /etc/ssh/sshd_config'); |
93 | 93 | run('echo "" | sudo tee -a /etc/ssh/sshd_config'); |
94 | 94 | run('echo "" | sudo tee -a /etc/ssh/sshd_config'); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | }); |
103 | 103 | |
104 | 104 | desc('Setup deployer user'); |
105 | -task('provision:user:deployer', function () { |
|
105 | +task('provision:user:deployer', function() { |
|
106 | 106 | if (test('id deployer >/dev/null 2>&1')) { |
107 | 107 | info('deployer user already exist'); |
108 | 108 | } else { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | }); |
138 | 138 | |
139 | 139 | desc('Setup firewall'); |
140 | -task('provision:firewall', function () { |
|
140 | +task('provision:firewall', function() { |
|
141 | 141 | run('ufw allow 22'); |
142 | 142 | run('ufw allow 80'); |
143 | 143 | run('ufw allow 443'); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | }); |
146 | 146 | |
147 | 147 | desc('Install PHP packages'); |
148 | -task('provision:install:php', function () { |
|
148 | +task('provision:install:php', function() { |
|
149 | 149 | $packages = [ |
150 | 150 | "php-bcmath", |
151 | 151 | "php-cli", |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | |
171 | 171 | |
172 | 172 | desc('Install Composer'); |
173 | -task('provision:install:composer', function () { |
|
173 | +task('provision:install:composer', function() { |
|
174 | 174 | run('curl -sS https://getcomposer.org/installer | php'); |
175 | 175 | run('mv composer.phar /usr/local/bin/composer'); |
176 | 176 | }); |
177 | 177 | |
178 | 178 | desc('Configure PHP-CLI'); |
179 | -task('provision:config:php-cli', function () { |
|
179 | +task('provision:config:php-cli', function() { |
|
180 | 180 | run('sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/{{php_version}}/cli/php.ini'); |
181 | 181 | run('sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php/{{php_version}}/cli/php.ini'); |
182 | 182 | run('sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/{{php_version}}/cli/php.ini'); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | }); |
185 | 185 | |
186 | 186 | desc('Configure PHP-FPM'); |
187 | -task('provision:config:php-fpm', function () { |
|
187 | +task('provision:config:php-fpm', function() { |
|
188 | 188 | run('sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/{{php_version}}/fpm/php.ini'); |
189 | 189 | run('sed -i "s/display_errors = .*/display_errors = On/" /etc/php/{{php_version}}/fpm/php.ini'); |
190 | 190 | run('sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/{{php_version}}/fpm/php.ini'); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | }); |
194 | 194 | |
195 | 195 | desc('Configure FPM Pool'); |
196 | -task('provision:config:php-fpm:pool', function () { |
|
196 | +task('provision:config:php-fpm:pool', function() { |
|
197 | 197 | run('sed -i "s/^user = www-data/user = deployer/" /etc/php/{{php_version}}/fpm/pool.d/www.conf'); |
198 | 198 | run('sed -i "s/^group = www-data/group = deployer/" /etc/php/{{php_version}}/fpm/pool.d/www.conf'); |
199 | 199 | run('sed -i "s/;listen\.owner.*/listen.owner = deployer/" /etc/php/{{php_version}}/fpm/pool.d/www.conf'); |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | }); |
204 | 204 | |
205 | 205 | desc('Configure php sessions directory'); |
206 | -task('provision:config:php:sessions', function () { |
|
206 | +task('provision:config:php:sessions', function() { |
|
207 | 207 | run('chmod 733 /var/lib/php/sessions'); |
208 | 208 | run('chmod +t /var/lib/php/sessions'); |
209 | 209 | }); |
210 | 210 | |
211 | 211 | desc('Generating DH (Diffie Hellman) key'); |
212 | -task('provision:nginx:dhparam', function () { |
|
212 | +task('provision:nginx:dhparam', function() { |
|
213 | 213 | if (test('[ -f /etc/nginx/dhparams.pem ]')) { |
214 | 214 | info('/etc/nginx/dhparams.pem already exist'); |
215 | 215 | } else { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | }); |
221 | 221 | |
222 | 222 | desc('Install nginx & php-fpm'); |
223 | -task('provision:nginx', function () { |
|
223 | +task('provision:nginx', function() { |
|
224 | 224 | run('systemctl enable nginx.service'); |
225 | 225 | |
226 | 226 | run('sed -i "s/user www-data;/user deployer;/" /etc/nginx/nginx.conf'); |