Skip to content

Instantly share code, notes, and snippets.

@smashnet
Last active December 7, 2023 05:50
Show Gist options
  • Save smashnet/38cf7c30cb06427bab78ae5ab0fd2ae3 to your computer and use it in GitHub Desktop.
Save smashnet/38cf7c30cb06427bab78ae5ab0fd2ae3 to your computer and use it in GitHub Desktop.

Revisions

  1. smashnet revised this gist Nov 14, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,7 @@ services:

    redis:
    restart: always
    image: redis:6-alpine
    image: redis:7-alpine
    healthcheck:
    test: ["CMD", "redis-cli", "ping"]
    volumes:
  2. smashnet revised this gist Nov 14, 2022. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ version: "3.5"

    services:
    traefik:
    image: traefik:v2.3
    image: traefik:v2.9
    container_name: "traefik"
    restart: always
    command:
    @@ -47,7 +47,7 @@ services:

    db:
    restart: always
    image: postgres:9.6-alpine
    image: postgres:14-alpine
    healthcheck:
    test: ["CMD", "pg_isready", "-U", "postgres"]
    environment:
    @@ -59,7 +59,7 @@ services:

    redis:
    restart: always
    image: redis:5.0-alpine
    image: redis:6-alpine
    healthcheck:
    test: ["CMD", "redis-cli", "ping"]
    volumes:
    @@ -68,7 +68,7 @@ services:
    - internal_network

    web:
    image: tootsuite/mastodon:v3.2.1
    image: tootsuite/mastodon:v3.5.3
    restart: always
    env_file: .env.production
    command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
    @@ -94,7 +94,7 @@ services:
    - internal_network

    streaming:
    image: tootsuite/mastodon:v3.2.1
    image: tootsuite/mastodon:v3.5.3
    restart: always
    env_file: .env.production
    command: node ./streaming
    @@ -118,7 +118,7 @@ services:
    - internal_network

    sidekiq:
    image: tootsuite/mastodon:v3.2.1
    image: tootsuite/mastodon:v3.5.3
    restart: always
    env_file: .env.production
    command: bundle exec sidekiq
  3. smashnet revised this gist Nov 10, 2020. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    version: '3'
    version: "3.5"

    # Variables to fill in:
    # Line 23: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    @@ -82,6 +82,7 @@ services:
    - traefik
    labels:
    - "traefik.enable=true"
    - "traefik.docker.network=mastodon_external_network"
    - "traefik.http.services.mastodon-web.loadbalancer.server.port=3000"
    - "traefik.http.routers.mastodon-web.rule=Host(`<DOMAIN>`)"
    - "traefik.http.routers.mastodon-web.entrypoints=websecure"
    @@ -107,6 +108,7 @@ services:
    - traefik
    labels:
    - "traefik.enable=true"
    - "traefik.docker.network=mastodon_external_network"
    - "traefik.http.services.mastodon-streaming.loadbalancer.server.port=4000"
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.entrypoints=websecure"
    @@ -132,5 +134,6 @@ services:

    networks:
    external_network:
    name: mastodon_external_network
    internal_network:
    internal: true
  4. smashnet revised this gist Nov 10, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ version: '3'

    services:
    traefik:
    image: traefik:v2.2
    image: traefik:v2.3
    container_name: "traefik"
    restart: always
    command:
    @@ -68,7 +68,7 @@ services:
    - internal_network

    web:
    image: tootsuite/mastodon:v3.1.4
    image: tootsuite/mastodon:v3.2.1
    restart: always
    env_file: .env.production
    command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
    @@ -93,7 +93,7 @@ services:
    - internal_network

    streaming:
    image: tootsuite/mastodon:v3.1.4
    image: tootsuite/mastodon:v3.2.1
    restart: always
    env_file: .env.production
    command: node ./streaming
    @@ -116,7 +116,7 @@ services:
    - internal_network

    sidekiq:
    image: tootsuite/mastodon:v3.1.4
    image: tootsuite/mastodon:v3.2.1
    restart: always
    env_file: .env.production
    command: bundle exec sidekiq
  5. smashnet revised this gist May 27, 2020. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,11 @@ version: '3'
    # Line 23: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 36: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Line 54: <POSTGRES_PASSWORD> - the password for the postgres db. Use the same during mastodon:setup!
    # Lines 31, 85, 109: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
    # Lines 31, 86, 111: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)

    services:
    traefik:
    image: traefik:v2.1
    image: traefik:v2.2
    container_name: "traefik"
    restart: always
    command:
    @@ -68,7 +68,7 @@ services:
    - internal_network

    web:
    image: tootsuite/mastodon:v3.1.3
    image: tootsuite/mastodon:v3.1.4
    restart: always
    env_file: .env.production
    command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
    @@ -82,6 +82,7 @@ services:
    - traefik
    labels:
    - "traefik.enable=true"
    - "traefik.http.services.mastodon-web.loadbalancer.server.port=3000"
    - "traefik.http.routers.mastodon-web.rule=Host(`<DOMAIN>`)"
    - "traefik.http.routers.mastodon-web.entrypoints=websecure"
    - "traefik.http.routers.mastodon-web.tls.certresolver=letsencrypt"
    @@ -92,7 +93,7 @@ services:
    - internal_network

    streaming:
    image: tootsuite/mastodon:v3.1.3
    image: tootsuite/mastodon:v3.1.4
    restart: always
    env_file: .env.production
    command: node ./streaming
    @@ -106,6 +107,7 @@ services:
    - traefik
    labels:
    - "traefik.enable=true"
    - "traefik.http.services.mastodon-streaming.loadbalancer.server.port=4000"
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.entrypoints=websecure"
    - "traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt"
    @@ -114,7 +116,7 @@ services:
    - internal_network

    sidekiq:
    image: tootsuite/mastodon:v3.1.3
    image: tootsuite/mastodon:v3.1.4
    restart: always
    env_file: .env.production
    command: bundle exec sidekiq
  6. smashnet revised this gist Apr 15, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,7 @@ services:
    - internal_network

    web:
    image: tootsuite/mastodon:v3.0.1
    image: tootsuite/mastodon:v3.1.3
    restart: always
    env_file: .env.production
    command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
    @@ -92,7 +92,7 @@ services:
    - internal_network

    streaming:
    image: tootsuite/mastodon:v3.0.1
    image: tootsuite/mastodon:v3.1.3
    restart: always
    env_file: .env.production
    command: node ./streaming
    @@ -114,7 +114,7 @@ services:
    - internal_network

    sidekiq:
    image: tootsuite/mastodon:v3.0.1
    image: tootsuite/mastodon:v3.1.3
    restart: always
    env_file: .env.production
    command: bundle exec sidekiq
  7. smashnet revised this gist Apr 15, 2020. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,10 @@
    version: '3'

    # Variables to fill in:
    # Line 22: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 35: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 30, 82, 106: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
    # Line 23: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 36: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Line 54: <POSTGRES_PASSWORD> - the password for the postgres db. Use the same during mastodon:setup!
    # Lines 31, 85, 109: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)

    services:
    traefik:
    @@ -49,6 +50,8 @@ services:
    image: postgres:9.6-alpine
    healthcheck:
    test: ["CMD", "pg_isready", "-U", "postgres"]
    environment:
    - POSTGRES_PASSWORD=<POSTGRES_PASSWORD>
    volumes:
    - ./postgres:/var/lib/postgresql/data
    networks:
  8. smashnet revised this gist Jan 17, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    version: '3'

    # Variables to fill in:
    # Line 21: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 33: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 28, 79, 102: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
    # Line 22: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 35: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 30, 82, 106: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)

    services:
    traefik:
  9. smashnet revised this gist Jan 17, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -25,8 +25,8 @@ services:
    - "80:80"
    - "443:443"
    labels:
    # Dashboard
    - "traefik.enable=true"
    # Dashboard
    - "traefik.http.routers.traefik.rule=(Host(`<DOMAIN>`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`)))"
    - "traefik.http.routers.traefik.service=api@internal"
    - "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
  10. smashnet revised this gist Jan 17, 2020. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ version: '3'

    services:
    traefik:
    image: traefik:v2.0
    image: traefik:v2.1
    container_name: "traefik"
    restart: always
    command:
    @@ -16,6 +16,7 @@ services:
    - "--entrypoints.web.address=:80"
    - "--entrypoints.websecure.address=:443"
    - "--providers.docker=true"
    - "--providers.docker.exposedbydefault=false"
    - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
    - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
    - "--certificatesresolvers.letsencrypt.acme.email=<LETSENCRYPT_MAIL_ADDRESS>"
    @@ -25,6 +26,7 @@ services:
    - "443:443"
    labels:
    # Dashboard
    - "traefik.enable=true"
    - "traefik.http.routers.traefik.rule=(Host(`<DOMAIN>`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`)))"
    - "traefik.http.routers.traefik.service=api@internal"
    - "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
    @@ -76,6 +78,7 @@ services:
    - redis
    - traefik
    labels:
    - "traefik.enable=true"
    - "traefik.http.routers.mastodon-web.rule=Host(`<DOMAIN>`)"
    - "traefik.http.routers.mastodon-web.entrypoints=websecure"
    - "traefik.http.routers.mastodon-web.tls.certresolver=letsencrypt"
    @@ -99,6 +102,7 @@ services:
    - redis
    - traefik
    labels:
    - "traefik.enable=true"
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.entrypoints=websecure"
    - "traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt"
  11. smashnet revised this gist Jan 16, 2020. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ version: '3'
    # Variables to fill in:
    # Line 21: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 33: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 28, 78, 100: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
    # Lines 28, 79, 102: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)

    services:
    traefik:
    @@ -74,6 +74,7 @@ services:
    depends_on:
    - db
    - redis
    - traefik
    labels:
    - "traefik.http.routers.mastodon-web.rule=Host(`<DOMAIN>`)"
    - "traefik.http.routers.mastodon-web.entrypoints=websecure"
    @@ -96,6 +97,7 @@ services:
    depends_on:
    - db
    - redis
    - traefik
    labels:
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.entrypoints=websecure"
    @@ -112,6 +114,7 @@ services:
    depends_on:
    - db
    - redis
    - traefik
    volumes:
    - ./public/system:/mastodon/public/system
    networks:
  12. smashnet revised this gist Jan 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ services:
    - "443:443"
    labels:
    # Dashboard
    - "traefik.http.routers.traefik.rule=(Host(`<DOMAIN>`) && PathPrefix(`/traefik`))"
    - "traefik.http.routers.traefik.rule=(Host(`<DOMAIN>`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`)))"
    - "traefik.http.routers.traefik.service=api@internal"
    - "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
    - "traefik.http.routers.traefik.entrypoints=websecure"
  13. smashnet revised this gist Jan 16, 2020. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ version: '3'
    # Variables to fill in:
    # Line 21: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 33: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 28, 79, 102: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
    # Lines 28, 78, 100: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)

    services:
    traefik:
    @@ -75,7 +75,6 @@ services:
    - db
    - redis
    labels:
    - "traefik.enable=true"
    - "traefik.http.routers.mastodon-web.rule=Host(`<DOMAIN>`)"
    - "traefik.http.routers.mastodon-web.entrypoints=websecure"
    - "traefik.http.routers.mastodon-web.tls.certresolver=letsencrypt"
    @@ -98,8 +97,7 @@ services:
    - db
    - redis
    labels:
    - "traefik.enable=true"
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.entrypoints=websecure"
    - "traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt"
    networks:
  14. smashnet revised this gist Jan 15, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ services:
    - "443:443"
    labels:
    # Dashboard
    - "traefik.http.routers.traefik.rule=Host(`<DOMAIN>`)&&Path(`/traefik`)"
    - "traefik.http.routers.traefik.rule=(Host(`<DOMAIN>`) && PathPrefix(`/traefik`))"
    - "traefik.http.routers.traefik.service=api@internal"
    - "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
    - "traefik.http.routers.traefik.entrypoints=websecure"
  15. smashnet revised this gist Jan 15, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    version: '3'

    # Variables to fill in:
    # Line 24: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 37: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 28, 83, 106: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
    # Line 21: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 33: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 28, 79, 102: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)

    services:
    traefik:
    @@ -99,7 +99,7 @@ services:
    - redis
    labels:
    - "traefik.enable=true"
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.entrypoints=websecure"
    - "traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt"
    networks:
  16. smashnet revised this gist Jan 15, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ version: '3'
    # Variables to fill in:
    # Line 24: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 37: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 83, 106: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
    # Lines 28, 83, 106: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)

    services:
    traefik:
  17. smashnet revised this gist Jan 15, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ services:
    - "443:443"
    labels:
    # Dashboard
    - "traefik.http.routers.traefik.rule=Path(`/traefik`)"
    - "traefik.http.routers.traefik.rule=Host(`<DOMAIN>`)&&Path(`/traefik`)"
    - "traefik.http.routers.traefik.service=api@internal"
    - "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
    - "traefik.http.routers.traefik.entrypoints=websecure"
  18. smashnet revised this gist Jan 15, 2020. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -16,8 +16,6 @@ services:
    - "--entrypoints.web.address=:80"
    - "--entrypoints.websecure.address=:443"
    - "--providers.docker=true"
    - "--providers.docker.exposedbydefault=false"
    - "--providers.docker.useBindPortIP=true"
    - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
    - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
    - "--certificatesresolvers.letsencrypt.acme.email=<LETSENCRYPT_MAIL_ADDRESS>"
    @@ -27,7 +25,6 @@ services:
    - "443:443"
    labels:
    # Dashboard
    - "traefik.enable=true"
    - "traefik.http.routers.traefik.rule=Path(`/traefik`)"
    - "traefik.http.routers.traefik.service=api@internal"
    - "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
  19. smashnet created this gist Jan 14, 2020.
    129 changes: 129 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,129 @@
    version: '3'

    # Variables to fill in:
    # Line 24: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
    # Line 37: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
    # Lines 83, 106: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)

    services:
    traefik:
    image: traefik:v2.0
    container_name: "traefik"
    restart: always
    command:
    # - "--log.level=DEBUG"
    - "--api.dashboard=true"
    - "--entrypoints.web.address=:80"
    - "--entrypoints.websecure.address=:443"
    - "--providers.docker=true"
    - "--providers.docker.exposedbydefault=false"
    - "--providers.docker.useBindPortIP=true"
    - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
    - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
    - "--certificatesresolvers.letsencrypt.acme.email=<LETSENCRYPT_MAIL_ADDRESS>"
    - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
    ports:
    - "80:80"
    - "443:443"
    labels:
    # Dashboard
    - "traefik.enable=true"
    - "traefik.http.routers.traefik.rule=Path(`/traefik`)"
    - "traefik.http.routers.traefik.service=api@internal"
    - "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
    - "traefik.http.routers.traefik.entrypoints=websecure"
    - "traefik.http.routers.traefik.middlewares=dashboardauth"
    - "traefik.http.middlewares.dashboardauth.basicauth.users=admin:<TRAEFIK_DASHBOARD_ADMIN_PASSWORD>"
    # HTTPS Redirect
    - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
    - "traefik.http.routers.http-catchall.entrypoints=web"
    - "traefik.http.routers.http-catchall.middlewares=redirect-to-https@docker"
    - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - ./letsencrypt:/letsencrypt
    networks:
    - external_network

    db:
    restart: always
    image: postgres:9.6-alpine
    healthcheck:
    test: ["CMD", "pg_isready", "-U", "postgres"]
    volumes:
    - ./postgres:/var/lib/postgresql/data
    networks:
    - internal_network

    redis:
    restart: always
    image: redis:5.0-alpine
    healthcheck:
    test: ["CMD", "redis-cli", "ping"]
    volumes:
    - ./redis:/data
    networks:
    - internal_network

    web:
    image: tootsuite/mastodon:v3.0.1
    restart: always
    env_file: .env.production
    command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
    healthcheck:
    test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:3000/health || exit 1"]
    expose:
    - "3000"
    depends_on:
    - db
    - redis
    labels:
    - "traefik.enable=true"
    - "traefik.http.routers.mastodon-web.rule=Host(`<DOMAIN>`)"
    - "traefik.http.routers.mastodon-web.entrypoints=websecure"
    - "traefik.http.routers.mastodon-web.tls.certresolver=letsencrypt"
    volumes:
    - ./public/system:/mastodon/public/system
    networks:
    - external_network
    - internal_network

    streaming:
    image: tootsuite/mastodon:v3.0.1
    restart: always
    env_file: .env.production
    command: node ./streaming
    healthcheck:
    test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1"]
    expose:
    - "4000"
    depends_on:
    - db
    - redis
    labels:
    - "traefik.enable=true"
    - "traefik.http.routers.mastodon-streaming.rule=(Host(`<DOMAIN>`) && PathPrefix(`/api/v1/streaming`))"
    - "traefik.http.routers.mastodon-streaming.entrypoints=websecure"
    - "traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt"
    networks:
    - external_network
    - internal_network

    sidekiq:
    image: tootsuite/mastodon:v3.0.1
    restart: always
    env_file: .env.production
    command: bundle exec sidekiq
    depends_on:
    - db
    - redis
    volumes:
    - ./public/system:/mastodon/public/system
    networks:
    - external_network
    - internal_network

    networks:
    external_network:
    internal_network:
    internal: true