From 613fb3fe6e85ae0c69bd0f365c8c43b11fa17a81 Mon Sep 17 00:00:00 2001 From: Tom Wiesing Date: Mon, 29 Jun 2020 10:23:05 +0200 Subject: [PATCH] Rename 'COMPOSER_*' -> 'DEPLOY_*' and remove unuused variables --- distillery/.env.sample | 11 +++-------- distillery/lib/10_config.sh | 22 +++++++--------------- distillery/lib/20_sql.sh | 4 ++-- distillery/lib/30_slug.sh | 2 +- distillery/system_install.sh | 26 +++++++++++++------------- distillery/system_update.sh | 6 +++--- 6 files changed, 29 insertions(+), 42 deletions(-) diff --git a/distillery/.env.sample b/distillery/.env.sample index 6738e8c..d8ca8ae 100644 --- a/distillery/.env.sample +++ b/distillery/.env.sample @@ -1,11 +1,6 @@ -# All WissKi and Drupal Installations are contained within a single directory. -# The name of each subfolder corresponds to the appropriate domain name. -# This variable determines the subfolder to place installations into. -DRUPAL_ROOT=/var/www/factory - -# Furthermore, several docker-compose files are created to manage global services and the system itself. -# These will be placed into a folder, set its' path here. -COMPOSER_ROOT=/var/www/deploy +# Several docker-compose files are created to manage global services and the system itself. +# On top of this all real-system space will be created under this directory. +DEPLOY_ROOT=/var/www/deploy # The system can support setting up certificate(s) automatically. # It can be enabled by setting an email for certbot certificates. diff --git a/distillery/lib/10_config.sh b/distillery/lib/10_config.sh index 781c18b..e343590 100644 --- a/distillery/lib/10_config.sh +++ b/distillery/lib/10_config.sh @@ -76,17 +76,9 @@ function is_valid_email() { fi } -# The 'DRUPAL_ROOT' variable must be an absolute path. -if ! is_valid_abspath "$DRUPAL_ROOT"; then - log_error "Variable 'DRUPAL_ROOT' is missing or not a valid path. "; - log_info "Please verify that it is set correctly in '.env'. "; - log_info "Please ensure that it does not end in '/'. "; - exit 1; -fi - -# The 'COMPOSER_ROOT' variable must be an absolute path. -if ! is_valid_abspath "$COMPOSER_ROOT"; then - log_error "Variable 'COMPOSER_ROOT' is missing or not a valid path. "; +# The 'DEPLOY_ROOT' variable must be an absolute path. +if ! is_valid_abspath "$DEPLOY_ROOT"; then + log_error "Variable 'DEPLOY_ROOT' is missing or not a valid path. "; log_info "Please verify that it is set correctly in '.env'. "; log_info "Please ensure that it does not end in '/'. "; exit 1; @@ -159,10 +151,10 @@ if ! is_valid_number "$PASSWORD_LENGTH"; then fi # paths to composer things -COMPOSER_WEB_DIR="$COMPOSER_ROOT/core/web" -COMPOSER_TRIPLESTORE_DIR="$COMPOSER_ROOT/core/triplestore" -COMPOSER_SQL_DIR="$COMPOSER_ROOT/core/sql" -COMPOSER_INSTANCES_DIR="$COMPOSER_ROOT/instances" +DEPLOY_WEB_DIR="$DEPLOY_ROOT/core/web" +DEPLOY_TRIPLESTORE_DIR="$DEPLOY_ROOT/core/triplestore" +DEPLOY_SQL_DIR="$DEPLOY_ROOT/core/sql" +DEPLOY_INSTANCES_DIR="$DEPLOY_ROOT/instances" log_ok "Read and validated configuration file. " \ No newline at end of file diff --git a/distillery/lib/20_sql.sh b/distillery/lib/20_sql.sh index c803be5..086092e 100644 --- a/distillery/lib/20_sql.sh +++ b/distillery/lib/20_sql.sh @@ -34,7 +34,7 @@ function _wait_for_sql_internal() { # 'dockerized_mysql' runs an sql command in the sql docker container function dockerized_mysql() { - pushd "$COMPOSER_SQL_DIR" > /dev/null + pushd "$DEPLOY_SQL_DIR" > /dev/null docker exec -i `docker-compose ps -q sql` mysql "$@" retval=$? popd > /dev/null @@ -43,7 +43,7 @@ function dockerized_mysql() { # 'dockerized_mysql' runs an sql command in the sql docker container interactively function dockerized_mysql_interactive() { - pushd "$COMPOSER_SQL_DIR" > /dev/null + pushd "$DEPLOY_SQL_DIR" > /dev/null docker exec -ti `docker-compose ps -q sql` mysql "$@" retval=$? popd > /dev/null diff --git a/distillery/lib/30_slug.sh b/distillery/lib/30_slug.sh index 8bc3abd..15871ad 100644 --- a/distillery/lib/30_slug.sh +++ b/distillery/lib/30_slug.sh @@ -57,7 +57,7 @@ GRAPHDB_USER="${GRAPHDB_USER_PREFIX}${USERNAME_BASE}" GRAPHDB_REPO="${GRAPHDB_REPO_PREFIX}${USERNAME_BASE}" # Compute the base directory for the files that will live on disk. -INSTANCE_BASE_DIR="$COMPOSER_INSTANCES_DIR/$INSTANCE_DOMAIN" +INSTANCE_BASE_DIR="$DEPLOY_INSTANCES_DIR/$INSTANCE_DOMAIN" INSTANCE_DATA_DIR="$INSTANCE_BASE_DIR/data/" if [ -n "$CERTBOT_EMAIL" ]; then diff --git a/distillery/system_install.sh b/distillery/system_install.sh index 78a88b5..12f98d1 100755 --- a/distillery/system_install.sh +++ b/distillery/system_install.sh @@ -46,34 +46,34 @@ log_info "=> Installing docker-compose" pip3 install --upgrade docker-compose log_info "=> Creating docker-compose directories" -mkdir -p "$COMPOSER_INSTANCES_DIR" -mkdir -p "$COMPOSER_WEB_DIR" -mkdir -p "$COMPOSER_TRIPLESTORE_DIR" -mkdir -p "$COMPOSER_SQL_DIR" +mkdir -p "$DEPLOY_INSTANCES_DIR" +mkdir -p "$DEPLOY_WEB_DIR" +mkdir -p "$DEPLOY_TRIPLESTORE_DIR" +mkdir -p "$DEPLOY_SQL_DIR" log_info "=> Creating 'distillery' network" docker network create distillery || true log_info "=> Creating 'docker-compose' files for the 'web'. " -install_resource_dir "compose/web" "$COMPOSER_WEB_DIR" +install_resource_dir "compose/web" "$DEPLOY_WEB_DIR" # copy over the directory log_info "=> Creating 'docker-compose' files for the 'triplestore'. " -install_resource_dir "compose/triplestore" "$COMPOSER_TRIPLESTORE_DIR" +install_resource_dir "compose/triplestore" "$DEPLOY_TRIPLESTORE_DIR" # copy the graphdb.zip -echo "Writing \"$COMPOSER_TRIPLESTORE_DIR/graphdb.zip\"" -cp "$GRAPHDB_ZIP" "$COMPOSER_TRIPLESTORE_DIR/graphdb.zip" +echo "Writing \"$DEPLOY_TRIPLESTORE_DIR/graphdb.zip\"" +cp "$GRAPHDB_ZIP" "$DEPLOY_TRIPLESTORE_DIR/graphdb.zip" # create data (volume) location -mkdir -p "$COMPOSER_TRIPLESTORE_DIR/data/data/" -mkdir -p "$COMPOSER_TRIPLESTORE_DIR/data/work/" -mkdir -p "$COMPOSER_TRIPLESTORE_DIR/data/logs/" +mkdir -p "$DEPLOY_TRIPLESTORE_DIR/data/data/" +mkdir -p "$DEPLOY_TRIPLESTORE_DIR/data/work/" +mkdir -p "$DEPLOY_TRIPLESTORE_DIR/data/logs/" # copy over the sql resource directory, then ensure the data diretory for sql exists. log_info "=> Creating 'docker-compose' files for the 'sql'. " -install_resource_dir "compose/sql" "$COMPOSER_SQL_DIR" -mkdir -p "$COMPOSER_SQL_DIR/data/" +install_resource_dir "compose/sql" "$DEPLOY_SQL_DIR" +mkdir -p "$DEPLOY_SQL_DIR/data/" # Run all the updates via system_update.sh log_info " => Running 'system_update.sh'" diff --git a/distillery/system_update.sh b/distillery/system_update.sh index 2170cda..35300ca 100755 --- a/distillery/system_update.sh +++ b/distillery/system_update.sh @@ -15,15 +15,15 @@ function update_stack() { } log_info "=> Rebuilding and restarting 'web' stack" -update_stack "$COMPOSER_WEB_DIR" +update_stack "$DEPLOY_WEB_DIR" # build and start the triplestore log_info "=> Rebuilding and restarting 'triplestore' stack" -update_stack "$COMPOSER_TRIPLESTORE_DIR" +update_stack "$DEPLOY_TRIPLESTORE_DIR" # build and start the triplestore log_info "=> Rebuilding and restarting 'sql' stack" -update_stack "$COMPOSER_SQL_DIR" +update_stack "$DEPLOY_SQL_DIR" # TODO: Iterate over all the instance # and a pull_and_update