redis. Adding persistence.

This commit is contained in:
Alexey Skobkin 2024-03-06 21:44:58 +03:00
parent ced3e5a902
commit fe61216f95
No known key found for this signature in database
GPG key ID: 5D5CEF6F221278E7
3 changed files with 11 additions and 6 deletions

View file

@ -1,7 +1,11 @@
# https://hub.docker.com/_/redis
# Uncomment to use directory binding instead of docker volume (almost always not needed)
#DATA_PATH=/some/path
HOST_DATA_DIR=./data
# https://redis.io/docs/management/persistence/#snapshotting
PERSISTENCE_PERIOD_SEC=60
PERSISTENCE_MIN_OPS=1
LOG_LEVEL=warning
LOG_MAX_SIZE=5m
LOG_MAX_FILE=5

2
redis/data/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/*
!/.gitignore

View file

@ -1,10 +1,13 @@
version: '3.7'
version: '3.8'
services:
redis:
# https://hub.docker.com/_/redis
image: redis:alpine
container_name: redis
command: "redis-server --save ${PERSISTENCE_PERIOD_SEC:-60} ${PERSISTENCE_MIN_OPS:-1} --loglevel ${LOG_LEVEL:-warning}"
volumes:
- "${HOST_DATA_DIR:-./data}:/data"
ports:
- "127.0.0.1:6379:6379/tcp"
env_file: .env
@ -14,7 +17,3 @@ services:
options:
max-size: "${LOG_MAX_SIZE:-5m}"
max-file: "${LOG_MAX_FILE:-5}"
#volumes:
# redis_data:
# name: redis_data