Use catalog as source of truth for app deployment
This commit is contained in:
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
BASE_DIR="/opt/appfactory"
|
||||
CATALOG_FILE="$BASE_DIR/apps/catalog.yml"
|
||||
COMPOSE_FILE="$BASE_DIR/deploy/apps-compose.yml"
|
||||
|
||||
cat > "$COMPOSE_FILE" <<'EOF_COMPOSE'
|
||||
services:
|
||||
EOF_COMPOSE
|
||||
|
||||
awk '
|
||||
/- id:/ { app=$3 }
|
||||
/language:/ { lang=$2 }
|
||||
/status:/ {
|
||||
if (app != "") {
|
||||
print " " app ":"
|
||||
print " image: " app ":latest"
|
||||
print " container_name: " app
|
||||
print " restart: unless-stopped"
|
||||
print " environment:"
|
||||
print " - APP_NAME=" app
|
||||
print " - ROOT_PATH=/apps/" app
|
||||
print " networks:"
|
||||
print " - appfactory"
|
||||
print ""
|
||||
}
|
||||
}
|
||||
' "$CATALOG_FILE" >> "$COMPOSE_FILE"
|
||||
Reference in New Issue
Block a user