34 lines
1.2 KiB
Bash
34 lines
1.2 KiB
Bash
set -euo pipefail
|
|
release=/home/ps/knowledge-v3-field-fix-20260916
|
|
cd /opt/im-admin/deploy/im-admin
|
|
test "$(docker image inspect zyt/wecom-admin:current --format '{{.Id}}')" = "$(cat "$release/image-before.txt")"
|
|
rollback_on_error() {
|
|
rc=$?
|
|
trap - ERR
|
|
docker compose logs --no-color --tail=150 > "$release/failed-startup.log" 2>&1 || true
|
|
echo 'Deployment did not pass health checks; restoring previous services.'
|
|
bash "$release/rollback.sh"
|
|
exit "$rc"
|
|
}
|
|
trap rollback_on_error ERR
|
|
python3 - <<'PY'
|
|
from pathlib import Path
|
|
import shutil
|
|
source=Path('/home/ps/knowledge-v3-field-fix-20260916/payload')
|
|
target=Path('/opt/im-admin')
|
|
for path in source.rglob('*'):
|
|
if path.is_file():
|
|
destination=target/path.relative_to(source)
|
|
destination.parent.mkdir(parents=True,exist_ok=True)
|
|
shutil.copyfile(path,destination)
|
|
print('Third-version source and frontend installed.',flush=True)
|
|
PY
|
|
docker compose config --quiet
|
|
docker tag zyt/wecom-admin:knowledge-v3-field-fix-20260916 zyt/wecom-admin:current
|
|
docker compose up -d --no-build --wait --wait-timeout 180 api gateway knowledge-worker
|
|
curl -fsS http://127.0.0.1:18766/api/v2/health
|
|
curl -fsS http://127.0.0.1:18770/health
|
|
docker compose ps
|
|
trap - ERR
|
|
echo 'Third-version services healthy.'
|