-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.php
105 lines (90 loc) · 2.72 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
<?php
namespace Deployer;
require 'recipe/symfony4.php';
require 'recipe/cachetool.php';
require 'recipe/sentry.php';
require __DIR__ . '/vendor/tijsverkoyen/deployer-sumo/sumo.php';
// Define some variables
set('client', 'sumocoders');
set('project', 'users');
set('repository', '[email protected]:sumocoders/Framework-User-Implementation-Example.git');
set('production_url', '$productionUrl');
// Define staging
host('dev02.sumocoders.eu')
->user('sites')
->stage('staging')
->set('deploy_path', '~/apps/{{client}}/{{project}}')
->set('branch', 'main')
->set('bin/php', 'php7.4')
->set('bin/composer', 'php7.4 /usr/local/bin/composer')
->set('cachetool', '/var/run/php_74_fpm_sites.sock')
->set('document_root', '~/php74/{{client}}/{{project}}');
// Define production
//host('$host')
// ->user('sites')
// ->stage('production')
// ->set('deploy_path', '~/apps/{{client}}/{{project}}')
// ->set('branch', 'master')
// ->set('bin/php', '$phpBinary')
// ->set('cachetool', '$socketPath')
// ->set('document_root', '~/php72/{{client}}/{{project}}');
/*************************
* No need to edit below *
*************************/
set('use_relative_symlink', false);
// Shared files/dirs between deploys
add('shared_files', ['.env.local']);
add('shared_dirs', []);
// Writable dirs by web server
add('writable_dirs', []);
// Disallow stats
set('allow_anonymous_stats', false);
// Composer
set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest --no-scripts');
// Sentry
set(
'sentry',
[
'organization' => get('sentry_organization'),
'projects' => [
get('sentry_project_slug'),
],
'token' => get('sentry_token')
]
);
/*****************
* Task sections *
*****************/
// Build tasks
task(
'build:assets:npm',
function () {
if (commandExist('nvm')) {
run('nvm install');
run('nvm exec npm run build');
} else {
run('npm run build');
}
}
)
->desc('Run the build script which will build our needed assets.')
->local();
// Upload tasks
task(
'upload:assets',
function () {
upload(__DIR__ . '/public/build', '{{release_path}}/public');
}
)
->desc('Uploads the assets')
->addBefore('build:assets:npm');
after('deploy:update_code', 'upload:assets');
/**********************
* Flow configuration *
**********************/
// Clear the Opcache
after('deploy:symlink', 'cachetool:clear:opcache');
// Unlock the deploy when it failed
after('deploy:failed', 'deploy:unlock');
// Migrate database before symlink new release.
before('deploy:symlink', 'database:migrate');