mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Merge branch 'development' into 'staging'
Development See merge request mbugroup/lti-api!238
This commit is contained in:
+31
-33
@@ -1,6 +1,6 @@
|
||||
stages:
|
||||
- build
|
||||
- migrate
|
||||
# - migrate
|
||||
- deploy
|
||||
- seed
|
||||
|
||||
@@ -51,39 +51,39 @@ build_production:
|
||||
# =========================
|
||||
# MIGRATE (PRODUCTION - MANUAL)
|
||||
# =========================
|
||||
migrate_production:
|
||||
stage: migrate
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"'
|
||||
when: manual
|
||||
allow_failure: false
|
||||
needs:
|
||||
- job: build_production
|
||||
artifacts: false
|
||||
script: |
|
||||
set -e
|
||||
cd /opt/deploy/lti
|
||||
test -f .env || (echo "❌ .env not found" && exit 1)
|
||||
#migrate_production:
|
||||
# stage: migrate
|
||||
# rules:
|
||||
# - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"'
|
||||
# when: manual
|
||||
# allow_failure: false
|
||||
# needs:
|
||||
# - job: build_production
|
||||
# artifacts: false
|
||||
# script: |
|
||||
# set -e
|
||||
# cd /opt/deploy/lti
|
||||
# test -f .env || (echo "❌ .env not found" && exit 1)
|
||||
|
||||
set -a
|
||||
. ./.env
|
||||
set +a
|
||||
# set -a
|
||||
# . ./.env
|
||||
# set +a
|
||||
|
||||
# Validasi env wajib
|
||||
: "${DB_HOST:?DB_HOST not set}"
|
||||
: "${DB_PORT:?DB_PORT not set}"
|
||||
: "${DB_USER:?DB_USER not set}"
|
||||
: "${DB_PASSWORD:?DB_PASSWORD not set}"
|
||||
: "${DB_NAME:?DB_NAME not set}"
|
||||
# : "${DB_HOST:?DB_HOST not set}"
|
||||
# : "${DB_PORT:?DB_PORT not set}"
|
||||
# : "${DB_USER:?DB_USER not set}"
|
||||
# : "${DB_PASSWORD:?DB_PASSWORD not set}"
|
||||
# : "${DB_NAME:?DB_NAME not set}"
|
||||
|
||||
DB_SSLMODE="${DB_SSLMODE:-require}"
|
||||
export DATABASE_URL="postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=${DB_SSLMODE}"
|
||||
# DB_SSLMODE="${DB_SSLMODE:-require}"
|
||||
# export DATABASE_URL="postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=${DB_SSLMODE}"
|
||||
|
||||
echo "✅ Running migrations (production)..."
|
||||
docker run --rm \
|
||||
-v "$CI_PROJECT_DIR/internal/database/migrations:/migrations:ro" \
|
||||
migrate/migrate:v4.15.2 \
|
||||
-path=/migrations -database "$DATABASE_URL" up
|
||||
# echo "✅ Running migrations (production)..."
|
||||
# docker run --rm \
|
||||
# -v "$CI_PROJECT_DIR/internal/database/migrations:/migrations:ro" \
|
||||
# migrate/migrate:v4.15.2 \
|
||||
# -path=/migrations -database "$DATABASE_URL" up
|
||||
|
||||
|
||||
# =========================
|
||||
@@ -94,8 +94,8 @@ deploy_production:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"'
|
||||
needs:
|
||||
- job: migrate_production
|
||||
artifacts: false
|
||||
# - job: migrate_production
|
||||
# artifacts: false
|
||||
- job: build_production
|
||||
artifacts: false
|
||||
script: |
|
||||
@@ -129,5 +129,3 @@ seed_production:
|
||||
|
||||
docker compose --env-file .env pull seed
|
||||
docker compose --env-file .env run --rm seed
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user