Compare commits

...

2 Commits

Author SHA1 Message Date
fahed
418eb2c17c ci: remove sudo restart step — restart manually after deploy
All checks were successful
Deploy HiHala Dashboard / deploy (push) Successful in 7s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 11:16:24 +03:00
fahed
b8d33f4f8c feat: deploy Express server via CI/CD with systemd + nginx proxy
Some checks failed
Deploy HiHala Dashboard / deploy (push) Failing after 51m18s
- Update deploy.yml to rsync server/, install deps, write .env from
  Gitea secrets, and restart hihala-dashboard.service
- Move tsx to regular dependencies for production use
- Remove unused SESSION_SECRET from config
- Accept PORT env var as fallback for SERVER_PORT

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 17:59:34 +03:00
3 changed files with 42 additions and 8 deletions

View File

@@ -13,6 +13,7 @@ jobs:
with: with:
node-version: '20' node-version: '20'
# --- Frontend ---
- name: Build frontend - name: Build frontend
env: env:
VITE_NOCODB_URL: ${{ secrets.VITE_NOCODB_URL }} VITE_NOCODB_URL: ${{ secrets.VITE_NOCODB_URL }}
@@ -22,6 +23,40 @@ jobs:
npm ci npm ci
npm run build npm run build
- name: Deploy to server - name: Deploy frontend
run: rsync -a --delete build/ /opt/apps/hihala-dashboard/build/
# --- Backend ---
- name: Deploy server
run: rsync -a --delete --exclude='.env' --exclude='node_modules' server/ /opt/apps/hihala-dashboard/server/
- name: Install server dependencies
run: cd /opt/apps/hihala-dashboard/server && npm ci
- name: Write server .env
env:
ADMIN_PIN: ${{ secrets.ADMIN_PIN }}
NOCODB_URL: ${{ secrets.VITE_NOCODB_URL }}
NOCODB_TOKEN: ${{ secrets.VITE_NOCODB_TOKEN }}
NOCODB_BASE_ID: ${{ secrets.VITE_NOCODB_BASE_ID }}
ERP_API_URL: ${{ secrets.ERP_API_URL }}
ERP_API_CODE: ${{ secrets.ERP_API_CODE }}
ERP_USERNAME: ${{ secrets.ERP_USERNAME }}
ERP_PASSWORD: ${{ secrets.ERP_PASSWORD }}
ETL_SECRET: ${{ secrets.ETL_SECRET }}
run: | run: |
rsync -a --delete build/ /opt/apps/hihala-dashboard/build/ cat > /opt/apps/hihala-dashboard/server/.env << EOF
NODE_ENV=production
SERVER_PORT=3002
ADMIN_PIN=${ADMIN_PIN}
NOCODB_URL=${NOCODB_URL}
NOCODB_TOKEN=${NOCODB_TOKEN}
NOCODB_BASE_ID=${NOCODB_BASE_ID}
ERP_API_URL=${ERP_API_URL}
ERP_API_CODE=${ERP_API_CODE}
ERP_USERNAME=${ERP_USERNAME}
ERP_PASSWORD=${ERP_PASSWORD}
ETL_SECRET=${ETL_SECRET}
EOF
# Restart manually: sudo systemctl restart hihala-dashboard.service

View File

@@ -13,13 +13,13 @@
"cookie-parser": "^1.4.7", "cookie-parser": "^1.4.7",
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"express": "^4.18.2" "express": "^4.18.2",
"tsx": "^4.19.0"
}, },
"devDependencies": { "devDependencies": {
"@types/cookie-parser": "^1.4.10", "@types/cookie-parser": "^1.4.10",
"@types/cors": "^2.8.17", "@types/cors": "^2.8.17",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"tsx": "^4.19.0",
"typescript": "^5.9.3" "typescript": "^5.9.3"
} }
} }

View File

@@ -36,5 +36,4 @@ export const etl = {
export const auth = { export const auth = {
adminPin: process.env.ADMIN_PIN || '', adminPin: process.env.ADMIN_PIN || '',
sessionSecret: process.env.SESSION_SECRET || 'hihala-dev-session-secret',
}; };