From 2448c6aada2888bc0439cbe6e158525f605ca662 Mon Sep 17 00:00:00 2001 From: Kazunori Kimura Date: Fri, 28 Jan 2022 02:12:35 +0900 Subject: [PATCH] add terraform/packages dir to initialize_datadir() Also add them to sanitize_datadir() Note that the backup will fail if these directories do not exist with each feature enabled. --- assets/runtime/functions | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/assets/runtime/functions b/assets/runtime/functions index 5a74bae8..8d1ca5ec 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -1501,6 +1501,13 @@ initialize_datadir() { chmod u+rwX ${GITLAB_LFS_OBJECTS_DIR} chown ${GITLAB_USER}: ${GITLAB_LFS_OBJECTS_DIR} + # create terraform_state directory + # TODO : parametarize path and replace with it (e.g. GITLAB_TERRAFORM_STATE_STORAGE_PATH) - see sameersbn/gitlab#2438 + # TODO : wrap with "if [[ _ENABLED == true ]]" condition + mkdir -p ${GITLAB_SHARED_DIR}/terraform_state + chmod u+rwX ${GITLAB_SHARED_DIR}/terraform_state + chown ${GITLAB_USER}: ${GITLAB_SHARED_DIR}/terraform_state + # create registry dir if [[ ${GITLAB_REGISTRY_ENABLED} == true ]]; then mkdir -p ${GITLAB_REGISTRY_DIR} @@ -1508,6 +1515,13 @@ initialize_datadir() { chown ${GITLAB_USER}: ${GITLAB_REGISTRY_DIR} fi + # create packages directory + if [[ ${GITLAB_PACKAGES_ENABLED} == true ]]; then + mkdir -p ${GITLAB_PACKAGES_DIR} + chmod u+rwX ${GITLAB_PACKAGES_DIR} + chown ${GILTAB_USER}: ${GITLAB_PACKAGES_DIR} + fi + # create the backups directory mkdir -p ${GITLAB_BACKUP_DIR} if [[ ${GITLAB_BACKUP_DIR_CHOWN} == true ]]; then @@ -1574,11 +1588,21 @@ sanitize_datadir() { chmod -R u+rwX ${GITLAB_LFS_OBJECTS_DIR} chown -R ${GITLAB_USER}: ${GITLAB_LFS_OBJECTS_DIR} + # create terraform_state directory + # TODO : wrap with "if [[ _ENABLED ]]" condition + chmod u+rwX ${GITLAB_SHARED_DIR}/terraform_state + chown ${GITLAB_USER}: ${GITLAB_SHARED_DIR}/terraform_state + if [[ ${GITLAB_REGISTRY_ENABLED} == true ]]; then chmod -R u+rwX ${GITLAB_REGISTRY_DIR} chown -R ${GITLAB_USER}: ${GITLAB_REGISTRY_DIR} fi + if [[ ${GITLAB_PACKAGES_ENABLED} ]]; then + chmod u+rwX ${GITLAB_PACKAGES_DIR} + chown ${GILTAB_USER}: ${GITLAB_PACKAGES_DIR} + fi + find ${GITLAB_DATA_DIR}/uploads -type f -exec chmod 0644 {} \; find ${GITLAB_DATA_DIR}/uploads -type d -not -path ${GITLAB_DATA_DIR}/uploads -exec chmod 0755 {} \; chmod 0700 ${GITLAB_DATA_DIR}/uploads/