Recreate broken Maia deploy venv
All checks were successful
Deploy Blog Backend / test (push) Successful in 1m21s
Deploy Blog Backend / deploy (push) Successful in 2m39s

This commit is contained in:
박원엽
2026-06-19 15:33:49 +09:00
parent 98d6734e66
commit fe9b37eccb
2 changed files with 25 additions and 12 deletions

View File

@@ -182,17 +182,21 @@ jobs:
if [ -n "$maia_backup_path" ] && [ -d "$maia_backup_path" ]; then if [ -n "$maia_backup_path" ] && [ -d "$maia_backup_path" ]; then
rm -rf "$MAIA_DIR" rm -rf "$MAIA_DIR"
mv "$maia_backup_path" "$MAIA_DIR" mv "$maia_backup_path" "$MAIA_DIR"
if systemctl cat "$MAIA_SERVICE_NAME" >/dev/null 2>&1; then
systemctl restart "$MAIA_SERVICE_NAME" || true systemctl restart "$MAIA_SERVICE_NAME" || true
fi fi
fi
} }
if [ ! -d "$MAIA_VENV_DIR" ]; then
if ! ensure_python_venv; then if ! ensure_python_venv; then
rollback_maia rollback_maia
echo "failed to prepare Python venv support on the deploy server." echo "failed to prepare Python venv support on the deploy server."
exit 1 exit 1
fi fi
if [ ! -x "$MAIA_VENV_DIR/bin/python" ] || ! "$MAIA_VENV_DIR/bin/python" -m pip --version >/dev/null 2>&1; then
echo "Creating Maia Python venv..."
rm -rf "$MAIA_VENV_DIR"
if ! "$python_bin" -m venv "$MAIA_VENV_DIR"; then if ! "$python_bin" -m venv "$MAIA_VENV_DIR"; then
rollback_maia rollback_maia
echo "failed to create Python venv. Install python3-venv on the deploy server." echo "failed to create Python venv. Install python3-venv on the deploy server."
@@ -200,6 +204,14 @@ jobs:
fi fi
fi fi
if ! "$MAIA_VENV_DIR/bin/python" -m pip --version >/dev/null 2>&1; then
if ! "$MAIA_VENV_DIR/bin/python" -m ensurepip --upgrade; then
rollback_maia
echo "failed to bootstrap pip in the Maia Python venv."
exit 1
fi
fi
if ! "$MAIA_VENV_DIR/bin/python" -m pip install --upgrade pip; then if ! "$MAIA_VENV_DIR/bin/python" -m pip install --upgrade pip; then
rollback_maia rollback_maia
exit 1 exit 1

View File

@@ -25,11 +25,12 @@
6. jar, Maia 엔진 tar, `deploy/systemd/maia-engine.service`를 SSH/SCP로 서버에 업로드 6. jar, Maia 엔진 tar, `deploy/systemd/maia-engine.service`를 SSH/SCP로 서버에 업로드
7. 서버에서 Maia 엔진 코드를 `/root/blog-backend/maia-engine`으로 교체 7. 서버에서 Maia 엔진 코드를 `/root/blog-backend/maia-engine`으로 교체
8. `/root/blog-backend/maia-engine-venv`를 생성하거나 재사용 8. `/root/blog-backend/maia-engine-venv`를 생성하거나 재사용
9. `requirements.txt` 해시가 바뀌었으면 Python 의존성 재설치 9. venv가 깨져 있거나 pip가 없으면 삭제 후 재생성
10. `maia-engine.service` 설치, `systemctl daemon-reload`, enable, restart 10. `requirements.txt` 해시가 바뀌었으면 Python 의존성 재설치
11. `http://127.0.0.1:8000/health` 헬스체크 11. `maia-engine.service` 설치, `systemctl daemon-reload`, enable, restart
12. Spring Boot jar를 `/root/blog-backend/blog-backend.jar`로 교체 12. `http://127.0.0.1:8000/health` 헬스체크
13. `blog-api.service` 재시작 후 active 상태 확인 13. Spring Boot jar를 `/root/blog-backend/blog-backend.jar`로 교체
14. `blog-api.service` 재시작 후 active 상태 확인
Maia 엔진 배포 실패 시 이전 Maia 코드 디렉터리로 롤백을 시도한다. 백엔드 jar 재시작 실패 시 직전 jar 백업으로 롤백을 시도한다. Maia 엔진 배포 실패 시 이전 Maia 코드 디렉터리로 롤백을 시도한다. 백엔드 jar 재시작 실패 시 직전 jar 백업으로 롤백을 시도한다.