webhook
This commit is contained in:
31
deploy.sh
Normal file
31
deploy.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Kehadiran Taklimat SPR — Production Deploy Script
|
||||
# Dipanggil oleh container webhook selepas git push ke GitHub (branch master).
|
||||
set -e
|
||||
|
||||
PROJECT_DIR="/srv/spr2026_taklimat"
|
||||
LOG="$PROJECT_DIR/deploy.log"
|
||||
|
||||
log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG"; }
|
||||
|
||||
log "=== Deploy dimulakan ==="
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
# git jalan sebagai root dlm container; repo milik user host -> elak "dubious ownership".
|
||||
git config --global --add safe.directory "$PROJECT_DIR"
|
||||
|
||||
log "git pull..."
|
||||
git pull origin master
|
||||
|
||||
# Kod di-bake dalam image (bukan bind-mount) -> perlu build semula.
|
||||
# Hanya service aplikasi yg di-recreate; container 'webhook' SENGAJA tidak
|
||||
# disenaraikan supaya ia tidak bunuh dirinya sendiri di tengah deploy.
|
||||
# Entrypoint app jalankan migrate + config/route/view:cache automatik masa boot.
|
||||
log "build & recreate (app, web, queue, scheduler)..."
|
||||
docker compose up -d --build --force-recreate app web queue scheduler
|
||||
|
||||
log "buang image lama yg tidak digunakan..."
|
||||
docker image prune -f
|
||||
|
||||
log "=== Deploy selesai ==="
|
||||
Reference in New Issue
Block a user