diff --git a/pharmq-setup-v2.sh b/pharmq-setup-v2.sh index 73b8ae1..b758946 100644 --- a/pharmq-setup-v2.sh +++ b/pharmq-setup-v2.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash # -# PharmQ PVE 원클릭 통합 설치 스크립트 -# 사용법: curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/pharmq-setup.sh | bash +# PharmQ PVE 원클릭 통합 설치 스크립트 v2 +# 사용법: curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/pharmq-setup-v2.sh | bash +# +# v1 대비 변경: noVNC CT 설치 제거 (gateway WebSocket 프록시로 대체) # # Phase 1: PVE Repository Fix (구독 제한 해제) # Phase 2: PVE Host Tailscale → Headscale 등록 @@ -10,7 +12,8 @@ # Phase 5: Ubuntu CT 생성 # Phase 6: CT 내부 환경 구축 # Phase 7: 약국 + 장비 + 계정 등록 -# Phase 8: 검증 + 결과 출력 +# Phase 8: RDP 자동 연결 설정 +# Phase 9: 검증 + 결과 출력 # set -eo pipefail @@ -127,7 +130,7 @@ print_info() { echo -e "${CYAN} $1${NC}"; } # Phase 1: PVE Repository Fix # ============================================================ phase1_repo_fix() { - print_phase "Phase 1/10: PVE Repository Fix" + print_phase "Phase 1/9: PVE Repository Fix" # Proxmox 환경 확인 if [ ! -f /etc/pve/storage.cfg ]; then @@ -207,7 +210,7 @@ EOF # Phase 2: PVE Host Tailscale → Headscale 등록 # ============================================================ phase2_tailscale_pve() { - print_phase "Phase 2/10: PVE Host Tailscale 등록" + print_phase "Phase 2/9: PVE Host Tailscale 등록" # Headscale 서버 주소 자동 감지 (LAN vs 외부) # ping만으로는 부정확 (외부 약국에 192.168.0.100 장비가 있을 수 있음) @@ -283,7 +286,7 @@ phase2_tailscale_pve() { # Phase 3: 약국 정보 수집 # ============================================================ phase3_collect_info() { - print_phase "Phase 3/10: 약국 정보 수집" + print_phase "Phase 3/9: 약국 정보 수집" # 명령행 인자가 있으면 사용 if [ -n "$ARGS_NAME" ]; then @@ -375,7 +378,7 @@ phase3_collect_info() { # Phase 4: PBS 등록 + Windows VM 복원 # ============================================================ phase4_pbs_restore() { - print_phase "Phase 4/10: PBS 등록 + Windows VM 복원" + print_phase "Phase 4/9: PBS 등록 + Windows VM 복원" # 이미 VM이 존재하면 스킵 local TARGET_CHECK="${ARGS_VM_VMID:-201}" @@ -628,7 +631,7 @@ PYEOF # Phase 5: Ubuntu CT 생성 # ============================================================ phase5_create_ct() { - print_phase "Phase 5/10: Ubuntu CT 생성" + print_phase "Phase 5/9: Ubuntu CT 생성" # 이미 ubuntu-api CT가 존재하면 스킵 for vmid in $(seq 200 299); do @@ -726,7 +729,7 @@ phase5_create_ct() { # Phase 6: CT 내부 환경 구축 # ============================================================ phase6_setup_ct() { - print_phase "Phase 6/10: CT 내부 환경 구축" + print_phase "Phase 6/9: CT 내부 환경 구축" # 헬퍼: CT 내부에서 명령 실행 ct_exec() { @@ -821,7 +824,7 @@ SVCEOF" # Phase 7: 약국 + 장비 + 계정 등록 # ============================================================ phase7_register() { - print_phase "Phase 7/10: 약국 + 장비 + 계정 등록" + print_phase "Phase 7/9: 약국 + 장비 + 계정 등록" # 이미 약국 코드가 있으면 (Phase 3에서 기존 약국 로드됨) 등록 스킵 if [ -n "${PHARMACY_CODE:-}" ]; then @@ -943,7 +946,7 @@ JSONEOF # Phase 8: RDP 자동 연결 설정 # ============================================================ phase8_rdp_setup() { - print_phase "Phase 8/10: RDP 자동 연결 설정" + print_phase "Phase 8/9: RDP 자동 연결 설정" # 이미 설치되어있으면 스킵 if systemctl is-active --quiet rdp-toggle-api.service 2>/dev/null && \ @@ -1071,38 +1074,11 @@ EOF # ============================================================ # Phase 9: noVNC 웹 서비스 설치 # ============================================================ -phase9_novnc_setup() { - print_phase "Phase 9/10: noVNC 웹 서비스 설치 (CT 내부)" - - if [ -z "${CT_VMID:-}" ]; then - print_warn "CT VMID가 없어서 noVNC 설치를 건너뜁니다." - return 1 - fi - - # CT 내부에서 이미 설치되어있는지 확인 - if pct exec "$CT_VMID" -- test -d /srv/pharmq-novnc 2>/dev/null && \ - pct exec "$CT_VMID" -- systemctl is-active --quiet pharmq-vnc-app.service 2>/dev/null; then - print_ok "noVNC 이미 설치됨 (CT $CT_VMID) — 스킵" - return 0 - fi - - # PVE host IP 감지 (CT에서 PVE API에 접근할 LAN IP) - local PVE_LAN_IP - PVE_LAN_IP=$(hostname -I | awk '{print $1}') - - # CT 안에서 noVNC 설치 스크립트 실행 (PVE 접속 정보 + 약국 정보 자동 전달) - print_step "CT $CT_VMID 내부에 noVNC 설치 중..." - print_info "PVE API: ${PVE_LAN_IP}:8006, 약국: ${PHARMACY_CODE:-미정} (${PHARMACY_NAME:-미정})" - pct exec "$CT_VMID" -- bash -c "curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/VNC/pharmq-novnc-setup.sh -o /tmp/pharmq-novnc-setup.sh && chmod +x /tmp/pharmq-novnc-setup.sh && bash /tmp/pharmq-novnc-setup.sh --pve-host ${PVE_LAN_IP} --pve-password trajet6640 --pharmacy-code ${PHARMACY_CODE:-P0000} --pharmacy-name '${PHARMACY_NAME:-미정}'; rm -f /tmp/pharmq-novnc-setup.sh" || true - - print_ok "Phase 9 완료: noVNC 설치 (CT $CT_VMID)" -} - # ============================================================ -# Phase 10: 검증 + 결과 출력 +# Phase 9: 검증 + 결과 출력 # ============================================================ -phase10_verify() { - print_phase "Phase 10/10: 검증 + 결과 출력" +phase9_verify() { + print_phase "Phase 9/9: 검증 + 결과 출력" # API 헬스체크 print_step "API 서버 헬스체크 중..." @@ -1227,7 +1203,7 @@ main() { echo -e "${PURPLE}╔════════════════════════════════════════════╗${NC}" echo -e "${PURPLE}║ ║${NC}" echo -e "${PURPLE}║${NC} ${WHITE}PharmQ PVE 원클릭 통합 설치${NC} ${PURPLE}║${NC}" - echo -e "${PURPLE}║${NC} ${CYAN}Repo→VPN→PBS→CT→등록→RDP→VNC${NC} ${PURPLE}║${NC}" + echo -e "${PURPLE}║${NC} ${CYAN}Repo→VPN→PBS→CT→등록→RDP→검증${NC} ${PURPLE}║${NC}" echo -e "${PURPLE}║ ║${NC}" echo -e "${PURPLE}╚════════════════════════════════════════════╝${NC}" echo "" @@ -1240,8 +1216,7 @@ main() { phase6_setup_ct phase7_register || print_warn "Phase 7 실패 — 수동 등록 필요" phase8_rdp_setup || print_warn "Phase 8 실패 — RDP 수동 설정 필요" - phase9_novnc_setup || print_warn "Phase 9 실패 — noVNC 수동 설치 필요" - phase10_verify + phase9_verify } main "$@"