Compare commits
No commits in common. "1baba8626b17d907f21937a7be9f131df47baa4d" and "b661f79ecd96b99e5a23d7415127692d453b850a" have entirely different histories.
1baba8626b
...
b661f79ecd
49
README.md
49
README.md
@ -114,21 +114,21 @@ grep -r "enterprise.proxmox.com" /etc/apt/sources.list.d/
|
|||||||
```
|
```
|
||||||
## 💻 개발 환경 설정 (code-server)
|
## 💻 개발 환경 설정 (code-server)
|
||||||
|
|
||||||
서버에서 **웹 기반 VS Code 개발 환경**을 빠르게 구축:
|
팜큐 네트워크에 연결된 서버에서 **웹 기반 VS Code 개발 환경**을 빠르게 구축:
|
||||||
|
|
||||||
### 기본 설치 (포트 8080)
|
### 한 줄 설치 (권장)
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/code-server.sh | bash
|
# 기본 포트 8080으로 설치
|
||||||
|
curl -fsSL https://git.0bin.in/thug0bin/headscale-tailscale-replacement/raw/branch/live/pharmq-headscale-production/docs/code-server.sh | bash
|
||||||
|
|
||||||
|
# 포트 지정 설치 (예: 8443)
|
||||||
|
curl -fsSL https://git.0bin.in/thug0bin/headscale-tailscale-replacement/raw/branch/live/pharmq-headscale-production/docs/code-server.sh | PORT=8443 bash
|
||||||
```
|
```
|
||||||
|
|
||||||
### 포트 지정 설치
|
### 무인 설치 (비밀번호 환경변수 설정)
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/code-server.sh | PORT=8443 bash
|
# 비밀번호를 환경변수로 전달
|
||||||
```
|
curl -fsSL https://git.0bin.in/thug0bin/headscale-tailscale-replacement/raw/branch/live/pharmq-headscale-production/docs/code-server.sh | PASSWORD="your-secure-password" SKIP_CONFIRM=1 bash
|
||||||
|
|
||||||
### 무인 설치 (비밀번호 환경변수)
|
|
||||||
```bash
|
|
||||||
curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/code-server.sh | PASSWORD="your-secure-password" SKIP_CONFIRM=1 bash
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 자동 설치 기능
|
### 자동 설치 기능
|
||||||
@ -142,35 +142,6 @@ curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/code-serve
|
|||||||
```bash
|
```bash
|
||||||
# 브라우저에서 접속
|
# 브라우저에서 접속
|
||||||
http://<서버IP>:8080
|
http://<서버IP>:8080
|
||||||
```
|
|
||||||
|
|
||||||
## 🤖 Claude Code CLI 설치
|
|
||||||
|
|
||||||
**AI 기반 개발 도구**를 서버에 설치:
|
|
||||||
|
|
||||||
### 기본 설치
|
|
||||||
```bash
|
|
||||||
curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/install-claude-code.sh | bash
|
|
||||||
```
|
|
||||||
|
|
||||||
### 수동 설치 (스크립트 확인 후 실행)
|
|
||||||
```bash
|
|
||||||
wget https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/install-claude-code.sh
|
|
||||||
chmod +x install-claude-code.sh
|
|
||||||
./install-claude-code.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### 설치 내용
|
|
||||||
- ✅ **Node.js 20.x LTS** 자동 설치
|
|
||||||
- ✅ **npm** 포함 설치
|
|
||||||
- ✅ **Claude Code CLI** 글로벌 설치
|
|
||||||
- ✅ 설치 확인 및 버전 출력
|
|
||||||
|
|
||||||
### 사용 방법
|
|
||||||
```bash
|
|
||||||
claude-code # Claude Code 시작
|
|
||||||
claude-code --help # 도움말 보기
|
|
||||||
```
|
|
||||||
|
|
||||||
## 라이선스
|
## 라이선스
|
||||||
|
|
||||||
|
|||||||
128
code-server.sh
128
code-server.sh
@ -1,128 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# setup-code-server.sh
|
|
||||||
# - code-server 미설치 시 자동 설치
|
|
||||||
# - 최초 1회 실행해 ~/.config/code-server/config.yaml 생성
|
|
||||||
# - config.yaml을 0.0.0.0:<PORT> + 지정 비밀번호로 갱신
|
|
||||||
# - 기존에 떠있는 code-server(수동/비-systemd) 프로세스 정리
|
|
||||||
# - systemd 미사용: nohup으로 백그라운드 실행
|
|
||||||
#
|
|
||||||
# 환경변수:
|
|
||||||
# PORT=8080 # 바인드 포트 (기본 8080)
|
|
||||||
# PASSWORD= # 비밀번호(무인 실행용)
|
|
||||||
# SKIP_CONFIRM=0/1 # 비밀번호 확인 입력 생략
|
|
||||||
#
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
PORT="${PORT:-8080}"
|
|
||||||
CONFIG_DIR="${HOME}/.config/code-server"
|
|
||||||
CONFIG_FILE="${CONFIG_DIR}/config.yaml"
|
|
||||||
LOG_FILE="${HOME}/code-server.log"
|
|
||||||
|
|
||||||
say() { echo -e "$@"; }
|
|
||||||
die() { echo -e "❌ $@" >&2; exit 1; }
|
|
||||||
|
|
||||||
# 0) 필수 도구 준비 (curl/timeout/pgrep 등)
|
|
||||||
if ! command -v curl >/dev/null 2>&1 || ! command -v timeout >/dev/null 2>&1; then
|
|
||||||
say "📦 필요 패키지 설치 중 (curl, coreutils, procps 등)..."
|
|
||||||
if command -v apt >/dev/null 2>&1; then
|
|
||||||
apt update -y >/dev/null 2>&1 || true
|
|
||||||
apt install -y curl ca-certificates coreutils procps >/dev/null 2>&1
|
|
||||||
else
|
|
||||||
die "apt 환경이 아닙니다. curl/timeout/pgrep가 필요합니다."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 1) code-server 설치 확인 및 자동 설치
|
|
||||||
if ! command -v code-server >/dev/null 2>&1; then
|
|
||||||
say "📦 code-server 미설치 상태 → 설치 진행..."
|
|
||||||
bash <(curl -fsSL https://code-server.dev/install.sh)
|
|
||||||
command -v code-server >/dev/null 2>&1 || die "code-server 설치 실패"
|
|
||||||
say "✅ code-server 설치 완료"
|
|
||||||
else
|
|
||||||
say "✅ code-server 이미 설치됨"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 2) config.yaml 생성 (없으면 최초 1회 3~5초 실행)
|
|
||||||
if [ ! -f "${CONFIG_FILE}" ]; then
|
|
||||||
say "📝 config.yaml 이 없어 최초 1회 실행으로 생성합니다..."
|
|
||||||
mkdir -p "${CONFIG_DIR}"
|
|
||||||
timeout 5s code-server >/dev/null 2>&1 || true
|
|
||||||
[ -f "${CONFIG_FILE}" ] || die "config.yaml 생성 실패"
|
|
||||||
say "✅ 기본 config.yaml 생성됨: ${CONFIG_FILE}"
|
|
||||||
else
|
|
||||||
say "ℹ️ 기존 config.yaml 감지: ${CONFIG_FILE}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 3) 비밀번호 입력/확정
|
|
||||||
if [ "${PASSWORD-}" = "" ]; then
|
|
||||||
read -rsp "🔐 code-server 접속 비밀번호 입력: " PASS; echo
|
|
||||||
if [ "${SKIP_CONFIRM-0}" != "1" ]; then
|
|
||||||
read -rsp "🔐 비밀번호 확인 입력: " PASS2; echo
|
|
||||||
[ "$PASS" = "$PASS2" ] || die "비밀번호 불일치"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
PASS="$PASSWORD"
|
|
||||||
fi
|
|
||||||
[ -n "$PASS" ] || die "비밀번호는 비어 있을 수 없습니다."
|
|
||||||
|
|
||||||
# 4) 기존 파일 백업 후 config.yaml 갱신
|
|
||||||
ts="$(date +%Y%m%d%H%M%S)"
|
|
||||||
if [ -f "${CONFIG_FILE}" ]; then
|
|
||||||
cp -a "${CONFIG_FILE}" "${CONFIG_FILE}.bak.${ts}"
|
|
||||||
say "🗂 백업 생성: ${CONFIG_FILE}.bak.${ts}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat > "${CONFIG_FILE}" <<EOF
|
|
||||||
bind-addr: 0.0.0.0:${PORT}
|
|
||||||
auth: password
|
|
||||||
password: ${PASS}
|
|
||||||
cert: false
|
|
||||||
EOF
|
|
||||||
|
|
||||||
say "✅ config.yaml 갱신됨 (bind-addr=0.0.0.0:${PORT})"
|
|
||||||
|
|
||||||
# 5) systemd로 떠있다면 중지(원하시는 게 '비-systemd' 운영이므로)
|
|
||||||
if command -v systemctl >/dev/null 2>&1; then
|
|
||||||
if systemctl is-active --quiet "code-server@${USER}"; then
|
|
||||||
say "⏹ systemd 서비스(code-server@${USER}) 중지"
|
|
||||||
systemctl stop "code-server@${USER}" || true
|
|
||||||
fi
|
|
||||||
if [ "$EUID" -eq 0 ] && systemctl is-active --quiet "code-server@root"; then
|
|
||||||
say "⏹ systemd 서비스(code-server@root}) 중지"
|
|
||||||
systemctl stop "code-server@root" || true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 6) 수동/기존 실행 프로세스 정리 (부모/자식 순서 종료)
|
|
||||||
say "🧹 기존 code-server 수동 프로세스 정리..."
|
|
||||||
# 부모 엔트리(메인/entry) TERM
|
|
||||||
pids="$(pgrep -f "/usr/lib/code-server/lib/node /usr/lib/code-server($|/out/node/entry)" || true)"
|
|
||||||
if [ -n "${pids}" ]; then
|
|
||||||
for p in $pids; do
|
|
||||||
pkill -TERM -P "$p" 2>/dev/null || true
|
|
||||||
kill -TERM "$p" 2>/dev/null || true
|
|
||||||
done
|
|
||||||
sleep 2
|
|
||||||
fi
|
|
||||||
# 남아있으면 KILL
|
|
||||||
pids="$(pgrep -f "/usr/lib/code-server/lib/node /usr/lib/code-server($|/out/node/entry)" || true)"
|
|
||||||
[ -n "${pids}" ] && kill -9 $pids 2>/dev/null || true
|
|
||||||
|
|
||||||
# 보조 호스트/터미널 프로세스 잔여물 정리(있어도 없어도 무방)
|
|
||||||
pkill -f "vscode/out/bootstrap-fork --type=ptyHost" 2>/dev/null || true
|
|
||||||
pkill -f "vscode/out/bootstrap-fork --type=extensionHost" 2>/dev/null || true
|
|
||||||
pkill -f "shellIntegration-bash.sh" 2>/dev/null || true
|
|
||||||
|
|
||||||
# 7) 비-systemd 백그라운드 실행
|
|
||||||
say "🚀 code-server 일반 실행(nohup 백그라운드) 시작..."
|
|
||||||
nohup code-server > "${LOG_FILE}" 2>&1 &
|
|
||||||
pid=$!
|
|
||||||
disown || true
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
say "✅ 실행됨 (PID: ${pid})"
|
|
||||||
say "📄 로그 보기: tail -f ${LOG_FILE}"
|
|
||||||
say "🌐 접속 URL: http://<서버IP>:${PORT}"
|
|
||||||
say "🔑 비밀번호: (방금 설정한 값)"
|
|
||||||
say "🔒 보안 권장: 역프록시(Caddy/Nginx) + HTTPS 사용 시 config는 127.0.0.1로 바꾸세요."
|
|
||||||
Loading…
Reference in New Issue
Block a user