Deploy Lemmy
Federated Reddit-style forum: Lemmy, UI, pict-rs, Postgres and a router
Lemmy UI
Just deployed
Just deployed
/var/lib/postgresql/data
Just deployed
Just deployed
/mnt
Lemmy Backend
Just deployed
Deploy and Host Lemmy on Railway
Lemmy is an open-source, self-hosted link aggregator and discussion forum, similar to Reddit. Users create communities, share links and posts, vote and comment. Lemmy speaks ActivityPub, so your instance federates with other Lemmy servers, Mastodon and the wider fediverse, while you keep control of your own moderation and rules.
About Hosting Lemmy
Lemmy needs several cooperating services: a Rust backend for the API and federation, a Node web UI, the pict-rs image server, PostgreSQL, and a reverse proxy that sends API, media and ActivityPub traffic to the backend and page views to the UI. This template deploys all five on Railway's private network, pinned to Lemmy 0.19.21. Postgres and pict-rs keep their data on volumes. Secrets and the admin password are generated, the backend creates the admin account before it opens its port, and HTTPS comes from Railway's domain. After deploy, log in as admin with the password from Lemmy Backend's variables and pick your registration mode.
Common Use Cases
- Run a community forum for a project, company, school or hobby group that you own and moderate yourself
- Host a federated Reddit-style instance whose users can follow and post to communities on other Lemmy servers
- Give a team or private group a link-sharing and discussion board with voting and threaded comments
Dependencies for Lemmy Hosting
- Lemmy Backend 0.19.21 and Lemmy UI 0.19.21 (official images, pinned by digest)
- pict-rs 0.5.25 for image uploads and thumbnails, PostgreSQL for data, and Caddy as the router
Deployment Dependencies
- Lemmy: https://join-lemmy.org and its administration docs: https://join-lemmy.org/docs/administration/administration.html
- Lemmy releases: https://github.com/LemmyNet/lemmy/releases
- pict-rs: https://git.asonix.dog/asonix/pict-rs
- Template source (Dockerfiles, changelog): https://github.com/aalfath/lemmy-railway-template
Implementation Details
Services (only Lemmy is public):
- Lemmy: Caddy router on the public domain.
/api,/pictrs,/feeds,/nodeinfo,/.well-known,/version, every write and ActivityPub reads go to the backend; everything else goes to the UI, as in upstream's nginx config. - Lemmy Backend: API, federation and scheduled jobs. It runs migrations and creates the admin from
LEMMY_ADMIN_USERNAME/LEMMY_ADMIN_PASSWORDon first start. - Lemmy UI: the server-rendered web app.
- Pict-rs: image hosting, with a volume at
/mnt. - Postgres: all forum data, with its own volume.
Lemmy writes its domain into every user, community and post ID at first start. To use a custom domain, add it on the Lemmy service and set LEMMY_HOSTNAME (Lemmy Backend) and LEMMY_UI_LEMMY_EXTERNAL_HOST (Lemmy UI) to it before you start using the instance, then redeploy both. For e-mail (password resets, verification), set LEMMY_SMTP_SERVER as host:port on Lemmy Backend, plus LEMMY_SMTP_LOGIN, LEMMY_SMTP_PASSWORD and LEMMY_SMTP_TLS_TYPE if your provider needs them.
Updates: every service builds from the template's GitHub repo, with images pinned by version and digest. When a new Lemmy release is tested and merged, Railway shows you an "update available" notice. Read the repo's CHANGELOG, then apply it. Migrations run on their own.
Why Deploy Lemmy on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Lemmy on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
Lemmy UI
aalfath/lemmy-railway-templateLemmy Backend
aalfath/lemmy-railway-template