-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathdeploy.php
More file actions
66 lines (49 loc) · 1.66 KB
/
deploy.php
File metadata and controls
66 lines (49 loc) · 1.66 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
56
57
58
59
60
61
62
63
64
65
66
<?php
namespace Deployer;
require 'recipe/laravel.php';
$user = 'nick';
// Project name
set('application', 'ffxivcrafting');
set('allow_anonymous_stats', true);
set('remote_user', $user);
// Project repository
set('repository', 'git@github.com:CraftingAsAService/FFXIVCrafting.git');
set('default_stage', 'production');
set('deploy_path', '/srv/www/{{application}}');
// Overrides branch by using --branch
// Production will only use the `production` branch
set('branch', function() {
return input()->getOption('branch') ?: 'main';
});
set('git_tty', true);
set('git_cache', false); // Seems to be faster without it
set('http_user', 'www-data');
set('http_group', 'www-data');
// Hosts
host('cactuar')
->setRemoteUser($user)
->set('labels', ['stage' => 'production']);
// Tasks
desc('Upload the database');
task('upload:db', function() {
upload('../cactuar/caas.sql', '~/caas.sql');
});
desc('Update the database on Cactuar');
task('cactuar:db', function() {
require __DIR__ . '/vendor/autoload.php';
$dotenv = \Dotenv\Dotenv::createImmutable(__DIR__, '.env.' . get('labels')['stage']);
$dotenv->load();
run('mysql --defaults-file=~/password.cnf -u ' . $_ENV['DB_USERNAME'] . ' -h ' . $_ENV['DB_HOST'] . ' ' . $_ENV['DB_DATABASE'] . ' < ~/caas.sql');
});
before('cactuar:db', 'upload:db');
desc('Update the assets on Cactuar');
task('cactuar:assets', function() {
upload('../assets/ffxiv/i/', '/srv/www/assets/i/');
});
desc('Upload env file');
task('upload:env', function() {
upload('.env.production', '{{deploy_path}}/shared/.env');
});
// Additional task executions
// If the deployment fails, unlock it for future deployments
after('deploy:failed', 'deploy:unlock');