save redis database on nfs

This commit is contained in:
Pim Kunis 2023-07-14 13:51:08 +02:00
parent b77d38a34e
commit 34f7d80c12
3 changed files with 36 additions and 16 deletions

View file

@ -24,6 +24,8 @@ nfs_shares:
path: /mnt/data/seafile/db path: /mnt/data/seafile/db
- name: mastodon_system - name: mastodon_system
path: /mnt/data/mastodon/system path: /mnt/data/mastodon/system
- name: mastodon_redis
path: /mnt/data/mastodon/redis
- name: forgejo - name: forgejo
path: /mnt/data/forgejo path: /mnt/data/forgejo
- name: overleaf - name: overleaf

View file

@ -12,15 +12,38 @@ volumes:
type: "nfs" type: "nfs"
o: "addr=192.168.30.10,nolock,soft,rw" o: "addr=192.168.30.10,nolock,soft,rw"
device: ":/mnt/data/mastodon/system" device: ":/mnt/data/mastodon/system"
redis:
driver_opts:
type: "nfs"
o: "addr=192.168.30.10,nolock,soft,rw"
device: ":/mnt/data/mastodon/redis"
services: services:
redis:
image: redis:7-alpine
networks:
mastodon:
aliases:
- redis
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- type: volume
source: redis
target: /data
volume:
nocopy: true
deploy:
placement:
constraints:
- "node.labels.mastodon == true"
web: web:
image: tootsuite/mastodon:v4.1 image: tootsuite/mastodon:v4.1
environment: environment:
- 'OTP_SECRET={{ otp_secret }}' - 'OTP_SECRET={{ otp_secret }}'
- 'SECRET_KEY_BASE={{ secret_key_base }}' - 'SECRET_KEY_BASE={{ secret_key_base }}'
- 'REDIS_HOST=thecloud.dmz' - 'REDIS_HOST=redis'
- 'REDIS_PASSWORD={{ mastodon_redis_password }}'
- 'DB_HOST=192.168.30.10' - 'DB_HOST=192.168.30.10'
- 'DB_USER=mastodon' - 'DB_USER=mastodon'
- 'DB_NAME=mastodon' - 'DB_NAME=mastodon'
@ -61,13 +84,14 @@ services:
- traefik.http.services.mastodon.loadbalancer.server.port=3000 - traefik.http.services.mastodon.loadbalancer.server.port=3000
- traefik.http.routers.mastodon.service=mastodon - traefik.http.routers.mastodon.service=mastodon
- traefik.docker.network=traefik - traefik.docker.network=traefik
depends_on:
- redis
streaming: streaming:
image: tootsuite/mastodon:v4.1 image: tootsuite/mastodon:v4.1
command: node ./streaming command: node ./streaming
environment: environment:
- 'REDIS_HOST=thecloud.dmz' - 'REDIS_HOST=redis'
- 'REDIS_PASSWORD={{ mastodon_redis_password }}'
- 'LOCAL_DOMAIN=social.pizzapim.nl' - 'LOCAL_DOMAIN=social.pizzapim.nl'
- 'DB_HOST=192.168.30.10' - 'DB_HOST=192.168.30.10'
- 'DB_USER=mastodon' - 'DB_USER=mastodon'
@ -92,14 +116,16 @@ services:
- traefik.http.routers.mastodon-streaming.tls=true - traefik.http.routers.mastodon-streaming.tls=true
- traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt - traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt
- traefik.docker.network=traefik - traefik.docker.network=traefik
depends_on:
- redis
sidekiq: sidekiq:
image: tootsuite/mastodon:v4.1 image: tootsuite/mastodon:v4.1
command: bundle exec sidekiq command: bundle exec sidekiq
environment: environment:
- 'OTP_SECRET={{ otp_secret }}' - 'OTP_SECRET={{ otp_secret }}'
- 'SECRET_KEY_BASE={{ secret_key_base }}' - 'SECRET_KEY_BASE={{ secret_key_base }}'
- 'REDIS_HOST=thecloud.dmz' - 'REDIS_HOST=redis'
- 'REDIS_PASSWORD={{ mastodon_redis_password }}'
- 'DB_HOST=192.168.30.10' - 'DB_HOST=192.168.30.10'
- 'DB_USER=mastodon' - 'DB_USER=mastodon'
- 'DB_NAME=mastodon' - 'DB_NAME=mastodon'
@ -121,3 +147,5 @@ services:
placement: placement:
constraints: constraints:
- "node.labels.mastodon == true" - "node.labels.mastodon == true"
depends_on:
- redis

View file

@ -6,16 +6,6 @@ mastodon_postgres_password: !vault |
3532316632613062310a343566393237363364613931353062636537663864383839623930383836 3532316632613062310a343566393237363364613931353062636537663864383839623930383836
32613634616335616462336261303632646266326663383166366236643438616538626263343835 32613634616335616462336261303632646266326663383166366236643438616538626263343835
6539616439636364626466333163316164633631616132623665 6539616439636364626466333163316164633631616132623665
mastodon_redis_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
32333531626630353438343331373139363731303264373336653162303431663231376565376662
3332383365313462373030383462653266656338623035390a646437653364366638653764613766
32346135353230343631643661653935366635666263383233626133623432643938633064346431
6162646335313965310a653831393364316530623331366166373032383063303237396266613335
31313537623161653731313736386539393830363566353234643263393761353061363839616131
66346561323062333933373635626463313731643666643462653964666439383264326166383466
36646338653139626234653339386637373639633931616365633536616230613239656664333832
61346132353364323330
otp_secret: !vault | otp_secret: !vault |
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
33303436663063313039636335623937343530323636346363306234333135306138653337313034 33303436663063313039636335623937343530323636346363306234333135306138653337313034