Skip to content

About

WebMCP production-scheduling sandbox. Agents propose schedules for a synthetic factory and a human approves every change.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

takt_shift

WebMCP production-scheduling sandbox. Anyone can open the workspace without an account: inspect the synthetic factory, optimize an isolated scenario, compare it to the committed baseline, and request human approval. Agents cannot commit.

Setup

npm install
cp .env.example .env.local   # set BETTER_AUTH_SECRET
npm run db:migrate
npm run dev

Open http://localhost:3000. Sandbox is at /workspace.

Production is a long-lived Node process (npm start) with SQLite on a host volume. One instance.

Coolify deployment

  • Create one Application resource using this Dockerfile. Do not create a Coolify Database resource or a second container.
  • Add Persistent Storage with destination /data, as a directory. A bind mount such as /var/lib/takt_shift → /data keeps the SQLite file on the host. Never mount takt.db as a single file.
  • Set DATABASE_URL=file:/data/takt.db, PORT=3000, BETTER_AUTH_URL to the public origin, and BETTER_AUTH_SECRET as a Coolify secret.
  • Run one instance. Disable rolling or zero-downtime deployments so two processes never write the same SQLite file. Preview deployments must not mount the production volume.

server.mjs still migrates on boot in production, before the container starts listening. The /data directory is the durable store; the database is not baked into the image.

Client IP and rate-limit observation

Before changing the auth configuration, inspect the incoming x-forwarded-for chain on the deployed instance. Watch the Coolify application/container logs while making requests, or perform a one-off observation of the request headers that Coolify/Traefik/Caddy injects at the app boundary. Record the observed chain and its proxy addresses before making any trust decision.

Success means that deployed logs no longer show Rate limiting could not determine a client IP and is falling back to a single shared per-path bucket, and sign-in attempts from two different client IPs are rate-limited independently.

  • If the observed chain is single-hop, Better Auth's default already resolves the client IP; no code change is needed.
  • If Coolify produces a multi-hop chain, configure Better Auth's advanced.ipAddress.trustedProxies with the exact proxy address(es) observed. Use named hops only: never trust broad CIDRs and never widen the accepted forwarded headers.
  • Any trustedProxies value must be an exact address recorded in this README at the time it is added. Coolify has not been observed here, so no addresses are invented and src/server/auth.ts must remain unchanged until that observation is recorded.

Backup

The /data bind mount is durable, not recoverable. Use SQLite's online backup, never a raw copy of a live database:

sqlite3 /data/takt.db ".backup /backups/takt-<timestamp>.db"

Store backups outside the app's /data mount, for example in /var/backups/takt_shift on the host. The command must run where sqlite3 can see the live file. With the directory bind mount /var/lib/takt_shift → /data, the live file is at /var/lib/takt_shift/takt.db on the host, so prefer running the backup there so it does not require a second container:

sqlite3 /var/lib/takt_shift/takt.db ".backup /var/backups/takt_shift/takt-<timestamp>.db"

Schedule it daily with a Coolify scheduled task or host cron on the bind-mount directory, and retain a rotating set of the last 7 daily backups. Do not add a second container, a Coolify Database resource, or another lockfile. better-sqlite3 also writes takt.db-wal and takt.db-shm; .backup captures the database consistently. Never run cp takt.db while the app is running.

Restore

  1. Stop the single app instance (instances = 1); do not run two writers.
  2. Replace takt.db on the mount with the backup file.
  3. Remove stale takt.db-wal and takt.db-shm siblings.
  4. Start the instance. Boot migrates, then serves.
  5. Confirm that a previously signed-up user still has their committed revision and baseline.

No .db file or .env.local is ever committed. A volume is not a backup. Preview deployments must not mount the production volume.

Checks

npx tsc --noEmit
npm run check
npx tsx verify/run-all.ts

About

WebMCP production-scheduling sandbox. Agents propose schedules for a synthetic factory and a human approves every change.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages