docker compose reads env_file client-side as the deploy user (ubuntu), so
the root-managed /opt/webapps/webapp-mysql.env (mode 600) caused
"open ...: permission denied" at `docker compose up`. Extend the deploy
preflight to grant docker-group read (chgrp docker + chmod 640) when the
deploy user cannot read it — idempotent, self-heals a rebuilt web VPS.
The live VPS file was already fixed out-of-band; this prevents recurrence.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two comprehensive CI fixes:
1. Adversarial harness flake (PASS=42 FAIL=2, state-dependent):
governance-check.sh re-exported audit-public.pem only when GENERATING a
new signing key. On a CI runner where the off-repo private key PERSISTS
across runs, the checked-out (Vault-signed) audit-public.pem drifted out
of sync with the local re-signing key, so verify-audit-chain.sh rejected a
genuine head ("H5/H2 verifies the genuine signed chain"). Now always
re-export the public key matching the signing key — mirrors the same fix
already applied to tool-audit-lib.sh (c31987c). Reproduced the exact
FAIL=2 locally with a drifted persisted key; now deterministically 44/44.
2. Deploy docker.sock permission denied:
Added a self-healing preflight to deploy-okr that ensures the deploy user
is in the docker group on the web VPS (idempotent, passwordless sudo) and
proves a fresh SSH session can reach the daemon before streaming images.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
printf '%s' with inline secret expansion could leave out trailing newline
or preserve \r from browser-pasted keys, causing OpenSSH 'error in libcrypto'.
Use env: block + printf '%s\n' | tr -d '\r' to normalize the key file.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Instead of skipping the frontend test when vitest is not installed,
security-gate.sh now runs `npm ci -w frontend` automatically.
Also add `cache: "npm"` to security-gate's actions/setup-node so the
npm cache from the frontend-tests job is reused — prevents OOM on
the 1GB VPS (cache restore is disk-only, not 300MB download).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 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>
Both jobs running concurrently (two 512MB containers + gitea + vault) exhausted
the 1GB RAM. Make security-gate sequential with needs: [frontend-tests].
Also fix health-check to use docker ps instead of curl localhost (DooD mode).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Gitea Actions requires the workflow file at repo root (.gitea/workflows/ci.yml)
not in the app subdirectory. Uses defaults.run.working-directory: AINative_OKR_CASAN5
so all run steps execute in the correct app context.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>