Add default retention policy to containers

Docker makes it extremely difficult to do time-based retention,
unfortunately, so space-based is the best we'll be able to do. This is
probably fairly aggressive for bookwyrm.social, and not nearly
aggressive enough for smaller instances, but it's better than the
current status quo.

I've only tested that this builds and runs, not that it actually has the
intended effect.
This commit is contained in:
Wesley Aptekar-Cassels 2023-04-03 21:21:11 -04:00
parent 0c427eaf06
commit fe020b7c95

View file

@ -1,8 +1,16 @@
version: '3' version: '3'
x-logging:
&default-logging
driver: "json-file"
options:
max-size: "150m"
max-file: "2"
services: services:
nginx: nginx:
image: nginx:latest image: nginx:latest
logging: *default-logging
restart: unless-stopped restart: unless-stopped
ports: ports:
- "80:80" - "80:80"
@ -21,6 +29,7 @@ services:
image: certbot/certbot:latest image: certbot/certbot:latest
command: certonly --webroot --webroot-path=/var/www/certbot --email ${EMAIL} --agree-tos --no-eff-email -d ${DOMAIN} -d www.${DOMAIN} command: certonly --webroot --webroot-path=/var/www/certbot --email ${EMAIL} --agree-tos --no-eff-email -d ${DOMAIN} -d www.${DOMAIN}
#command: renew --webroot --webroot-path /var/www/certbot #command: renew --webroot --webroot-path /var/www/certbot
logging: *default-logging
volumes: volumes:
- ./certbot/conf:/etc/letsencrypt - ./certbot/conf:/etc/letsencrypt
- ./certbot/logs:/var/log/letsencrypt - ./certbot/logs:/var/log/letsencrypt
@ -39,6 +48,7 @@ services:
build: . build: .
env_file: .env env_file: .env
command: gunicorn bookwyrm.wsgi:application --bind 0.0.0.0:8000 command: gunicorn bookwyrm.wsgi:application --bind 0.0.0.0:8000
logging: *default-logging
volumes: volumes:
- .:/app - .:/app
- static_volume:/app/static - static_volume:/app/static
@ -54,6 +64,7 @@ services:
redis_activity: redis_activity:
image: redis image: redis
command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes --port ${REDIS_ACTIVITY_PORT} command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes --port ${REDIS_ACTIVITY_PORT}
logging: *default-logging
volumes: volumes:
- ./redis.conf:/etc/redis/redis.conf - ./redis.conf:/etc/redis/redis.conf
- redis_activity_data:/data - redis_activity_data:/data
@ -64,6 +75,7 @@ services:
redis_broker: redis_broker:
image: redis image: redis
command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes --port ${REDIS_BROKER_PORT} command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes --port ${REDIS_BROKER_PORT}
logging: *default-logging
volumes: volumes:
- ./redis.conf:/etc/redis/redis.conf - ./redis.conf:/etc/redis/redis.conf
- redis_broker_data:/data - redis_broker_data:/data
@ -77,6 +89,7 @@ services:
networks: networks:
- main - main
command: celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority,imports,broadcast command: celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority,imports,broadcast
logging: *default-logging
volumes: volumes:
- .:/app - .:/app
- static_volume:/app/static - static_volume:/app/static
@ -91,6 +104,7 @@ services:
networks: networks:
- main - main
command: celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler command: celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler
logging: *default-logging
volumes: volumes:
- .:/app - .:/app
- static_volume:/app/static - static_volume:/app/static
@ -101,6 +115,7 @@ services:
flower: flower:
build: . build: .
command: celery -A celerywyrm flower --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD} --url_prefix=flower command: celery -A celerywyrm flower --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD} --url_prefix=flower
logging: *default-logging
env_file: .env env_file: .env
volumes: volumes:
- .:/app - .:/app