Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prepare simcore stack #405

Merged
merged 10 commits into from
Oct 26, 2023
49 changes: 49 additions & 0 deletions scripts/deployments/prepare_simcore_stack.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
#
#
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o errexit
set -o nounset
set -o pipefail
# For debugging purposes, uncomment this and get every executed bash command printed to the console for tracing.
#set -x
#######
#
IFS=$'\n\t'

# Paths
this_script_dir=$(dirname "$0")
repo_basedir=$(git rev-parse --show-toplevel)
# shellcheck disable=1090,1091
source "$repo_basedir"/scripts/portable.sh
# Source bash logging tools
# shellcheck disable=1090,1091
source "$repo_basedir"/scripts/logger.bash
repo_config=$(cat "$repo_basedir"/.config.location)
#####################

log_info "Starting preperations..."
#####################
# Loads configurations variables
# See https://askubuntu.com/questions/743493/best-way-to-read-a-config-file-in-bash
set -o allexport
# shellcheck disable=1090,1091
source "${repo_config}"
set +o allexport
#
cd "$repo_basedir" || exit 1

pushd "$repo_basedir"/../osparc-simcore
cp services/docker-compose.yml "$repo_basedir"
cp .env-devel "$repo_basedir"
popd

cp "$repo_config" "$repo_basedir"

cd "$repo_basedir"

log_info "Creating stack.yml file..."
services/deployment-agent/startup_script.bash

log_info "Adding prefix $PREFIX_STACK_NAME to all services..."
./yq "with(.services; with_entries(.key |= \"${PREFIX_STACK_NAME}_\" + .))" stack.yml > "$this_script_dir"/stack_with_prefix.yml