-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.php
More file actions
55 lines (42 loc) · 1.24 KB
/
Copy pathdeploy.php
File metadata and controls
55 lines (42 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
51
52
53
54
55
<?php
namespace Deployer;
require 'recipe/common.php';
// Config
set('repository', 'https://jpirnat@github.com/jpirnat/dex.git');
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', ['config/cache', 'templates/cache']);
// Hosts
host('147.182.213.212')
->set('remote_user', 'jpirnat')
->set('labels', ['stage' => 'production'])
->set('deploy_path', '/var/www/dex')
->set('branch', 'main')
;
/*
Add the following to your computer's ~/.ssh/config file:
Host 147.182.213.212
HostName 147.182.213.212
User jpirnat
IdentityFile ~/.ssh/PRIVATE_KEY_NAME
And on the server, add the public key in ~/.ssh/authorized_keys
*/
// Tasks
desc('Deploy your project');
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'deploy:clear_paths',
'deploy:publish',
]);
task('reload:php-fpm', function () {
run('sudo /etc/init.d/php8.4-fpm restart');
});
// NOTE TO SELF: Whenever I upgrade PHP and thus need to update the php-fpm
// restart command here, I also need to update `sudo visudo` on the server so
// the updated command can be run without a password:
// jpirnat ALL=NOPASSWD: /etc/init.d/php8.4-fpm restart
// Hooks
after('deploy', 'reload:php-fpm');
after('rollback', 'reload:php-fpm');
after('deploy:failed', 'deploy:unlock');