Mastodon

Your self-hosted, globally interconnected microblogging community.

# file: `docker-compose.yml`

services:
  mastodon:
    image: ${HONEYPI_IMAGE_REGISTRY_HOST:-docker.io}/ghcr.io/${HONEYPI_MASTODON_GHCR_USER:-mastodon}/mastodon:${HONEYPI_MASTODON_VERSION:-latest}
    restart: unless-stopped
    container_name: mastodon
    command: bundle exec puma -C config/puma.rb
    ports:
      - ${HONEYPI_MASTODON_PORT:-3000}:3000
    volumes:
      - ${HONEYPI_DATA}/mastodon/public/system:/mastodon/public/system
    environment:
      - LOCAL_DOMAIN=${HONEYPI_MASTODON_HOST:-mastodon}
      - SINGLE_USER=false
      - REDIS_HOST=${HONEYPI_REDIS_HOST:-localhost}
      - REDIS_PORT=${HONEYPI_REDIS_PORT:-6379}
      - DB_HOST=${HONEYPI_POSTGRES_HOST:-localhost}
      - DB_USER=${HONEYPI_POSTGRES_USER:-admin}
      - DB_NAME=${HONEYPI_MASTODON_DB_NAME:-mastodon}
      - DB_PASS=${HONEYPI_POSTGRES_PASSWORD}
      - ES_ENABLED=true
      - ES_HOST=${HONEYPI_ELASTICSEARCH_HOST:-localhost}
      - ES_PORT=9200
      - SECRET_KEY_BASE=${HONEYPI_MASTODON_SECRET_KEY_BASE}
      - OTP_SECRET=${HONEYPI_MASTODON_OTP_SECRET}
      - VAPID_PRIVATE_KEY=${HONEYPI_MASTODON_VAPID_PRIVATE_KEY}
      - VAPID_PUBLIC_KEY=${HONEYPI_MASTODON_VAPID_PUBLIC_KEY}
      - SMTP_SERVER=${HONEYPI_EMAIL_HOST}
      - SMTP_PORT=${HONEYPI_EMAIL_PORT}
      - SMTP_LOGIN=${HONEYPI_EMAIL_USERNAME}
      - SMTP_PASSWORD=${HONEYPI_EMAIL_PASSWORD}
      - SMTP_FROM_ADDRESS=${HONEYPI_EMAIL_FROM}
      - IP_RETENTION_PERIOD=31556952
      - SESSION_RETENTION_PERIOD=31556952
      - ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY}
      - ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT}
      - ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY}
    labels:
      - traefik.enable=${HONEYPI_MASTODON_TRAEFIK_ENABLE:-false}
      - traefik.http.routers.mastodon.rule=Host(`${HONEYPI_MASTODON_HOST}`)
      - traefik.http.routers.mastodon.entrypoints=websecure
      - traefik.http.routers.mastodon.tls.certresolver=resolver
      - traefik.http.routers.mastodon.service=mastodon
      - traefik.http.services.mastodon.loadbalancer.server.port=3000
  mastodon-streaming:
    image: ${HONEYPI_IMAGE_REGISTRY_HOST:-docker.io}/ghcr.io/${HONEYPI_MASTODON_GHCR_USER:-mastodon}/mastodon-streaming:${HONEYPI_MASTODON_VERSION:-latest}
    restart: unless-stopped
    container_name: mastodon-streaming
    command: node ./streaming/index.js
    environment:
      - LOCAL_DOMAIN=${HONEYPI_MASTODON_HOST:-mastodon}
      - SINGLE_USER=false
      - REDIS_HOST=${HONEYPI_REDIS_HOST:-localhost}
      - REDIS_PORT=${HONEYPI_REDIS_PORT:-6379}
      - DB_HOST=${HONEYPI_POSTGRES_HOST:-localhost}
      - DB_USER=${HONEYPI_POSTGRES_USER:-admin}
      - DB_NAME=${HONEYPI_MASTODON_DB_NAME:-mastodon}
      - DB_PASS=${HONEYPI_POSTGRES_PASSWORD}
      - ES_ENABLED=true
      - ES_HOST=${HONEYPI_ELASTICSEARCH_HOST:-localhost}
      - ES_PORT=9200
      - SECRET_KEY_BASE=${HONEYPI_MASTODON_SECRET_KEY_BASE}
      - OTP_SECRET=${HONEYPI_MASTODON_OTP_SECRET}
      - VAPID_PRIVATE_KEY=${HONEYPI_MASTODON_VAPID_PRIVATE_KEY}
      - VAPID_PUBLIC_KEY=${HONEYPI_MASTODON_VAPID_PUBLIC_KEY}
      - SMTP_SERVER=${HONEYPI_EMAIL_HOST}
      - SMTP_PORT=${HONEYPI_EMAIL_PORT}
      - SMTP_LOGIN=${HONEYPI_EMAIL_USERNAME}
      - SMTP_PASSWORD=${HONEYPI_EMAIL_PASSWORD}
      - SMTP_FROM_ADDRESS=${HONEYPI_EMAIL_FROM}
      - IP_RETENTION_PERIOD=31556952
      - SESSION_RETENTION_PERIOD=31556952
      - ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY}
      - ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT}
      - ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY}
  mastodon-sidekiq:
    image: ${HONEYPI_IMAGE_REGISTRY_HOST:-docker.io}/ghcr.io/${HONEYPI_MASTODON_GHCR_USER:-mastodon}/mastodon:${HONEYPI_MASTODON_VERSION:-latest}
    restart: unless-stopped
    container_name: mastodon-sidekiq
    command: bundle exec sidekiq
    volumes:
      - ${HONEYPI_DATA}/mastodon/public/system:/mastodon/public/system
    environment:
      - LOCAL_DOMAIN=${HONEYPI_MASTODON_HOST:-mastodon}
      - SINGLE_USER=false
      - REDIS_HOST=${HONEYPI_REDIS_HOST:-localhost}
      - REDIS_PORT=${HONEYPI_REDIS_PORT:-6379}
      - DB_HOST=${HONEYPI_POSTGRES_HOST:-localhost}
      - DB_USER=${HONEYPI_POSTGRES_USER:-admin}
      - DB_NAME=${HONEYPI_MASTODON_DB_NAME:-mastodon}
      - DB_PASS=${HONEYPI_POSTGRES_PASSWORD}
      - ES_ENABLED=true
      - ES_HOST=${HONEYPI_ELASTICSEARCH_HOST:-localhost}
      - ES_PORT=9200
      - SECRET_KEY_BASE=${HONEYPI_MASTODON_SECRET_KEY_BASE}
      - OTP_SECRET=${HONEYPI_MASTODON_OTP_SECRET}
      - VAPID_PRIVATE_KEY=${HONEYPI_MASTODON_VAPID_PRIVATE_KEY}
      - VAPID_PUBLIC_KEY=${HONEYPI_MASTODON_VAPID_PUBLIC_KEY}
      - SMTP_SERVER=${HONEYPI_EMAIL_HOST}
      - SMTP_PORT=${HONEYPI_EMAIL_PORT}
      - SMTP_LOGIN=${HONEYPI_EMAIL_USERNAME}
      - SMTP_PASSWORD=${HONEYPI_EMAIL_PASSWORD}
      - SMTP_FROM_ADDRESS=${HONEYPI_EMAIL_FROM}
      - IP_RETENTION_PERIOD=31556952
      - SESSION_RETENTION_PERIOD=31556952
      - ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY}
      - ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT}
      - ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=${HONEYPI_MASTODON_ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY}