This is a comprehensive docker-compose configuration to deploy a self-hosted Mastodon instance on a Synology NAS using the LinuxServer.io images.
| Service | Description |
|---|---|
| Mastodon | The core decentralized social networking platform. |
| PostgreSQL | Relational database storage for user data and posts. |
| Redis | In-memory data store used for sidekiq task processing and caching. |
| Cloudflared | Provides a secure tunnel back to your instance (optional). |
- Synology NAS (DSM 7.x recommended)
- Git installed via SynoCommunity
- Docker / Container Manager
- Docker Compose
- A domain name for your instance.
- Clone the project:
git clone https://gitlab.com/thinkonezero/mastodon-docker-standup.git
- Environment Configuration:
- Copy
sample.envto.env. - You must generate secret keys before starting the instance (see below).
- Copy
- Deploy:
docker-compose up -d
Mastodon requires several unique secret keys in your .env file. Run these commands via SSH:
| Key Type | Generation Command |
|---|---|
| Secrets & OTP | docker run --rm -it -w /app/www --entrypoint rake lscr.io/linuxserver/mastodon secret (Run twice) |
| VAPID Keys | docker run --rm -it -w /app/www --entrypoint rake lscr.io/linuxserver/mastodon mastodon:webpush:generate_vapid_key |
| Active Record | docker run --rm -it --entrypoint /bin/bash lscr.io/linuxserver/mastodon:latest generate-active-record |
| App | Default URL |
|---|---|
| Mastodon HTTP | http://<NAS_IP>:${MASTODON_HTTP_PORT} |
| Mastodon HTTPS | https://<NAS_IP>:${MASTODON_HTTPS_PORT} |
Crucial variables for deployment:
LOCAL_DOMAIN: Your public domain (e.g.,mastodon.example.com).MASTODON_WEB_DOMAIN: Used if your web UI domain differs from your actor domain.CLOUDFLARED_TOKEN: Required if using the Cloudflare Tunnel service.SMTP_*: Required for user registrations and notifications.
If this project has helped you, please consider supporting my work!
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY.