Update cicd no migrate prod

This commit is contained in:
M1 AIR
2026-01-22 15:57:16 +07:00
parent 1ca6c6a104
commit c085888ca9
+31 -33
View File
@@ -1,6 +1,6 @@
stages: stages:
- build - build
- migrate # - migrate
- deploy - deploy
- seed - seed
@@ -51,39 +51,39 @@ build_production:
# ========================= # =========================
# MIGRATE (PRODUCTION - MANUAL) # MIGRATE (PRODUCTION - MANUAL)
# ========================= # =========================
migrate_production: #migrate_production:
stage: migrate # stage: migrate
rules: # rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"' # - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"'
when: manual # when: manual
allow_failure: false # allow_failure: false
needs: # needs:
- job: build_production # - job: build_production
artifacts: false # artifacts: false
script: | # script: |
set -e # set -e
cd /opt/deploy/lti # cd /opt/deploy/lti
test -f .env || (echo "❌ .env not found" && exit 1) # test -f .env || (echo "❌ .env not found" && exit 1)
set -a # set -a
. ./.env # . ./.env
set +a # set +a
# Validasi env wajib # Validasi env wajib
: "${DB_HOST:?DB_HOST not set}" # : "${DB_HOST:?DB_HOST not set}"
: "${DB_PORT:?DB_PORT not set}" # : "${DB_PORT:?DB_PORT not set}"
: "${DB_USER:?DB_USER not set}" # : "${DB_USER:?DB_USER not set}"
: "${DB_PASSWORD:?DB_PASSWORD not set}" # : "${DB_PASSWORD:?DB_PASSWORD not set}"
: "${DB_NAME:?DB_NAME not set}" # : "${DB_NAME:?DB_NAME not set}"
DB_SSLMODE="${DB_SSLMODE:-require}" # DB_SSLMODE="${DB_SSLMODE:-require}"
export DATABASE_URL="postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=${DB_SSLMODE}" # export DATABASE_URL="postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=${DB_SSLMODE}"
echo "✅ Running migrations (production)..." # echo "✅ Running migrations (production)..."
docker run --rm \ # docker run --rm \
-v "$CI_PROJECT_DIR/internal/database/migrations:/migrations:ro" \ # -v "$CI_PROJECT_DIR/internal/database/migrations:/migrations:ro" \
migrate/migrate:v4.15.2 \ # migrate/migrate:v4.15.2 \
-path=/migrations -database "$DATABASE_URL" up # -path=/migrations -database "$DATABASE_URL" up
# ========================= # =========================
@@ -94,8 +94,8 @@ deploy_production:
rules: rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"' - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"'
needs: needs:
- job: migrate_production # - job: migrate_production
artifacts: false # artifacts: false
- job: build_production - job: build_production
artifacts: false artifacts: false
script: | script: |
@@ -129,5 +129,3 @@ seed_production:
docker compose --env-file .env pull seed docker compose --env-file .env pull seed
docker compose --env-file .env run --rm seed docker compose --env-file .env run --rm seed