🚒 Deployment

Production target: a single Ubuntu VPS, root access, Nginx reverse proxy, systemd-managed.


The short version

  1. Install the ASP.NET Core runtime (not the full SDK), PostgreSQL, Redis, and LavinMQ
  2. dotnet publish the API and copy the output to /opt/insightstream
  3. Set every secret via /opt/insightstream/.env (systemd EnvironmentFile) β€” never in appsettings.json
  4. Run dotnet ef database update against the production connection string
  5. Install deploy/insightstream.service and deploy/nginx.conf, then certbot --nginx
  6. Point the cPanel mail server’s pipe at deploy/ingest-relay.php

The full, copy-pasteable walkthrough β€” including exact apt commands, the systemd unit, the Nginx server block, the admin-password rotation procedure, and a curl smoke-test sequence for every endpoint β€” lives in deploy/deploy.md at the repository root (kept there, next to the artifacts it references, rather than duplicated here).


Architecture reminder

1
2
3
4
cPanel mail server ──(PHP relay pipes raw email)──▢ VPS: Nginx ──▢ InsightStream.Api
                                                                        β”‚
                                                          hosts the ingest consumer too
                                                          (single-deployment simplicity)

Nginx terminates TLS (via certbot) and enforces client_max_body_size 10m to match the API’s own Ingest:MaxRequestBodyBytes / Kestrel MaxRequestBodySize limit β€” keep both in sync if you change it.

Splitting the ingest worker out later

The consumer runs today as an IHostedService inside the API process. If ingest volume ever justifies scaling it independently, deploy/deploy.md Β§14 covers extracting it into its own InsightStream.Worker project and systemd unit β€” no database or queue schema changes required, since both are already shared, decoupled state.