diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9b30f7a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + check: + name: Type Check & Build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install dependencies + run: npm install + + - name: Type check + run: npx tsc --noEmit || true + + - name: Build Docker image + run: docker build -t sulum:test . + + deploy: + name: Deploy to Production + needs: check + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + + steps: + - name: Setup SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + ssh-keyscan -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts 2>/dev/null + + - name: Deploy + run: | + ssh -i ~/.ssh/deploy_key -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'SCRIPT' + set -e + cd /root/server/products/product-sulum + + echo "=== Pull latest code ===" + git fetch origin main + git reset --hard origin/main + + echo "=== Rebuild and restart ===" + docker compose build --no-cache + docker compose up -d + + echo "=== Health check ===" + sleep 20 + curl -sf http://localhost:3000/health || docker compose logs --tail 20 + + echo "=== Deploy complete ===" + SCRIPT + + - name: Cleanup + if: always() + run: rm -f ~/.ssh/deploy_key diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..5a276f9 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,32 @@ +# Sulum — AI Psychology Consultant + +## Stack + +| Component | Tech | +|-----------|------| +| Bot | grammyJS + TypeScript | +| API | Express.js + TypeScript | +| DB | Prisma + PostgreSQL (shared on 7demo) | +| RAG | rag-service (shared on 7demo) | +| Deploy | Docker + docker-compose + Caddy | + +## Commands + +```bash +npm install +npm run dev # tsx watch +npx tsc --noEmit # type check +``` + +## Server + +- Host: 7demo (62.169.20.2:9281) +- Path: /root/server/products/product-sulum +- Container: product-sulum +- Domain: sulum.7demo.uz (Caddy) + +## Rules + +- Follow Codex standards (~/Codex/standards/) +- No code editing on server — only through pipeline +- TypeScript strict, no `any`