
Deploy Mastodon on Your Own Server
Social networking, back in your hands.
Want to deploy Mastodon on your server faster? Try Senate with one-command setup, automatic HTTPS and monitoring.
What is Mastodon?
Your self-hosted, globally interconnected microblogging community
Self-Host Mastodon
Follow these steps to deploy on your own server.
Install Docker
Skip this step if Docker is already installed on your server.
curl -fsSL https://get.docker.com | sh
Configure
Customize the settings below. Defaults work for most cases.
General
Deploy
Copy the configuration and run it on your server.
services:
mastodon:
environment:
ALTERNATE_DOMAINS: ""
DB_HOST: mastodon-postgres
DB_NAME: mastodon_production
DB_PASS: 1659fdf5f4fb
DB_PORT: "5432"
DB_USER: mastodon
ES_ENABLED: "false"
LOCAL_DOMAIN: mastodon.your-domain.com
OTP_SECRET: 7b301a66ac32fea01b6ba08d02ed8237bbc24ced9f6d4e3aacbe46870f041728
RAILS_ENV: production
REDIS_HOST: mastodon-redis
REDIS_PASSWORD: e4e078d1d576
REDIS_PORT: "6379"
S3_ENABLED: "false"
SECRET_KEY_BASE: d77e4449ac57f54f4cef2a196b363a3b631809b759cb858114de32254f33b7f7
SINGLE_USER_MODE: "false"
SMTP_FROM_ADDRESS: ""
SMTP_LOGIN: ""
SMTP_PASSWORD: ""
SMTP_PORT: ""
SMTP_SERVER: ""
SMTP_TLS: ""
VAPID_PRIVATE_KEY: 3bb15abf9d1ad99c
VAPID_PUBLIC_KEY: 36982b5b89f6df85
volumes:
- mastodon-system:/mastodon/public/system
mastodon-postgres:
image: postgres:14-alpine
environment:
POSTGRES_DB: mastodon_production
POSTGRES_PASSWORD: 1659fdf5f4fb
POSTGRES_USER: mastodon
volumes:
- mastodon-postgres-data:/var/lib/postgresql/data
mastodon-redis:
environment:
REDIS_PASSWORD: e4e078d1d576
volumes:
- mastodon-redis-data:/data
mastodon-sidekiq:
environment:
ALTERNATE_DOMAINS: ""
DB_HOST: mastodon-postgres
DB_NAME: mastodon_production
DB_PASS: 1659fdf5f4fb
DB_PORT: "5432"
DB_USER: mastodon
ES_ENABLED: "false"
LOCAL_DOMAIN: mastodon.your-domain.com
OTP_SECRET: 7b301a66ac32fea01b6ba08d02ed8237bbc24ced9f6d4e3aacbe46870f041728
RAILS_ENV: production
REDIS_HOST: mastodon-redis
REDIS_PASSWORD: e4e078d1d576
REDIS_PORT: "6379"
S3_ENABLED: "false"
SECRET_KEY_BASE: d77e4449ac57f54f4cef2a196b363a3b631809b759cb858114de32254f33b7f7
SINGLE_USER_MODE: "false"
SMTP_FROM_ADDRESS: ""
SMTP_LOGIN: ""
SMTP_PASSWORD: ""
SMTP_PORT: ""
SMTP_SERVER: ""
SMTP_TLS: ""
VAPID_PRIVATE_KEY: 47b3939f93faee8e
VAPID_PUBLIC_KEY: 45706ba53cb97d9e
volumes:
- mastodon-system:/mastodon/public/system
mastodon-streaming:
environment:
ALTERNATE_DOMAINS: ""
DB_HOST: mastodon-postgres
DB_NAME: mastodon_production
DB_PASS: 1659fdf5f4fb
DB_PORT: "5432"
DB_USER: mastodon
ES_ENABLED: "false"
LOCAL_DOMAIN: mastodon.your-domain.com
OTP_SECRET: 7b301a66ac32fea01b6ba08d02ed8237bbc24ced9f6d4e3aacbe46870f041728
RAILS_ENV: production
REDIS_HOST: mastodon-redis
REDIS_PASSWORD: e4e078d1d576
REDIS_PORT: "6379"
S3_ENABLED: "false"
SECRET_KEY_BASE: d77e4449ac57f54f4cef2a196b363a3b631809b759cb858114de32254f33b7f7
SINGLE_USER_MODE: "false"
SMTP_FROM_ADDRESS: ""
SMTP_LOGIN: ""
SMTP_PASSWORD: ""
SMTP_PORT: ""
SMTP_SERVER: ""
SMTP_TLS: ""
VAPID_PRIVATE_KEY: bced78bdf50dae7d
VAPID_PUBLIC_KEY: 1c064cb7664ab2c8
volumes:
- mastodon-system:/mastodon/public/system
volumes:
mastodon-system: {}
mastodon-postgres-data: {}
mastodon-redis-data: {}
Then run:
docker compose up -d
Access
Once started, access your app at http://localhost:3000
Why Self-Host Mastodon?
Full Data Ownership
Your data stays on your servers. No third-party access.
No Monthly Fees
Pay only for your server. No per-seat or usage charges.
Complete Control
Customize, backup, and scale on your own terms.
Privacy & Compliance
Meet GDPR, HIPAA, or internal security requirements.
Technical Details
Want to go faster?
Try Senate! Senate handles Docker, HTTPS, updates, and monitoring for you. Deploy any of our 300+ apps with a single command.
Install on any Linux server:
sh -c "$(curl -sSL https://get.senate.sh)"