DEV Community

Cover image for Shipped a HedgeDoc one-click template on Railway — Postgres, WebSockets, and the session-secret trap
InApp
InApp

Posted on Originally published at imapp.blogspot.com

Shipped a HedgeDoc one-click template on Railway — Postgres, WebSockets, and the session-secret trap

I wanted self-hosted collaborative Markdown that didn't require a third-party SaaS account, and HedgeDoc's real-time editing model fits small teams well. The gap was that every setup guide I found hand-waved the stateful parts: auth sessions and uploaded attachments both silently break when the container restarts.

One detail that mattered most: HedgeDoc derives its session cookie signing from the session.secret environment variable, and if that value isn't pinned across deploys, every session is invalidated on restart — users get logged out and sometimes lose unsynced notes in flight. So the template bakes a generated-but-stable secret into the service variables and mounts a persistent volume for /hedgedoc/public/uploads plus the Postgres plugin. Postgres itself is zero-config via Railway's native plugin; but the note data is only as durable as the volume backing the upload path.

The cost to the operator is operational, not licensing: you're trading one-click convenience for running a stateful web service. Quiet DB upgrades, volume snapshots, and WebSocket load-balancing all become yours. Backups are not built in — you need a scheduled pg_dump and a copy of the upload volume, and you should test restore before anyone depends on it.

I packaged the whole setup, hardening, and variables into a one-click deploy: https://github.com/INAPP-Mobile/hedgedoc

Top comments (0)