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>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
719f1147d1
commit
9229fee656
@@ -1,21 +1,16 @@
|
||||
#!/bin/sh
|
||||
# OKR backend container entrypoint.
|
||||
# - First run: creates SQLite schema via setup-sqlite.mjs + seeds initial data.
|
||||
# - Subsequent runs: DB already exists, skip init.
|
||||
# WORKDIR expected: /app/backend (set in Dockerfile)
|
||||
# OKR backend container entrypoint for MySQL.
|
||||
# - Applies pending Prisma migrations (idempotent).
|
||||
# - Seeds initial data via upsert (safe to run on every start).
|
||||
set -e
|
||||
|
||||
# Hoisted node_modules/.bin (workspace root) must be in PATH for tsx + prisma CLI
|
||||
export PATH="/app/node_modules/.bin:$PATH"
|
||||
|
||||
mkdir -p /data
|
||||
echo "[OKR] Applying database migrations..."
|
||||
npx prisma migrate deploy
|
||||
|
||||
if [ ! -f "/data/okr.db" ]; then
|
||||
echo "[OKR] First run — initializing database at /data/okr.db"
|
||||
node scripts/setup-sqlite.mjs
|
||||
npx prisma db seed
|
||||
echo "[OKR] Database initialized"
|
||||
fi
|
||||
echo "[OKR] Seeding database..."
|
||||
npx prisma db seed
|
||||
|
||||
echo "[OKR] Starting backend on port ${PORT:-3001}"
|
||||
exec node dist/main.js
|
||||
|
||||
Reference in New Issue
Block a user