diff --git a/compute-2-mep/mastodon/.env.production b/compute-2-mep/mastodon/.env.production new file mode 100644 index 0000000..4ca85cb --- /dev/null +++ b/compute-2-mep/mastodon/.env.production @@ -0,0 +1,25 @@ +# Generated with mastodon:setup on 2020-02-04 17:37:42 UTC + +LOCAL_DOMAIN=toot.gnous.eu +SINGLE_USER_MODE=false + +DB_PORT=5432 +DB_USER=mastodon +DB_NAME=mastodon + +REDIS_HOST=redis +REDIS_PORT=6379 +REDIS_PASSWORD= + +SMTP_PORT=587 +SMTP_AUTH_METHOD=plain +SMTP_OPENSSL_VERIFY_MODE=none +SMTP_FROM_ADDRESS=Mastodon + +S3_ENABLED=true +S3_BUCKET=gnoustoot +S3_REGION=fr-par +S3_HOSTNAME=obiwan.gnous.eu +S3_ENDPOINT=https://s3.fr-par.scw.cloud + +ES_ENABLED=false \ No newline at end of file diff --git a/compute-2-mep/mastodon/docker-compose.yaml b/compute-2-mep/mastodon/docker-compose.yaml new file mode 100644 index 0000000..123e7f0 --- /dev/null +++ b/compute-2-mep/mastodon/docker-compose.yaml @@ -0,0 +1,76 @@ +networks: + mastodon: + external: false + enable_ipv6: true + +services: + redis: + image: redis:7-alpine + restart: always + healthcheck: + test: ["CMD", "redis-cli", "ping"] + networks: + - mastodon + + web: + image: ghcr.io/mastodon/mastodon:v4.3.0 + restart: always + env_file: .env.production + command: bundle exec puma -C config/puma.rb + healthcheck: + # prettier-ignore + test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] + networks: + - mastodon + ports: + - "4004:3000" + depends_on: + - redis + labels: + - "traefik.enable=true" + - "traefik.http.routers.mastodon-web.entrypoints=websecure" + - "traefik.http.routers.mastodon-web.rule=Host(`toot.gnous.eu`)" + - "traefik.http.routers.mastodon-web.tls=true" + - "traefik.http.routers.mastodon-web.tls.certresolver=defaultacme" + - "traefik.http.routers.mastodon-web.middlewares=proxyHeader@file,proxyError@file" + # Cron + - "ofelia.enabled=true" + - "ofelia.job-exec.clean-media.schedule=@daily" + - "ofelia.job-exec.clean-media.command=tootctl media remove --days 7" + - "ofelia.job-exec.clean-account.schedule=@monthly" + - "ofelia.job-exec.clean-account.command=tootctl accounts cull" + + streaming: + image: ghcr.io/mastodon/mastodon-streaming:v4.3.0 + restart: always + env_file: .env.production + command: node ./streaming/index.js + healthcheck: + # prettier-ignore + test: ['CMD-SHELL', "curl -s --noproxy localhost localhost:4000/api/v1/streaming/health | grep -q 'OK' || exit 1"] + ports: + - "127.0.0.1:4000:4000" + depends_on: + - redis + networks: + - mastodon + labels: + - "traefik.enable=true" + - "traefik.http.routers.mastodon-streaming.entrypoints=websecure" + - "traefik.http.routers.mastodon-streaming.rule=(Host(`toot.gnous.eu`) && PathPrefix(`/api/v1/streaming`))" + - "traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt" + - "traefik.http.routers.mastodon-streaming.tls=true" + - "traefik.http.routers.mastodon-streaming.tls.certresolver=defaultacme" + - "traefik.http.routers.mastodon-streaming.middlewares=proxyHeader@file,proxyError@file" + + sidekiq: + image: ghcr.io/mastodon/mastodon:v4.3.0 + restart: always + env_file: .env.production + command: bundle exec sidekiq + healthcheck: + test: ["CMD-SHELL", "ps aux | grep '[s]idekiq\ 6' || false"] + networks: + - mastodon + depends_on: + - redis