You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
[Unit]
|
|
Description=Redis Cache for Nextcloud
|
|
Documentation=https://hub.docker.com/_/redis/
|
|
After=network.target
|
|
|
|
# Only start if Nextcloud has been configured
|
|
ConditionPathExists=/etc/quadlets/nextcloud/config.env
|
|
|
|
# Start/stop this unit when the target is started/stopped
|
|
PartOf=nextcloud.target
|
|
|
|
[Container]
|
|
ContainerName=nextcloud-redis
|
|
Image=docker.io/library/redis:${REDIS_MAJOR}-alpine
|
|
|
|
# Network configuration
|
|
Network=host
|
|
|
|
# Redis configuration with authentication
|
|
Exec=redis-server /usr/local/etc/redis/redis.conf
|
|
|
|
# No need for root privileges
|
|
User=redis
|
|
Group=redis
|
|
|
|
# UID/GID mapping to map the redis (999) user / redis (1000) group inside the container to arbitrary user 10008 / group 10000 on the host
|
|
UIDMap=0:1000000:999
|
|
UIDMap=999:10008:1
|
|
UIDMap=1000:1001000:64536
|
|
GIDMap=0:1000000:1000
|
|
GIDMap=1000:10000:1
|
|
GIDMap=1001:1001001:64535
|
|
|
|
# Environment variables
|
|
Environment=REDISCLI_AUTH=${REDIS_HOST_PASSWORD}
|
|
|
|
# Volume mounts for data persistence
|
|
Volume=/var/lib/quadlets/nextcloud/redis:/data:Z
|
|
Volume=/etc/quadlets/nextcloud/redis.conf:/usr/local/etc/redis/redis.conf:ro
|
|
|
|
# Health check
|
|
HealthCmd=redis-cli -t 5 ping | grep -qFx PONG
|
|
HealthInterval=30s
|
|
HealthTimeout=5s
|
|
HealthStartPeriod=10s
|
|
HealthRetries=3
|
|
|
|
[Service]
|
|
Restart=always
|
|
RestartSec=5
|
|
TimeoutStartSec=300
|
|
TimeoutStopSec=30
|
|
|
|
# These environment variables are sourced to be used by systemd in the Exec* commands
|
|
EnvironmentFile=/etc/quadlets/nextcloud/config.env
|
|
|
|
[Install]
|
|
WantedBy=nextcloud.target
|