Skip to content
Snippets Groups Projects
Commit 091850cc authored by jurgenhaas's avatar jurgenhaas
Browse files

Set db backup cronjob on production sites only on main branch and bring back...

Set db backup cronjob on production sites only on main branch and bring back the crontabs enable variable
parent 27c7a996
No related branches found
No related tags found
1 merge request!20Merging develop into main
Pipeline #525106 passed
......@@ -244,6 +244,7 @@ class Handler extends BaseHandler {
// Update config for production build.
if (getenv('LAKEDROPS_BUILD_NG') === 'yes') {
$config = $handler->getConfig();
$isStaging = !in_array(getenv('PROJECT_BRANCH_SANITIZED'), ['master', 'main'], TRUE);
$root = '/drupal/' . getenv('CI_PROJECT_ID') . '/' . getenv('CI_COMMIT_BRANCH');
$drupal = $this->config->readValue('drupal');
$drupal['live'] = $config->readValue('live');
......@@ -251,13 +252,16 @@ class Handler extends BaseHandler {
$traefik['usessl'] = 1;
$traefik['ports'] = 443;
$crontabs = $this->config->readValue('crontabs');
$crontabs['www-data']['MySQL backup'] = [
'schedule' => '5 0 * * *',
'command' => 'cd /var/www/html && /usr/local/bin/drush sql:dump --result-file=/var/backups/mysql/drupal.sql',
];
if (!$isStaging) {
$crontabs['www-data']['MySQL backup'] = [
'schedule' => '5 0 * * *',
'command' => 'cd /var/www/html && /usr/local/bin/drush sql:dump --result-file=/var/backups/mysql/drupal.sql',
];
}
$crontabs['enable'] = (array_sum(array_map('count', $crontabs)) > 0);
$this->config->setValue('crontabs', $crontabs, FALSE);
$overwriteConfig = [
'staging' => !in_array(getenv('PROJECT_BRANCH_SANITIZED'), ['master', 'main'], TRUE),
'staging' => $isStaging,
'docker0' => [
'ip' => 'TRAEFIK-IP-PLACEHOLDER',
'proxy' => 'TRAEFIK-IP-PLACEHOLDER',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment