-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.php
More file actions
104 lines (81 loc) · 2.87 KB
/
deploy.php
File metadata and controls
104 lines (81 loc) · 2.87 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
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
<?php
namespace Deployer;
require 'recipe/composer.php';
require 'recipe/silverstripe.php';
$user = '';
$php_cli = 'php84';
$git_repository = '';
$hostname = '';
$hostIp = '';
$themeName = 'mytheme';
set('repository', $git_repository);
set('theme_name', $themeName);
host($hostname)
->set('hostname', $hostIp)
->set('port', 222)
->set('remote_user',$user)
->set('forward_agent', true)
->set('ssh_multiplexing',false)
->set('http_user', $user)
// ->set('bin/composer', $php_cli . ' -d allow_url_fopen=On ~/.linuxbrew/bin/composer')
->set('stage','live')
->set('deploy_path', '/usr/www/users/' . $user); // Define the base path to deploy your project to.
// env('timezone', 'DE');
// env('branch', ''); // Branch to deploy.
set('default_stage', 'live');
set('bin/php', $php_cli);
set('repository', $git_repository);
set('keep_releases', 5);
// Silverstripe shared dirs
set('shared_dirs', [
'public/assets',
'themes/'. $themeName . '/node_modules'
]);
desc('create silverstripe-cache');
task('silverstripe:cachedir', function () {
run('mkdir -p {{release_or_current_path}}/silverstripe-cache');
}
);
//desc('set PHP Version to 8.1 in test domain');
//task('silverstripe:php81', function() {
// run('sed -i \'1s/^/FcgidWrapper "home\/httpd\/cgi-bin\/php81-fcgi-starter.fcgi" .php \n\n/\' {{release_or_current_path}}/public/.htaccess');
//});
//add task cachedir to the task list
after('deploy:update_code', 'silverstripe:cachedir');
//after('silverstripe:buildflush', 'silverstripe:php81');
desc('build frontend');
task('silverstripe:buildfrontend', function() {
run('cd {{release_or_current_path}}/themes/{theme_name} && yarn -i && yarn build');
});
after('silverstripe:buildflush', 'silverstripe:buildfrontend');
// If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
after('deploy', 'deploy:success');
//SS6
// Silverstripe cli script
set('silverstripe_cli_script', function () {
$paths = [
'framework/cli-script.php',
'vendor/silverstripe/framework/cli-script.php',
'vendor/bin/sake'
];
foreach ($paths as $path) {
if (test('[ -f {{release_or_current_path}}/' . $path . ' ]')) {
return $path;
}
}
});
/**
* Helper tasks
*/
desc('Runs /dev/build');
task('silverstripe:build', function () {
// run('{{bin/php}} {{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build');
run('{{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build');
});
//set('silverstripe_version', InstalledVersions::getVersion('silverstripe/framework'));
desc('Runs /dev/build?flush=all on Silverstripe {{silverstripe_version}}');
task('silverstripe:buildflush', function () {
// run('{{bin/php}} {{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build flush=all');
run('{{release_or_current_path}}/{{silverstripe_cli_script}} db:build --flush');
});