Fix app deploy failure handling and compose environment
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG_FILE="/opt/appfactory/config/appfactory.env"
|
||||
|
||||
set -a
|
||||
source "$CONFIG_FILE"
|
||||
set +a
|
||||
|
||||
APP_ID="${1:-}"
|
||||
|
||||
@@ -171,6 +174,8 @@ run_step() {
|
||||
set +e
|
||||
|
||||
run_step "Updating source code" bash -c "
|
||||
set -e
|
||||
|
||||
cd '$APP_SOURCE_DIR'
|
||||
|
||||
if [ -d '.git' ]; then
|
||||
@@ -183,6 +188,8 @@ RESULT=$?
|
||||
|
||||
if [ "$RESULT" -eq 0 ]; then
|
||||
run_step "Generating app environment file" bash -c "
|
||||
set -e
|
||||
|
||||
mkdir -p '$APP_DATA_DIR'
|
||||
|
||||
python3 - '$DB_FILE' '$APP_ID' '$APP_ENV_FILE' <<'PY'
|
||||
@@ -259,6 +266,8 @@ fi
|
||||
|
||||
if [ "$RESULT" -eq 0 ]; then
|
||||
run_step "Regenerating generated files" bash -c "
|
||||
set -e
|
||||
|
||||
'$TOOLS_DIR/scripts/generate-catalog.sh'
|
||||
'$TOOLS_DIR/scripts/generate-apps-compose.sh'
|
||||
'$TOOLS_DIR/scripts/generate-caddyfile.sh'
|
||||
@@ -270,9 +279,12 @@ fi
|
||||
|
||||
if [ "$RESULT" -eq 0 ]; then
|
||||
run_step "Starting app container" bash -c "
|
||||
set -e
|
||||
|
||||
cd '$APPFACTORY_DIR/deploy'
|
||||
|
||||
docker compose \
|
||||
--env-file '$CONFIG_FILE' \
|
||||
-f docker-compose.yml \
|
||||
-f apps-compose.yml \
|
||||
up -d --force-recreate '$APP_ID'
|
||||
|
||||
Reference in New Issue
Block a user