ci(deploy): Auto-Deploy-Runner für Push auf main + reproduzierbarer API-Build
ci / quality (push) Failing after 35s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 53s

- .gitea/workflows/deploy.yml: deployt bei Push auf main via Host-Runner
  (git reset --hard origin/main in /opt/build/cockpit, docker compose up
  -d --build in /opt/stacks/cockpit, Healthcheck auf cockpit-api).
- Auto-Migrate: runMigrations() (drizzle-orm Migrator) wird beim API-Start
  aufgerufen; Schema wird vor dem Listen idempotent aktualisiert.
- API-Dockerfile: Workspace-Libs (@cockpit/db, @cockpit/shared) werden jetzt
  mit Emit kompiliert und main/exports im Image auf dist gebogen. Vorher war
  das Prod-Image nicht reproduzierbar baubar (Node konnte die TS-Quelle der
  Libs nicht laden → ERR_MODULE_NOT_FOUND). Dev-Modus und Web-/Vite-Build
  bleiben unberührt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Raffael SheikhandClaude Opus 4.8 committed 2026-06-05 18:51:17 +02:00
1 parent 9f3ee13094
commit 3b928d0ad0
5 files changed
+102 -1

No files matched your search

+12
View File
@@ -1,6 +1,7 @@
import Fastify from 'fastify';
import cookie from '@fastify/cookie';
import { fastifyTRPCPlugin, type FastifyTRPCPluginOptions } from '@trpc/server/adapters/fastify';
import { runMigrations } from '@cockpit/db';
import { loadEnv } from './env.js';
import { logger } from './lib/logger.js';
import { registerAuthMiddleware } from './auth/middleware.js';
@@ -12,6 +13,17 @@ import { createContext } from './trpc.js';
async function main() {
const env = loadEnv();
// Schema-Migrationen vor dem Start anwenden (idempotent). Schlägt eine
// Migration fehl, startet der Server nicht — besser als mit veraltetem Schema.
try {
await runMigrations(env.DATABASE_URL);
logger.info('db migrations applied');
} catch (err) {
logger.error({ err }, 'db migration failed');
process.exit(1);
}
const app = Fastify({
logger: {
level: env.LOG_LEVEL,