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