CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
60 lines
1.9 KiB
Bash
Executable File
60 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# mozdIT Deploy Script — natív docker compose, Dokploy nélkül
|
|
# Használat: ./deploy.sh [staging|production]
|
|
# A szerveren fut (git pull + rebuild + indítás).
|
|
# Compose fájl és port env-enként különbözik.
|
|
|
|
set -euo pipefail
|
|
|
|
ENV="$1"
|
|
|
|
if [ "$ENV" != "staging" ] && [ "$ENV" != "production" ]; then
|
|
echo "Hiba: Hiányzó vagy érvénytelen környezet paraméter."
|
|
echo "Használat: ./deploy.sh staging VAGY ./deploy.sh production"
|
|
exit 1
|
|
fi
|
|
|
|
# WHY: staging és production külön compose fájlt és portot használ, hogy
|
|
# ugyanazon a szerveren ne ütközzenek (prod 8080, staging 8081).
|
|
COMPOSE_FILE="docker-compose.${ENV}.yml"
|
|
DEFAULT_PORT=8080
|
|
if [ "$ENV" = "staging" ]; then
|
|
DEFAULT_PORT=8081
|
|
fi
|
|
|
|
echo "🚀 Deploy indítása: [$ENV] környezet (${COMPOSE_FILE})"
|
|
|
|
# 1. Kód frissítése
|
|
echo "📦 Kód frissítése a main ágról..."
|
|
git pull origin main
|
|
|
|
# 2. Környezeti változók (.env.<env>)
|
|
ENV_FILE=".env.${ENV}"
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
echo "❌ Hiba: $ENV_FILE fájl nem található."
|
|
echo " Másold le a .env.staging.example / .env.production.example fájlt $ENV_FILE néven, és töltsd ki."
|
|
exit 1
|
|
fi
|
|
echo "🔑 Környezeti változók betöltése ($ENV_FILE)..."
|
|
|
|
# 3. Docker konténerek újraépítése és indítása
|
|
echo "🐳 Build és indítás..."
|
|
# A friss Dockerfile- vagy build-arg-változásoknak is új konténerben kell érvényesülniük.
|
|
docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE" up --build --force-recreate -d
|
|
|
|
# 4. Healthcheck
|
|
echo "⏳ Healthcheck (max 60s)..."
|
|
HEALTH_URL="http://localhost:${APP_PORT:-$DEFAULT_PORT}/api/health"
|
|
for i in $(seq 1 30); do
|
|
if curl -sf "$HEALTH_URL" > /dev/null 2>&1; then
|
|
echo "✅ Healthcheck OK: $HEALTH_URL"
|
|
echo "✅ Deploy sikeres: [$ENV]"
|
|
exit 0
|
|
fi
|
|
sleep 2
|
|
done
|
|
|
|
echo "❌ Healthcheck sikertelen: $HEALTH_URL"
|
|
docker compose -f "$COMPOSE_FILE" logs app --tail 50
|
|
exit 1
|