Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ pipelines:
caches:
- composer
script:
# build frontend and run composer
# Install composer dependencies
- composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader
# build frontend
- sh ./bitbucket_pipelines_build_frontend.sh
# deploy:
- cp .deploy/ssh/* ~/.ssh/. && chmod 400 ~/.ssh/bitbucket_pipelines*
# Deploy to staging
- dep deploy staging -vv
main:
- step:
Expand All @@ -22,9 +22,9 @@ pipelines:
caches:
- composer
script:
# build frontend and run composer
# Install composer dependencies
- composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader
# build frontend
- sh ./bitbucket_pipelines_build_frontend.sh
# deploy:
- cp .deploy/ssh/* ~/.ssh/. && chmod 400 ~/.ssh/bitbucket_pipelines*
# Deploy to production
- dep deploy production -vv
40 changes: 18 additions & 22 deletions deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
//change writeable mode to chown because combell does not have acl installed:
set('writable_mode', 'chown');
set('keep_releases', 2);
//set('copy_dirs', ['vendor', 'node_modules']);

// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);

set('cachetool_args', '--web --web-path=./web --web-url=https://{{http_host}}');

// Shared files/dirs between deploys
set('shared_files', [
'.env'
Expand All @@ -28,7 +24,6 @@
'public/files',
'translations',
]);

// Writable dirs by web server
set('writable_dirs', [
'storage',
Expand All @@ -38,12 +33,8 @@
'public/cpresources',
'public/frontend'
]);

// Set the worker process user
set('http_user', 'worker');

// Disable multiplexing
set('ssh_multiplexing', false);
// Enable multiplexing
set('ssh_multiplexing', true);

//configure rsync:
set('rsync_src', __DIR__);
Expand All @@ -60,8 +51,8 @@
'filter' => [],
'filter-file' => false,
'filter-perdir' => false,
'flags' => 'rz',
'options' => ['delete'],
'flags' => 'rzl',
'options' => ['delete', 'no-whole-file'],
'timeout' => 300,
]);

Expand All @@ -71,15 +62,15 @@
desc('Copy the correct .htaccess file for the given stage');
task('statik:copy_htaccess', function () {
$htaccessFile = get('htaccess_file');
if($htaccessFile) {
if ($htaccessFile) {
run("cp {{release_path}}/config/$htaccessFile {{release_path}}/public/.htaccess");
}
});

desc('Copy the correct robots.txt file for the given stage');
task('statik:copy_robots', function () {
$robotsFile = get('robots_file');
if($robotsFile) {
if ($robotsFile) {
run("cp {{release_path}}/config/$robotsFile {{release_path}}/public/robots.txt");
}
});
Expand All @@ -106,18 +97,14 @@

desc('Symlink current/public to www');
task('statik:symlink', function () {
$stage = get('stage');

if ($stage === 'production') {
onlyOnProduction(function () {
run('if [ ! -L "/data/sites/web/[PROJECT_CODE_HERE]livestatikbe/www" ]; then ln -s subsites/[PROJECT_CODE_HERE].live.statik.be/current/public /data/sites/web/[PROJECT_CODE_HERE]livestatikbe/www; fi');
} else {
run('echo "only run this task on production"');
}

});
})->once();

desc('Reload PHP-FPM');
task('statik:reload-phpfpm', function () {
sleep(3);
//reload the PHP-FPM caches.
//Combell has a command to achieve this: reloadPHP.sh
$tries = 1;
Expand Down Expand Up @@ -164,3 +151,12 @@
after('deploy', 'statik:symlink');
after('statik:symlink', 'statik:reload-phpfpm');
after('deploy', 'deploy:success');

function onlyOnProduction(callable $taskLogic)
{
if (get('stage') === 'production') {
$taskLogic();
} else {
writeln('Skipping task: not in production stage.');
}
}