Unverified Commit cd928efd authored by Tom Moulard's avatar Tom Moulard
Browse files

mastodon: adding mastodon suite

parent eadec8b3
Loading
Loading
Loading
Loading
+60 −0
Original line number Diff line number Diff line
# This is a sample configuration file. You can generate your configuration
# with the `rake mastodon:setup` interactive setup wizard, but to customize
# your setup even further, you'll need to edit it manually. This sample does
# not demonstrate all available configuration options. Please look at
# https://docs.joinmastodon.org/admin/config/ for the full documentation.

# Federation
# ----------
# This identifies your server and cannot be changed safely later
# ----------
LOCAL_DOMAIN=mastodon.example.com

# Redis
# -----
REDIS_HOST=mastodon-redis
REDIS_PORT=6379

# PostgreSQL
# ----------
DB_HOST=mastodon-postgres
DB_USER=postgres
DB_NAME=postgres
DB_PASS=mastodon-postgres-pass
DB_PORT=5432

# ElasticSearch (optional)
# ------------------------
ES_ENABLED=false
ES_HOST=localhost
ES_PORT=9200

# Secrets
# -------
# Make sure to use `bundle exec rake secret` to generate secrets
# -------
SECRET_KEY_BASE=
OTP_SECRET=

# Web Push
# --------
# Generate with `bundle exec rake mastodon:webpush:generate_vapid_key`
# --------
VAPID_PRIVATE_KEY=
VAPID_PUBLIC_KEY=

# Sending mail
# ------------
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
SMTP_LOGIN=
SMTP_PASSWORD=
SMTP_FROM_ADDRESS=notificatons@example.com

# File storage (optional)
# -----------------------
S3_ENABLED=false
S3_BUCKET=files.example.com
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
S3_ALIAS_HOST=files.example.com

mastodon/.gitignore

0 → 100644
+3 −0
Original line number Diff line number Diff line
mastodon/
redis/
postgres/

mastodon/README.md

0 → 100644
+15 −0
Original line number Diff line number Diff line
# Mastodon

## Installing
To setup database, run this:
```bash
docker-compose run mastodon rails db:migrate
docker-compose run mastodon rails assets:precompile
```

## Setup
To setup, change ./mastodon/.env.production
```bash
docker-compose run mastodon rake secret
docker-compose run mastodon rake mastodon:webpush:generate_vapid_key
```
+86 −0
Original line number Diff line number Diff line
version: '2'

networks:
  mastodon-internal:

services:
  mastodon-postgres:
    image: postgres:9.6-alpine
    restart: always
    shm_size: 256mb
    networks:
      - 'mastodon-internal'
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "postgres"]
    volumes:
      - ./mastodon/postgres:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=mastodon-postgres-pass
    labels:
      - 'traefik.enable=false'

  mastodon-redis:
    image: redis:6.0-alpine
    restart: always
    networks:
      - 'mastodon-internal'
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
    volumes:
      - ./mastodon/redis:/data
    labels:
      - 'traefik.enable=false'

  mastodon:
    image: tootsuite/mastodon
    restart: always
    env_file: ./mastodon/.env.production
    command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
    networks:
      - 'srv'
      - 'mastodon-internal'
    healthcheck:
      test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:3000/health || exit 1"]
    depends_on:
      - mastodon-postgres
      - mastodon-redis
      - mastodon-streaming
      - mastodon-sidekiq
    volumes:
      - ./mastodon/mastodon:/mastodon/public/system
    labels:
      - 'traefik.enable=true'
      - 'traefik.frontend.rule=Host:mastodon.${SITE}'
      - 'traefik.port=3000'

  mastodon-streaming:
    image: tootsuite/mastodon
    restart: always
    env_file: ./mastodon/.env.production
    command: node ./streaming
    networks:
      - 'srv'
      - 'mastodon-internal'
    healthcheck:
      test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1"]
    depends_on:
      - mastodon-postgres
      - mastodon-redis
    labels:
      - 'traefik.enable=true'
      - 'traefik.frontend.rule=Host:api.mastodon.${SITE}'
      - 'traefik.port=4000'

  mastodon-sidekiq:
    image: tootsuite/mastodon
    restart: always
    env_file: ./mastodon/.env.production
    command: bundle exec sidekiq
    depends_on:
      - mastodon-postgres
      - mastodon-redis
    networks:
      - 'srv'
      - 'mastodon-internal'
    volumes:
      - ./mastodon/mastodon:/mastodon/public/system