create-entity-server 0.9.29 → 0.9.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/scripts/run.sh +24 -1
package/package.json
CHANGED
package/template/scripts/run.sh
CHANGED
|
@@ -35,6 +35,24 @@ has_command() {
|
|
|
35
35
|
command -v "$1" >/dev/null 2>&1
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
# 주(primary) 서버(222.236.46.243)에서 재시작할 때 백업 서버(222.236.46.245)의 동일 서비스도 재시작한다.
|
|
39
|
+
# - 이 호스트가 222.236.46.243 IP 를 가질 때만 동작한다(245 에서는 no-op → 무한 루프 없음).
|
|
40
|
+
# - 245 접속 실패/타임아웃이어도 경고만 남기고 로컬 재시작 결과에는 영향을 주지 않는다.
|
|
41
|
+
# - lsyncd 와 동일한 root SSH 키/포트를 사용하므로 비-root 사용자면 sudo 로 감싼다.
|
|
42
|
+
propagate_restart_to_standby() {
|
|
43
|
+
local remote_svc="$1"
|
|
44
|
+
[ -n "$remote_svc" ] || return 0
|
|
45
|
+
hostname -I 2>/dev/null | tr ' ' '\n' | grep -qx "222.236.46.243" || return 0
|
|
46
|
+
local ssh_cmd="ssh -p 38371 -i /root/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=10"
|
|
47
|
+
[ "$(id -u)" -ne 0 ] && ssh_cmd="sudo $ssh_cmd"
|
|
48
|
+
echo "→ 백업 서버(222.236.46.245) ${remote_svc} 재시작 전파…"
|
|
49
|
+
if $ssh_cmd root@222.236.46.245 "systemctl restart ${remote_svc}" 2>/dev/null; then
|
|
50
|
+
echo " ✓ 백업 서버 ${remote_svc} 재시작 완료"
|
|
51
|
+
else
|
|
52
|
+
echo " ⚠ 백업 서버 ${remote_svc} 재시작 실패(접속 불가/타임아웃) — 로컬 재시작은 정상 완료됨"
|
|
53
|
+
fi
|
|
54
|
+
}
|
|
55
|
+
|
|
38
56
|
# 현재 프로젝트를 관리하는 systemd 서비스명을 반환합니다 (상태 무관).
|
|
39
57
|
find_systemd_service() {
|
|
40
58
|
has_command systemctl || return 1
|
|
@@ -949,21 +967,26 @@ case "$MODE" in
|
|
|
949
967
|
;;
|
|
950
968
|
|
|
951
969
|
restart)
|
|
970
|
+
# 백업 서버 전파용 서비스명(상태 무관). 모든 재시작 경로에서 동일하게 사용한다.
|
|
971
|
+
svc=$(find_systemd_service || true)
|
|
972
|
+
|
|
952
973
|
# --force restart: 포트 점유 프로세스를 이름 무관 강제 종료한 뒤 재기동한다.
|
|
953
974
|
if [ "$FORCE_STOP" -eq 1 ]; then
|
|
954
975
|
stop_server || exit $?
|
|
976
|
+
propagate_restart_to_standby "$svc"
|
|
955
977
|
exec "$SCRIPT_DIR/run.sh" start
|
|
956
978
|
fi
|
|
957
979
|
|
|
958
|
-
svc=$(find_systemd_service || true)
|
|
959
980
|
if [ -n "$svc" ]; then
|
|
960
981
|
echo "ℹ️ systemd 서비스 재시작: $svc"
|
|
961
982
|
sudo systemctl restart "$svc"
|
|
983
|
+
propagate_restart_to_standby "$svc"
|
|
962
984
|
echo "✅ ${SERVER_NAME} 재시작 완료 (systemd)"
|
|
963
985
|
exit 0
|
|
964
986
|
fi
|
|
965
987
|
|
|
966
988
|
stop_server || exit $?
|
|
989
|
+
propagate_restart_to_standby "$svc"
|
|
967
990
|
exec "$SCRIPT_DIR/run.sh" start
|
|
968
991
|
;;
|
|
969
992
|
|