sozsoft-platform/configs/deployment/scripts/deploy/app.sh
2026-10-17 21:51:10 +03:00

32 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export ENV=${1:-dev}
echo "Env değeri: ${ENV}"
cd ~/sozsoft-platform
git checkout main
# --tags --force: sürüm notları git tag'lerinden üretiliyor; yerel tag origin'den
# farklı commit'e bakıyorsa --force olmadan reddedilir ve yeni tag'ler gelmez.
git fetch --prune --prune-tags --tags --force && git pull
# Sürüm notları imaja gömülü değil; konteynere configs/change-logs klasöründen
# mount ediliyor ve API açılışta veritabanına senkronize ediyor (DbMigrator
# gerekmez). `bash ...` ile çağrılır: depo Windows'tan yönetildiği için
# çalıştırma biti kaybolunca "Permission denied" verip notları sessizce düşürüyordu.
RELEASE_NOTES=~/sozsoft-platform/configs/change-logs/change-logs.json
bash ~/sozsoft-platform/configs/change-logs/generate-change-logs.sh
# Dosya yoksa API açılışta "change-logs.json bulunamadı" uyarısı verir ve
# changelog eskir; sessizce devam etmek yerine burada dur.
if [ ! -s "$RELEASE_NOTES" ]; then
echo "HATA: ${RELEASE_NOTES} üretilemedi, deploy durduruldu." >&2
exit 1
fi
cd ~/sozsoft-platform/configs/deployment
COMPOSE="docker compose -f docker-compose-app.yml -f docker-compose-app.${ENV}.yml"
# Konteynerler önceden durdurulup silinmez: imajlar önce indirilir, `up -d` değişen
# servisi yerinde yeniden oluşturur. Böylece kesinti pull süresi kadar değil, konteyner
# değişimi kadardır; UI'nin eski sürüm chunk'ları da `ui-assets` volume'unda kalır.
$COMPOSE --profile api --profile ui pull
$COMPOSE --profile api up -d --remove-orphans
$COMPOSE --profile ui up -d --remove-orphans