Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions svgs/mastodon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions templates/compose/mastodon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# documentation: https://docs.joinmastodon.org/admin/install/
# slogan: Free, open-source decentralized social media platform.
# category: social
# tags: social,fediverse,activitypub,microblogging,decentralized
# logo: svgs/mastodon.svg
# port: 3000

# IMPORTANT: Before deploying, generate VAPID keys by running:
# docker run --rm ghcr.io/mastodon/mastodon:latest bundle exec rake mastodon:webpush:generate_vapid_key
Comment on lines +8 to +9
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Set LOCAL_DOMAIN to your domain (e.g. mastodon.example.com) — cannot be changed after first run.

services:
web:
image: ghcr.io/mastodon/mastodon:latest
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pin to a static version rather than 'latest' to prevent the template from breaking due to upstream changes.

command: bundle exec puma -C config/puma.rb
environment:
- SERVICE_URL_WEB_3000
- LOCAL_DOMAIN=${LOCAL_DOMAIN:?}
- SECRET_KEY_BASE=${SERVICE_HEX_64_SECRETKEYBASE}
- ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=${SERVICE_BASE64_32_ARDETKEY}
- ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=${SERVICE_BASE64_32_ARKEYSALT}
- ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=${SERVICE_BASE64_32_ARPRIMARYKEY}
- VAPID_PRIVATE_KEY=${VAPID_PRIVATE_KEY:?}
- VAPID_PUBLIC_KEY=${VAPID_PUBLIC_KEY:?}
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=${POSTGRES_DB:-mastodon_production}
- DB_USER=${SERVICE_USER_POSTGRESQL}
- DB_PASS=${SERVICE_PASSWORD_POSTGRESQL}
- REDIS_HOST=redis
- REDIS_PORT=6379
- ES_ENABLED=false
- SMTP_SERVER=${SMTP_SERVER:-}
- SMTP_PORT=${SMTP_PORT:-587}
- SMTP_LOGIN=${SMTP_LOGIN:-}
- SMTP_PASSWORD=${SMTP_PASSWORD:-}
- SMTP_FROM_ADDRESS=${SMTP_FROM_ADDRESS:[email protected]}
volumes:
- mastodon-system:/mastodon/public/system
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
db-migrate:
condition: service_completed_successfully
healthcheck:
test: ['CMD-SHELL', "curl -s --noproxy localhost localhost:3000/health | grep -q 'OK' || exit 1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s

db-migrate:
image: ghcr.io/mastodon/mastodon:latest
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pin to a static version rather than 'latest' to prevent the template from breaking due to upstream changes.

restart: "no"
command: bundle exec rake db:prepare
environment:
- LOCAL_DOMAIN=${LOCAL_DOMAIN:?}
- SECRET_KEY_BASE=${SERVICE_HEX_64_SECRETKEYBASE}
- ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=${SERVICE_BASE64_32_ARDETKEY}
- ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=${SERVICE_BASE64_32_ARKEYSALT}
- ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=${SERVICE_BASE64_32_ARPRIMARYKEY}
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=${POSTGRES_DB:-mastodon_production}
- DB_USER=${SERVICE_USER_POSTGRESQL}
- DB_PASS=${SERVICE_PASSWORD_POSTGRESQL}
depends_on:
db:
condition: service_healthy

streaming:
image: ghcr.io/mastodon/mastodon-streaming:latest
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pin to a static version rather than 'latest' to prevent the template from breaking due to upstream changes.

command: node ./streaming/index.js
environment:
- NODE_ENV=production
- BIND=0.0.0.0
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=${POSTGRES_DB:-mastodon_production}
- DB_USER=${SERVICE_USER_POSTGRESQL}
- DB_PASS=${SERVICE_PASSWORD_POSTGRESQL}
- REDIS_HOST=redis
- REDIS_PORT=6379
- SECRET_KEY_BASE=${SERVICE_HEX_64_SECRETKEYBASE}
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ['CMD-SHELL', "curl -s --noproxy localhost localhost:4000/api/v1/streaming/health | grep -q 'OK' || exit 1"]
interval: 10s
timeout: 5s
retries: 10

sidekiq:
image: ghcr.io/mastodon/mastodon:latest
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pin to a static version rather than 'latest' to prevent the template from breaking due to upstream changes.

command: bundle exec sidekiq
environment:
- LOCAL_DOMAIN=${LOCAL_DOMAIN:?}
- SECRET_KEY_BASE=${SERVICE_HEX_64_SECRETKEYBASE}
- ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=${SERVICE_BASE64_32_ARDETKEY}
- ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=${SERVICE_BASE64_32_ARKEYSALT}
- ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=${SERVICE_BASE64_32_ARPRIMARYKEY}
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=${POSTGRES_DB:-mastodon_production}
- DB_USER=${SERVICE_USER_POSTGRESQL}
- DB_PASS=${SERVICE_PASSWORD_POSTGRESQL}
- REDIS_HOST=redis
- REDIS_PORT=6379
- ES_ENABLED=false
- SMTP_SERVER=${SMTP_SERVER:-}
- SMTP_PORT=${SMTP_PORT:-587}
- SMTP_LOGIN=${SMTP_LOGIN:-}
- SMTP_PASSWORD=${SMTP_PASSWORD:-}
- SMTP_FROM_ADDRESS=${SMTP_FROM_ADDRESS:[email protected]}
volumes:
- mastodon-system:/mastodon/public/system
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq 8' || false"]
interval: 10s
timeout: 5s
retries: 10

db:
image: postgres:14-alpine
shm_size: 256mb
environment:
- POSTGRES_DB=${POSTGRES_DB:-mastodon_production}
- POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
volumes:
- db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB:-mastodon_production}"]
interval: 5s
timeout: 5s
retries: 10

redis:
image: redis:7-alpine
volumes:
- redis-data:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 5s
retries: 10