-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.php
More file actions
50 lines (40 loc) · 1.24 KB
/
deploy.php
File metadata and controls
50 lines (40 loc) · 1.24 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
50
<?php
namespace Deployer;
require 'recipe/laravel.php';
require 'contrib/npm.php';
// Config
set('application', 'wichtel.me');
set('git_ssh_command', 'ssh');
set('http_user', 'rondra');
set('repository', 'git@github.com:obstschale/wichteln.git');
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
set('git_tty', true);
// Hosts
host('wichtel_prod')
->set('labels', ['stage' => 'prod'])
->set('remote_user', 'rondra')
->set('deploy_path', '~/html/{{application}}');
// Tasks
desc('Build npm assets');
task('npm:build', function () {
run("cd {{release_path}} && {{bin/npm}} run build");
});
desc('Clear OPcache via HTTP');
task('opcache:reset', function () {
$file = '{{release_path}}/public/opcache-reset.php';
run("echo '<?php opcache_reset(); echo \"ok\";' > {$file}");
run("curl -s https://{{application}}/opcache-reset.php");
run("rm -f {$file}");
});
desc('Restart PHP on Uberspace');
task('uberspace:restart', function () {
run("uberspace tools restart php");
});
// Hooks
after('deploy:failed', 'deploy:unlock');
after('deploy:vendors', 'npm:install');
after('npm:install', 'npm:build');
after('deploy:symlink', 'artisan:optimize:clear');
after('artisan:optimize:clear', 'uberspace:restart');