DONE: update .env and docker compose port forwarding
Build Docker Image / build-backend (push) Successful in 36s
Build Docker Image / build-frontend (push) Successful in 34s

This commit is contained in:
ISMAIL MASSERAN
2026-06-30 12:49:32 +08:00
parent dcc150319a
commit 1706fb639e
6 changed files with 47 additions and 31 deletions
+25 -14
View File
@@ -87,11 +87,11 @@ jobs:
- name: Verify deployment - name: Verify deployment
run: | run: |
set -e set -e
echo "Waiting for services to start..."
sleep 15
cd "${DEPLOY_DIR}" cd "${DEPLOY_DIR}"
echo "Waiting for services to start..."
sleep 10
for SERVICE in backend frontend; do for SERVICE in backend frontend; do
STATUS=$(docker compose -f docker-compose.yml ps --status running --format '{{.Name}}' "$SERVICE" 2>/dev/null || true) STATUS=$(docker compose -f docker-compose.yml ps --status running --format '{{.Name}}' "$SERVICE" 2>/dev/null || true)
if [ -z "$STATUS" ]; then if [ -z "$STATUS" ]; then
@@ -110,15 +110,26 @@ jobs:
echo "WARNING: Backend .env file not found" echo "WARNING: Backend .env file not found"
fi fi
if docker exec "$BE_CONTAINER" curl -sf http://localhost/health > /dev/null; then API_PORT=$(grep -E '^API_PORT=' .env 2>/dev/null | cut -d= -f2- | tr -d '"' || true)
echo "✓ Backend health check passed" FE_PORT=$(grep -E '^FE_PORT=' .env 2>/dev/null | cut -d= -f2- | tr -d '"' || true)
else API_PORT=${API_PORT:-8080}
echo "WARNING: Backend health check failed" FE_PORT=${FE_PORT:-8081}
fi
FE_CONTAINER=$(docker compose -f docker-compose.yml ps -q frontend) check_health() {
if docker exec "$FE_CONTAINER" wget -q --spider http://localhost/; then NAME=$1
echo "✓ Frontend health check passed" URL=$2
else for i in 1 2 3 4 5 6; do
echo "WARNING: Frontend health check failed" if curl -sf "$URL" > /dev/null; then
fi echo "✓ ${NAME} health check passed (${URL})"
return 0
fi
echo "Waiting for ${NAME}... attempt ${i}/6"
sleep 5
done
echo "ERROR: ${NAME} health check failed (${URL})"
docker compose -f docker-compose.yml logs --tail=50 "${NAME}" || true
return 1
}
check_health "backend" "http://127.0.0.1:${API_PORT}/health"
check_health "frontend" "http://127.0.0.1:${FE_PORT}/health"
+7 -6
View File
@@ -3,7 +3,7 @@ APP_ENV=production
APP_KEY=base64:XdMAy5IbQMHsTrp1N7Tn/LIJC4SKenN8CfhYLt1s3tk= APP_KEY=base64:XdMAy5IbQMHsTrp1N7Tn/LIJC4SKenN8CfhYLt1s3tk=
APP_DEBUG=false APP_DEBUG=false
APP_TIMEZONE=Asia/Kuala_Lumpur APP_TIMEZONE=Asia/Kuala_Lumpur
APP_URL=https://anggota.koppkb.com APP_URL=https://api.koppkb.com
APP_LOCALE=en APP_LOCALE=en
APP_FALLBACK_LOCALE=en APP_FALLBACK_LOCALE=en
@@ -21,12 +21,13 @@ LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=error LOG_LEVEL=error
DB_CONNECTION=pgsql DB_CONNECTION=db
DB_HOST=172.16.5.12 DB_HOST=db
DB_PORT=5433 DB_PORT=5432
DB_DATABASE=mykopkb DB_DATABASE=mykopkb
DB_USERNAME=mykopkbuser DB_USERNAME=mykopkbuser
DB_PASSWORD=MyKOPKB@Production_2026 DB_PASSWORD=MyKOPKB@Production_2026
DB_ROOT_PASSWORD=MIq8ogpdKRppb5HThjY5Caeow5OFo8BCyJ
SESSION_DRIVER=redis SESSION_DRIVER=redis
SESSION_LIFETIME=60 SESSION_LIFETIME=60
@@ -60,7 +61,7 @@ MAIL_HOST=mailpit
MAIL_PORT=1025 MAIL_PORT=1025
MAIL_USERNAME=null MAIL_USERNAME=null
MAIL_PASSWORD=null MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_ADDRESS="noreply@koppkb.com"
MAIL_FROM_NAME="${APP_NAME}" MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID= AWS_ACCESS_KEY_ID=
@@ -91,7 +92,7 @@ EXTERNAL_API_BASE_URL=
# SSO_ENABLE_FALLBACK=true # SSO_ENABLE_FALLBACK=true
# SSO_PROXY_ENABLED=true # SSO_PROXY_ENABLED=true
SANCTUM_STATEFUL_DOMAINS=anggota.koppkb.com SANCTUM_STATEFUL_DOMAINS=api.koppkb.com
BLOCK_API_TOOLS_IN_PRODUCTION=true BLOCK_API_TOOLS_IN_PRODUCTION=true
MIN_USER_AGENT_LENGTH=15 MIN_USER_AGENT_LENGTH=15
@@ -44,7 +44,7 @@ services:
networks: networks:
- mykopkb-production-network - mykopkb-production-network
healthcheck: healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost/"] test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1/health"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
@@ -60,7 +60,7 @@ services:
container_name: mykopkb-postgres-production container_name: mykopkb-postgres-production
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${DB_PORT:-5432}:5432" - "${DB_PORT:-5433}:5432"
environment: environment:
- POSTGRES_ROOT_PASSWORD=${DB_ROOT_PASSWORD} - POSTGRES_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- POSTGRES_DATABASE=${DB_DATABASE} - POSTGRES_DATABASE=${DB_DATABASE}
+6 -8
View File
@@ -28,6 +28,12 @@ http {
try_files $uri $uri/ /index.php?$query_string; try_files $uri $uri/ /index.php?$query_string;
} }
location = /health {
access_log off;
default_type text/plain;
return 200 'ok';
}
location ~ \.php$ { location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000; fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php; fastcgi_index index.php;
@@ -43,14 +49,6 @@ http {
deny all; deny all;
} }
location = /health {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
fastcgi_param HTTP_PROXY "";
}
location ^~ /horizon { location ^~ /horizon {
add_header Content-Security-Policy "default-src 'self' http: https: data: blob 'unsafe-inline' 'unsafe-eval'" always; add_header Content-Security-Policy "default-src 'self' http: https: data: blob 'unsafe-inline' 'unsafe-eval'" always;
fastcgi_pass 127.0.0.1:9000; fastcgi_pass 127.0.0.1:9000;
+1 -1
View File
@@ -1,3 +1,3 @@
port 6379 port 6379
bind 0.0.0.0 bind 0.0.0.0
requirepass sutera_redis@2025 requirepass mykopkb_redis@2025
+6
View File
@@ -7,6 +7,12 @@ server {
gzip on; gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml; gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
location = /health {
access_log off;
default_type text/plain;
return 200 'ok';
}
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }