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

46 lines
1.3 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
sed -i 's/\r$//' ./ci/prod/.env.runtime
sed -i 's/\r$//' ./.env.version
lc_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:]]}"}"
value="${value%$'\r'}"
export "$key=$value"
done <"$file"
}
lc_load_env_file ./ci/prod/.env.runtime
lc_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}"