diff --git a/IPAM.md b/IPAM.md index d50aa87..44bb9f1 100644 --- a/IPAM.md +++ b/IPAM.md @@ -71,6 +71,7 @@ Global DNS: `fant0mib0t.renoux.dev` | 80, 443 | Caddy | | | 2000 | Matrix | `matrix.fantomitechno.dev` | | 2010 | Tranquill PDS | `pds.fantomitechno.dev` | +| 2020,2021 | Mastodon | `mastodon.fantomitechno.dev` | | 4000 | Tangled Knot | `knot.fantomitechno.dev` | | 4010 | Tangled Spindle | `spindle.fantomitechno.dev` | | 4020, 4021 | Cryptpad | `drive.renoux.dev`, `drive.s.renoux.dev` | diff --git a/docker/fant0mib0t/mastodon/docker-compose.yml b/docker/fant0mib0t/mastodon/docker-compose.yml new file mode 100644 index 0000000..7704512 --- /dev/null +++ b/docker/fant0mib0t/mastodon/docker-compose.yml @@ -0,0 +1,69 @@ +services: + db: + restart: always + image: postgres:14-alpine + shm_size: 256mb + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres"] + volumes: + - /home/fantomitechno/mastodon/pg_data:/var/lib/postgresql/data + environment: + POSTGRES_DB: ${DB_USER} + POSTGRES_USER: ${DB_NAME} + POSTGRES_PASSWORD: ${DB_PASS} + + redis: + restart: always + image: redis:7-alpine + healthcheck: + test: ["CMD", "redis-cli", "ping"] + + web: + image: ghcr.io/mastodon/mastodon:v4.6.2 + restart: always + env_file: .env + command: bundle exec puma -C config/puma.rb + healthcheck: + test: + [ + "CMD-SHELL", + "curl -s --noproxy localhost localhost:3000/health | grep -q 'OK' || exit 1", + ] + ports: + - "127.0.0.1:2020:3000" + depends_on: + - db + - redis + volumes: + - /home/fantomitechno/mastodon/public:/mastodon/public + - /nas/mastodon/system:/mastodon/public/system + + streaming: + image: ghcr.io/mastodon/mastodon-streaming:v4.6.2 + restart: always + env_file: .env + command: node ./streaming/index.js + healthcheck: + test: + [ + "CMD-SHELL", + "curl -s --noproxy localhost localhost:4000/api/v1/streaming/health | grep -q 'OK' || exit 1", + ] + ports: + - "127.0.0.1:2021:4000" + depends_on: + - db + - redis + + sidekiq: + image: ghcr.io/mastodon/mastodon:v4.6.2 + restart: always + env_file: .env + command: bundle exec sidekiq + depends_on: + - db + - redis + volumes: + - /nas/mastodon/system:/mastodon/public/system + healthcheck: + test: ["CMD-SHELL", "ps aux | grep '[s]idekiq\ 8' || false"] diff --git a/modules/caddy/fant0mib0t b/modules/caddy/fant0mib0t index 8325e9e..eb4aad7 100644 --- a/modules/caddy/fant0mib0t +++ b/modules/caddy/fant0mib0t @@ -85,4 +85,42 @@ http://pdf.fantom.home { notes.fantomitechno.dev { import logging affine reverse_proxy 127.0.0.1:4070 +} + +mastodon.fantomitechno.dev { + import logging mastodon + + root * /home/fantomitechno/mastodon/public + + encode gzip + + @static file + + handle @static { + file_server + } + + handle /api/v1/streaming* { + reverse_proxy mastodon-streaming:4000 + } + + handle { + reverse_proxy mastodon-web:3000 + } + + header { + Strict-Transport-Security "max-age=31536000;" + } + + header /sw.js Cache-Control "public, max-age=0"; + header /emoji* Cache-Control "public, max-age=31536000, immutable" + header /packs* Cache-Control "public, max-age=31536000, immutable" + header /system/accounts/avatars* Cache-Control "public, max-age=31536000, immutable" + header /system/media_attachments/files* Cache-Control "public, max-age=31536000, immutable" + + handle_errors { + @5xx expression `{http.error.status_code} >= 500 && {http.error.status_code} < 600` + rewrite @5xx /500.html + file_server + } } \ No newline at end of file