Files
CASAN/AINative_OKR_CASAN5/backend/entrypoint.sh
T
thanhnvandClaude Sonnet 4.6 9229fee656 feat(deploy): switch to Oracle MySQL, separate CI runner, docker-compose deploy
- Prisma schema: sqlite → mysql provider
- Migration SQL rewritten as MySQL DDL (utf8mb4, DATETIME(3), AUTO_INCREMENT)
- Add migration_lock.toml for mysql provider
- Dockerfile.backend: drop node:22/sqlite deps, use node:20-slim
- entrypoint.sh: replace SQLite first-run logic with prisma migrate deploy + db seed
- docker-compose.prod.yml: production compose for /opt/webapps/okr on web VPS
  - reads DB creds from /opt/webapps/webapp-mysql.env
  - reads app secrets from /opt/webapps/okr/.env.app (written by CI)
  - port 80 (frontend), no conflict with Gitea 3000/Vault 8200
- ci.yml deploy-okr: moves from ubuntu-latest (web VPS) to ci-runner (161.33.149.243)
  - builds images on CI runner VPS (no heavy build on web/Gitea VPS)
  - transfers images via docker save | gzip | ssh | docker load
  - deploys via SSH + docker compose up on web VPS
- scripts/setup-ci-runner.sh: one-time setup script for CI runner VPS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 16:37:56 +09:00

17 lines
424 B
Bash

#!/bin/sh
# OKR backend container entrypoint for MySQL.
# - Applies pending Prisma migrations (idempotent).
# - Seeds initial data via upsert (safe to run on every start).
set -e
export PATH="/app/node_modules/.bin:$PATH"
echo "[OKR] Applying database migrations..."
npx prisma migrate deploy
echo "[OKR] Seeding database..."
npx prisma db seed
echo "[OKR] Starting backend on port ${PORT:-3001}"
exec node dist/main.js