fix(ci): simplify remote deploy script and avoid nested heredoc
This commit is contained in:
parent
3157985b9f
commit
50f9564b51
1 changed files with 8 additions and 43 deletions
|
|
@ -30,69 +30,34 @@ jobs:
|
|||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa ${{ secrets.BETA_EC2_USERNAME }}@${{ secrets.BETA_EC2_HOST }} << 'EOF'
|
||||
set -e
|
||||
|
||||
# ── 1. Target Directory Setup ────────────────────────────────
|
||||
# 1. Target Directory Setup
|
||||
sudo mkdir -p /home/ubuntu/getcito/logs
|
||||
sudo chown -R ubuntu:ubuntu /home/ubuntu/getcito
|
||||
tar -xzf /tmp/app.tar.gz -C /home/ubuntu/getcito
|
||||
|
||||
cd /home/ubuntu/getcito
|
||||
|
||||
# ── 2. Environment Configuration ────────────────────────────
|
||||
# 2. Environment Configuration
|
||||
if [ ! -f .env ]; then
|
||||
cat << 'ENVEOF' > .env
|
||||
NODE_ENV=production
|
||||
PORT=3003
|
||||
NITRO_PORT=3003
|
||||
NITRO_HOST=127.0.0.1
|
||||
HOST=127.0.0.1
|
||||
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=5432
|
||||
DB_USER=vignesh
|
||||
DB_PASSWORD=vignesh_secret_pass_2026
|
||||
DB_NAME=getcito
|
||||
DATABASE_URL=postgres://vignesh:vignesh_secret_pass_2026@127.0.0.1:5432/getcito
|
||||
|
||||
DEPLOYMENT_MODE=local
|
||||
VITE_DEPLOYMENT_MODE=local
|
||||
BETTER_AUTH_SECRET=9f8c6e2b1a3d5e7f0b2c4d6e8a1c3e5f
|
||||
APP_URL=https://seo.tradhox.com
|
||||
VITE_APP_URL=https://seo.tradhox.com
|
||||
VITE_APP_TIMEZONE=Asia/Kolkata
|
||||
VITE_APP_LOCALE=en-IN
|
||||
DISABLE_TELEMETRY=1
|
||||
|
||||
SCRAPE_TARGETS=chatgpt:openai-api
|
||||
ONBOARDING_LLM_TARGET=chatgpt:openai-api
|
||||
OPENAI_API_KEY=dummy_key_for_testing
|
||||
ANTHROPIC_API_KEY=dummy_key_for_testing
|
||||
DATAFORSEO_LOGIN=dummy_login
|
||||
DATAFORSEO_PASSWORD=dummy_password
|
||||
ENVEOF
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
cp .env apps/web/.env
|
||||
|
||||
# ── 3. Install Dependencies & Build ─────────────────────────
|
||||
# 3. Install Dependencies & Build
|
||||
export PATH=/opt/node24/bin:/usr/local/bin:/usr/bin:/bin
|
||||
pnpm install --no-frozen-lockfile
|
||||
pnpm build
|
||||
|
||||
# ── 4. Systemd Service Deployment ───────────────────────────
|
||||
# 4. Systemd Service Deployment
|
||||
sudo cp /tmp/getcito.service /etc/systemd/system/getcito.service
|
||||
sudo cp /tmp/getcito-worker.service /etc/systemd/system/getcito-worker.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable getcito.service getcito-worker.service
|
||||
sudo systemctl restart getcito.service getcito-worker.service || {
|
||||
echo "Services failed to restart! Logs:"
|
||||
sudo journalctl -u getcito.service -n 50 --no-pager
|
||||
sudo journalctl -u getcito-worker.service -n 50 --no-pager
|
||||
exit 1
|
||||
}
|
||||
sudo systemctl restart getcito.service getcito-worker.service
|
||||
|
||||
# ── 5. Reload Nginx ─────────────────────────────────────────
|
||||
# 5. Reload Nginx
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
|
||||
rm -f /tmp/app.tar.gz /tmp/getcito.service /tmp/getcito-worker.service
|
||||
echo "GetCito deployed successfully to https://seo.tradhox.com!"
|
||||
EOF
|
||||
EOF
|
||||
|
|
|
|||
Loading…
Reference in a new issue