Repository navigation
Expand file tree
/
Copy pathdeploy.php
More file actions
49 lines (36 loc) · 1.41 KB
/
Copy pathdeploy.php
File metadata and controls
49 lines (36 loc) · 1.41 KB
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
declare(strict_types=1);
namespace Deployer;
require 'recipe/symfony.php';
set('repository', 'git@github.com:johnnoel/chaostangent.com.git');
set('keep_releases', 3);
set('artifact_url', '');
set('circle_ci_token', '');
add('shared_dirs', [ 'public/media' ]);
host('chaostangent.com')
->set('hostname', '91.98.226.139')
->set('remote_user', 'chaostangent-com')
->set('deploy_path', '~/www')
->setLabels([ 'stage' => 'production' ])
;
host('beta.chaostangent.com')
->set('hostname', '91.98.226.139')
->set('remote_user', 'beta-chaostangent-com')
->set('deploy_path', '~/www')
->setLabels([ 'stage' => 'beta' ])
;
task('deploy:update_code', function (): void {
$artifactUrl = get('artifact_url');
$circleCiToken = get('circle_ci_token');
$url = escapeshellarg($artifactUrl);
$jsonRaw = run('curl -sH ' . escapeshellarg('Circle-Token: ' . $circleCiToken) . ' ' . $url);
$json = json_decode($jsonRaw, associative: true, flags: JSON_THROW_ON_ERROR);
$url = escapeshellarg($json[0]['url'] . '?' . http_build_query([ 'circle-token' => $circleCiToken ]));
run('wget -qO chaostangent-com.tar.bz2 ' . $url);
run('tar xjf chaostangent-com.tar.bz2 -C {{release_path}}');
});
task('deploy:vendors', function (): void {
// don't need vendors when the code package is pre-installed
});
after('deploy:cache:clear', 'database:migrate');
after('deploy:failed', 'deploy:unlock');