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

#73 Change docker compose project name to prefix drupal_...

#73 Change docker compose project name to prefix drupal_ for deployed sites, so that they are different from pipeline project names
parent 9b9c35d6
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,7 @@ CollectConfig:
- if [[ ! -d /data/${branch} ]]; then echo "Branch $branch does not exist"; exit 1; fi
- cd /data/${branch}/app
- SANITIZED_BRANCH_NAME=$(echo ${branch} | tr [:upper:] [:lower:] | sed -r 's/[/_]+/-/g')
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec php drush sql:dump --result-file=/var/backups/mysql/drupal.sql
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec php drush sql:dump --result-file=/var/backups/mysql/drupal.sql
- cd -
- cp /data/${branch}/files/db/drupal.sql .
artifacts:
......@@ -162,14 +162,14 @@ CopyDataToStage:
- if [[ "${targetbranch}" == "main" ]]; then echo "Main branch is not an allowed target!"; exit 3; fi
- cd /data/${sourcebranch}/app
- SANITIZED_SOURCE_BRANCH_NAME=$(echo ${sourcebranch} | tr [:upper:] [:lower:] | sed -r 's/[/_]+/-/g')
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_SOURCE_BRANCH_NAME} exec php drush sql:dump --result-file=/var/backups/mysql/drupal.sql
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_SOURCE_BRANCH_NAME} exec php drush sql:dump --result-file=/var/backups/mysql/drupal.sql
- rsync -rlDzogtp /data/${sourcebranch}/files/ /data/${targetbranch}/files/
- cd /data/${targetbranch}/app
- SANITIZED_TARGET_BRANCH_NAME=$(echo ${targetbranch} | tr [:upper:] [:lower:] | sed -r 's/[/_]+/-/g')
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_TARGET_BRANCH_NAME} cp /data/${targetbranch}/files/db/drupal.sql php:/tmp
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_TARGET_BRANCH_NAME} exec php drush -y sql:drop
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_TARGET_BRANCH_NAME} exec php drush -y sql:query --file=/tmp/drupal.sql
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_TARGET_BRANCH_NAME} exec php drush cr
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_TARGET_BRANCH_NAME} cp /data/${targetbranch}/files/db/drupal.sql php:/tmp
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_TARGET_BRANCH_NAME} exec php drush -y sql:drop
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_TARGET_BRANCH_NAME} exec php drush -y sql:query --file=/tmp/drupal.sql
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_TARGET_BRANCH_NAME} exec php drush cr
ResetLocales:
variables:
......@@ -191,14 +191,14 @@ ResetLocales:
- if [[ ! -d /data/${branch}/app ]]; then branch=${CI_COMMIT_REF_NAME}; fi
- cd /data/${branch}/app
- SANITIZED_BRANCH_NAME=$(echo ${branch} | tr [:upper:] [:lower:] | sed -r 's/[/_]+/-/g')
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "truncate locales_location;"
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "truncate locales_source;"
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "truncate locales_target;"
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "truncate locale_file;"
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "delete from key_value where collection='locale.translation_status';"
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sdel locale.translation_last_checked
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y locale:check
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y locale:update
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "truncate locales_location;"
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "truncate locales_source;"
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "truncate locales_target;"
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "truncate locale_file;"
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sql:query "delete from key_value where collection='locale.translation_status';"
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y sdel locale.translation_last_checked
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y locale:check
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y locale:update
ResetLocalesCustom:
variables:
......@@ -223,7 +223,7 @@ ResetLocalesCustom:
- if [[ ! -d /data/${branch}/app ]]; then branch=${CI_COMMIT_REF_NAME}; fi
- cd /data/${branch}/app
- SANITIZED_BRANCH_NAME=$(echo ${branch} | tr [:upper:] [:lower:] | sed -r 's/[/_]+/-/g')
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y locale:import ${LANG} ${FILE} --type=custom --override=all
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec -u www-data php drush -y locale:import ${LANG} ${FILE} --type=custom --override=all
DeployAssetsToDrupal:
tags:
......@@ -248,8 +248,8 @@ DeployAssetsToDrupal:
- rm -rf vendor/${ASSET_PATH}
- git clone -b ${ASSET_BRANCH} ${ASSET_REPO} vendor/${ASSET_PATH}
- SANITIZED_BRANCH_NAME=$(echo ${CI_COMMIT_REF_NAME} | tr [:upper:] [:lower:] | sed -r 's/[/_]+/-/g')
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec php drush migrate:import --all --skip-progress-bar
- docker compose --project-name ${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec php drush migrate:import --all --skip-progress-bar
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec php drush migrate:import --all --skip-progress-bar
- docker compose --project-name drupal_${PROJECT_NAME}_${SANITIZED_BRANCH_NAME} exec php drush migrate:import --all --skip-progress-bar
Testing:
variables:
......@@ -266,6 +266,6 @@ Testing:
- if [[ ! -d /data/${sourcebranch}/app ]]; then echo "Source branch does not exist!"; exit 1; fi
- if [[ ! -d /data/${targetbranch}/app ]]; then echo "Target branch does not exist!"; exit 2; fi
- cd /data/${sourcebranch}/app
- docker compose --project-name ${PROJECT_NAME}_${sourcebranch} exec php drush st
- docker compose --project-name drupal_${PROJECT_NAME}_${sourcebranch} exec php drush st
- cd /data/${targetbranch}/app
- docker compose --project-name ${PROJECT_NAME}_${targetbranch} exec php drush st
- docker compose --project-name drupal_${PROJECT_NAME}_${targetbranch} exec php drush st
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