Files
sendico/ci/pipelines/fx/deploy.sh
Stephan D 590fad0071
Some checks failed
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/fx/1 Pipeline failed
ci/woodpecker/push/fx/2 Pipeline failed
ci/woodpecker/push/nats Pipeline was successful
fx build fix
2025-11-07 23:55:41 +01:00

52 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
set -eu
if ! set -o pipefail 2>/dev/null; then
:
fi
sh ci/pipelines/fx/ensure_env_version.sh
normalize_env_file() {
file="$1"
tmp="${file}.tmp.$$"
tr -d '\r' <"$file" >"$tmp"
mv "$tmp" "$file"
}
load_env_file() {
file="$1"
while IFS= read -r line || [ -n "$line" ]; do
case "$line" in
''|\#*) continue ;;
esac
key="${line%%=*}"
value="${line#*=}"
key="$(printf '%s' "$key" | tr -d '[:space:]')"
value="${value#"${value%%[![:space:]]*}"}"
value="${value%"${value##*[![:space:]]}"}"
export "$key=$value"
done <"$file"
}
normalize_env_file ./ci/prod/.env.runtime
normalize_env_file ./.env.version
load_env_file ./ci/prod/.env.runtime
load_env_file ./.env.version
FX_MONGO_SECRET_PATH="${FX_MONGO_SECRET_PATH:?missing FX_MONGO_SECRET_PATH}"
FX_DEPLOY_TARGET="${FX_DEPLOY_TARGET:?missing FX_DEPLOY_TARGET}"
FX_NEEDS_NATS="${FX_NEEDS_NATS:-false}"
export FX_MONGO_USER="$(./ci/vlt kv_get kv "${FX_MONGO_SECRET_PATH}" user)"
export FX_MONGO_PASSWORD="$(./ci/vlt kv_get kv "${FX_MONGO_SECRET_PATH}" password)"
if [ "${FX_NEEDS_NATS}" = "true" ]; then
export NATS_USER="$(./ci/vlt kv_get kv sendico/nats user)"
export NATS_PASSWORD="$(./ci/vlt kv_get kv sendico/nats password)"
export FX_NATS_URL="nats://${NATS_USER}:${NATS_PASSWORD}@${NATS_HOST}:${NATS_PORT}"
fi
bash ci/prod/scripts/bootstrap/network.sh
bash ci/prod/scripts/deploy/fx.sh "${FX_DEPLOY_TARGET}"