Commit Graph

4 Commits

Author SHA1 Message Date
Jon Torrez
f4183f99c7 feat: self-hosted Docker stack (#1521)
* feat: self-hosted Docker stack with nginx, Redis REST proxy, and seeders

Multi-stage Docker build: esbuild TS handler compilation, vite frontend
build, nginx + Node.js API under supervisord. Upstash-compatible Redis
REST proxy with command allowlist for security. AIS relay WebSocket
sidecar. Seeder wrapper script with auto-sourced env vars from
docker-compose.override.yml. Self-hosting guide with architecture
diagram, API key setup, and troubleshooting.

Security: Redis proxy command allowlist (blocks FLUSHALL/CONFIG/EVAL),
nginx security headers (X-Content-Type-Options, X-Frame-Options,
Referrer-Policy), non-root container user.

* feat(docker): add Docker secrets support for API keys

Entrypoint reads /run/secrets/* files and exports as env vars at
startup. Secrets take priority over environment block values and
stay out of docker inspect / process metadata.

Both methods (env vars and secrets) work simultaneously.

* fix(docker): point supervisord at templated nginx config

The entrypoint runs envsubst on nginx.conf.template and writes
the result to /tmp/nginx.conf (with LOCAL_API_PORT substituted
and listening on port 8080 for non-root). But supervisord was
still launching nginx with /etc/nginx/nginx.conf — the default
Alpine config that listens on port 80, which fails with
"Permission denied" under the non-root appuser.

* fix(docker): remove KEYS from Redis allowlist, fix nginx header inheritance, add LLM vars to seeders

- Remove KEYS from redis-rest-proxy allowlist (O(N) blocking, Redis DoS risk)
- Move security headers into each nginx location block to prevent add_header
  inheritance suppression
- Add LLM_API_URL / LLM_API_KEY / LLM_MODEL to run-seeders.sh grep filter
  so LLM API keys set in docker-compose.override.yml are forwarded to seed scripts

* fix(docker): add path-based POST to Redis proxy, expand allowlist, add missing seeder secrets

- Add POST /{command}/{args...} handler to redis-rest-proxy so Upstash-style
  path POSTs work (setCachedJson uses POST /set/<key>/<value>/EX/<ttl>)
- Expand allowlist: HLEN, LTRIM (seed-military-bases, seed-forecasts),
  ZREVRANGE (premium-stock-store), ZRANDMEMBER (seed-military-bases)
- Add ACLED_EMAIL, ACLED_PASSWORD, OPENROUTER_API_KEY, OLLAMA_API_URL,
  OLLAMA_MODEL to run-seeders.sh so override keys reach host-run seeders

---------

Co-authored-by: Elie Habib <elie.habib@gmail.com>
2026-03-19 12:07:20 +04:00
Elie Habib
0d5f6a2386 fix(railway): move .dockerignore to docker/ to unblock Nixpacks builds (#1336)
.dockerignore at repo root excludes scripts/, docs/, and e2e/ from the
build context. Nixpacks (and/or Railway's build system) respects this
file, causing all seed cron services to crash with "Cannot find module
'/app/scripts/...'" at runtime.

Moving .dockerignore into docker/ (alongside the Dockerfile) means:
- Railway Nixpacks builds get the full repo (scripts/ included)
- GHA Docker builds use context: . with file: docker/Dockerfile,
  and Docker only reads .dockerignore from the build context root,
  so docker/ placement is harmless for GHA
2026-03-09 13:24:15 +04:00
Elie Habib
717f31f085 fix(docker): restore server/ in build context for vite config (#1327)
vite.config.ts imports from ./server/ at config load time (Vercel dev
middleware plugin). Excluding server/ from .dockerignore broke the
Docker build with 25 "Could not resolve" errors.
2026-03-09 10:26:17 +04:00
Sanwal
72726e926b Feature/docker image on release (#1309)
* feat: publish official Docker image on release #1260 solved

* docker image changes

* fixes fix

* all fixes

* things changed according to suggestions

* fixed
2026-03-09 10:10:20 +04:00