diff --git a/phosphorus/srv/docker/mastodon/.env b/phosphorus/srv/docker/mastodon/.env index ffdaf1e..e6f3ffd 100644 --- a/phosphorus/srv/docker/mastodon/.env +++ b/phosphorus/srv/docker/mastodon/.env @@ -2,6 +2,11 @@ LOCAL_DOMAIN=merping.synth.download AUTHORIZED_FETCH=true +# dragonflydb +REDIS_URL=redis://dragonfly:6379/0 +CACHE_REDIS_URL=redis://dragonfly-cache:6380/0 +SIDEKIQ_REDIS_URL=redis://dragonfly-sidekiq:6381/0 + # max character/profile related limits MAX_TOOT_CHARS=100000 MAX_BIO_CHARS=100000 diff --git a/phosphorus/srv/docker/mastodon/compose.yaml b/phosphorus/srv/docker/mastodon/compose.yaml index 1e37337..b34a2d8 100644 --- a/phosphorus/srv/docker/mastodon/compose.yaml +++ b/phosphorus/srv/docker/mastodon/compose.yaml @@ -16,10 +16,11 @@ services: ports: - "127.0.0.1:46098:3000" depends_on: - redis: + dragonfly: condition: service_healthy volumes: - ./public/system:/mastodon/public/system + - ./shared:/shared # this is just to allow seeing/copying emoji exports streaming: image: ghcr.io/melontini/mastodon-streaming:nightly @@ -37,7 +38,7 @@ services: ports: - "127.0.0.1:58834:4000" depends_on: - redis: + dragonfly: condition: service_healthy sidekiq: @@ -48,7 +49,7 @@ services: - .env command: bundle exec sidekiq depends_on: - redis: + dragonfly: condition: service_healthy networks: - masto @@ -59,13 +60,70 @@ services: healthcheck: test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 7' || false"] - redis: + # generic dragonfly instance + dragonfly: + image: docker.dragonflydb.io/dragonflydb/dragonfly restart: always - image: redis:alpine + ulimits: + memlock: -1 networks: - masto + environment: + # these envvars are important to make dfdb act as closely as possible to redis for properly saving and loading data + DFLY_snapshot_cron: '* * * * *' + DFLY_version_check: false + DFLY_default_lua_flags: allow-undeclared-keys + DFLY_dbfilename: 'dump.rdb' + DFLY_df_snapshot_format: false + DFLY_dir: '/data' volumes: - - ./redis:/data + - ./dragonfly/generic:/data + healthcheck: + test: "redis-cli ping" + interval: 5s + retries: 20 + + # cache dragonfly instance + dragonfly-cache: + image: docker.dragonflydb.io/dragonflydb/dragonfly + restart: always + ulimits: + memlock: -1 + networks: + - masto + environment: + DFLY_port: 6380 + DFLY_snapshot_cron: '* * * * *' + DFLY_version_check: false + DFLY_default_lua_flags: allow-undeclared-keys + DFLY_dbfilename: 'dump.rdb' + DFLY_df_snapshot_format: false + DFLY_dir: '/data' + volumes: + - ./dragonfly/cache:/data + healthcheck: + test: "redis-cli ping" + interval: 5s + retries: 20 + + # sidekiq dragonfly instance + dragonfly-sidekiq: + image: docker.dragonflydb.io/dragonflydb/dragonfly + restart: always + ulimits: + memlock: -1 + networks: + - masto + environment: + DFLY_port: 6381 + DFLY_snapshot_cron: '* * * * *' + DFLY_version_check: false + DFLY_default_lua_flags: allow-undeclared-keys + DFLY_dbfilename: 'dump.rdb' + DFLY_df_snapshot_format: false + DFLY_dir: '/data' + volumes: + - ./dragonfly/sidekiq:/data healthcheck: test: "redis-cli ping" interval: 5s