Agent 2.0 exdev 서버 배포 스택
- server-dev start/stop/deploy 및 Gitea push 자동 배포 - local-dev 로컬 개발 환경 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
# chatbot.exdev.co.kr — Gitea bare repo + post-receive 훅 1회 설정
|
||||
#
|
||||
# 서버(aidev@chatbot.exdev.co.kr)에서 실행:
|
||||
# bash server-dev/setup-gitea.sh
|
||||
#
|
||||
# 또는 로컬에서 SSH로:
|
||||
# ssh aidev@chatbot.exdev.co.kr 'bash -s' < server-dev/setup-gitea.sh
|
||||
set -euo pipefail
|
||||
|
||||
GIT_DIR="${GIT_DIR:-/Volumes/ADATA/gitea/data/gitea-repositories/aidev/exaichatbot_agent.git}"
|
||||
WORK_TREE="${WORK_TREE:-/Users/aidev/dev/exAichatbot_agent}"
|
||||
DEPLOY_SCRIPT="${DEPLOY_SCRIPT:-/Volumes/ADATA/git/deploy-exAichatbot_agent.sh}"
|
||||
GITEA_URL="${GITEA_URL:-https://github.exdev.co.kr}"
|
||||
REPO_NAME="${REPO_NAME:-exAichatbot_agent}"
|
||||
|
||||
log() { echo "[setup] $*"; }
|
||||
fail() { log "ERROR: $*"; exit 1; }
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
log "bare repo: ${GIT_DIR}"
|
||||
mkdir -p "$(dirname "${GIT_DIR}")" "${WORK_TREE}" /Volumes/ADATA/logs/deploy
|
||||
|
||||
if [[ ! -d "${GIT_DIR}" ]]; then
|
||||
git init --bare "${GIT_DIR}"
|
||||
log "bare repo 생성"
|
||||
else
|
||||
log "bare repo 이미 존재"
|
||||
fi
|
||||
|
||||
log "deploy 스크립트 설치 → ${DEPLOY_SCRIPT}"
|
||||
cp "${SCRIPT_DIR}/deploy.sh" "${DEPLOY_SCRIPT}"
|
||||
chmod +x "${DEPLOY_SCRIPT}"
|
||||
|
||||
log "post-receive 훅 설치"
|
||||
cp "${SCRIPT_DIR}/hooks/post-receive" "${GIT_DIR}/hooks/post-receive"
|
||||
chmod +x "${GIT_DIR}/hooks/post-receive"
|
||||
|
||||
log "work tree 준비: ${WORK_TREE}"
|
||||
if [[ ! -f "${WORK_TREE}/server-dev/start-all-server.sh" ]]; then
|
||||
git --work-tree="${WORK_TREE}" --git-dir="${GIT_DIR}" checkout -f main 2>/dev/null || \
|
||||
log "work tree 비어 있음 — 첫 push 후 checkout 됩니다"
|
||||
fi
|
||||
|
||||
chmod +x "${WORK_TREE}/server-dev/"*.sh 2>/dev/null || true
|
||||
|
||||
cat <<EOF
|
||||
|
||||
============================================================
|
||||
Gitea 저장소 등록 (웹 UI 또는 CLI)
|
||||
|
||||
1) ${GITEA_URL} → New Repository
|
||||
- Name: ${REPO_NAME}
|
||||
- Owner: (조직 또는 aidev)
|
||||
- Uncheck "Initialize Repository"
|
||||
|
||||
2) 로컬 개발 Mac에서:
|
||||
cd /path/to/exChatbot_agent
|
||||
git init
|
||||
git remote add origin ssh://aidev@github.exdev.co.kr:2222/aidev/${REPO_NAME}.git
|
||||
git add .
|
||||
git commit -m "Initial Agent 2.0 stack"
|
||||
git push -u origin main
|
||||
|
||||
3) push 시 post-receive → deploy-exAichatbot_agent.sh 자동 실행
|
||||
|
||||
서버 경로:
|
||||
GIT_DIR = ${GIT_DIR}
|
||||
WORK_TREE = ${WORK_TREE}
|
||||
Deploy log = /Volumes/ADATA/logs/deploy/exAichatbot_agent.log
|
||||
|
||||
수동 배포:
|
||||
${DEPLOY_SCRIPT}
|
||||
${WORK_TREE}/server-dev/start-all-server.sh
|
||||
============================================================
|
||||
EOF
|
||||
Reference in New Issue
Block a user