forked from wp-berlin/tech-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.php
70 lines (60 loc) · 1.79 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
<?php
namespace Deployer;
require 'recipe/common.php';
require_once __DIR__ . '/deploy/update_code.php';
require_once __DIR__ . '/deploy/vendors.php';
require_once __DIR__ . '/deploy/database.php';
require_once __DIR__ . '/deploy/plugins.php';
require_once __DIR__ . '/deploy/assets.php';
require_once __DIR__ . '/deploy/cachetool.php';
require_once __DIR__ . '/deploy/revisions.php';
require_once __DIR__ . '/deploy/content.php';
// Configuration
set('repository', '[email protected]:wp-berlin/tech-website.git');
set('shared_dirs', ['web/uploads', 'web/languages', 'log', 'config']);
set('shared_files', ['wp-cli.yml']);
set('writable_dirs', ['vendor', 'shared/web', 'shared/log']);
// Servers
host('151.252.51.213')
->user('wp-berlin')
->port(22)
->stage('production')
->configFile(__DIR__ . '/ssh_config')
->multiplexing(true)
->set('deploy_path', '/var/www/wp-berlin/production')
->set('composer_action', 'install')
->set('composer_options', '-o --no-dev --no-interaction');
task('reload_services', function () {
run('sudo service nginx reload');
});
task('symlink:db', function () {
run("ln -s {{release_path}}/web/plugins/sqlite-integration/db.php {{release_path}}/web/assets/db.php");
});
task('ssh:add_key', function () {
runLocally('ssh-add -AK');
});
task('content', [
'content:update',
]);
// Tasks
desc('Deploy your project');
task('deploy', [
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
'deploy:assets',
'symlink:db',
'deploy:symlink',
'deploy:unlock',
'wp:plugins',
'cachetool:clear:opcache',
'reload_services',
'cleanup',
]);
after('deploy', 'success');
before('deploy', 'content:update');