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.
69 lines
2.6 KiB
69 lines
2.6 KiB
[Unit]
|
|
Description=Nextcloud PHP-FPM Application
|
|
Documentation=https://hub.docker.com/_/nextcloud/
|
|
After=network.target nextcloud-redis.service postgresql-server.service nextcloud-init.service nextcloud-upgrade.service var-lib-virtiofs-data.mount
|
|
Requires=nextcloud-redis.service postgresql-server.service nextcloud-init.service nextcloud-upgrade.service var-lib-virtiofs-data.mount
|
|
|
|
# Only start if Nextcloud has been configured
|
|
ConditionPathExists=/etc/quadlets/nextcloud/config.env
|
|
# and initialized (config.php exists)
|
|
ConditionPathExists=/var/lib/virtiofs/data/nextcloud/config/config.php
|
|
|
|
# Start/stop this unit when the target is started/stopped
|
|
PartOf=nextcloud.target
|
|
|
|
[Container]
|
|
ContainerName=nextcloud-app
|
|
Image=docker.io/library/nextcloud:${NEXTCLOUD_MAJOR}-fpm-alpine
|
|
|
|
# No need for root privileges
|
|
User=www-data
|
|
Group=www-data
|
|
|
|
# UID/GID mapping to map the www-data (82) user inside the container to arbitrary user 10008 / group 10000 on the host
|
|
UIDMap=0:1000000:65535
|
|
UIDMap=+82:10008:1
|
|
GIDMap=0:1000000:65535
|
|
GIDMap=+82:10000:1
|
|
|
|
# Network configuration
|
|
Network=host
|
|
AddCapability=CAP_NET_BIND_SERVICE
|
|
|
|
# Allow Nextcloud to talk to itself through the same hostname as used by clients
|
|
AddHost=nextcloud:127.0.0.1
|
|
AddHost=collabora:127.0.0.1
|
|
|
|
# Environment variables from secrets and config
|
|
EnvironmentFile=/etc/quadlets/nextcloud/config.env
|
|
|
|
# Volume mounts
|
|
Volume=/var/lib/virtiofs/data/nextcloud:/var/www/html:z
|
|
Volume=/etc/quadlets/nextcloud/www.conf:/usr/local/etc/php-fpm.d/www.conf:Z
|
|
Volume=/run/quadlets/nextcloud/redis-session.ini:/usr/local/etc/php/conf.d/redis-session.ini:Z
|
|
Volume=/etc/quadlets/nextcloud/custom-noinit.sh:/docker-entrypoint-hooks.d/pre-installation/custom.sh:z,ro
|
|
|
|
# Health check (equivalent to readiness probe)
|
|
HealthCmd=nc -z localhost 9000
|
|
HealthInterval=30s
|
|
HealthTimeout=10s
|
|
HealthStartPeriod=60s
|
|
HealthRetries=3
|
|
|
|
[Service]
|
|
Restart=always
|
|
RestartSec=10
|
|
TimeoutStartSec=600
|
|
TimeoutStopSec=30
|
|
|
|
# These environment variables are sourced to be used by systemd in the Exec* commands
|
|
EnvironmentFile=/etc/quadlets/nextcloud/config.env
|
|
|
|
# Wait for PostgreSQL to be ready on localhost
|
|
ExecStartPre=/bin/sh -c 'exec 2>/dev/null; for try in $(seq 0 12); do if ! /bin/true 5<> /dev/tcp/127.0.0.1/5432; then echo "Waiting for PostgreSQL to be available..."; sleep 5; else exit 0; fi; done; exit 1'
|
|
|
|
# Wait for Redis to be ready on localhost
|
|
ExecStartPre=/bin/sh -c 'exec 2>/dev/null; for try in $(seq 0 12); do if ! /bin/true 5<> /dev/tcp/127.0.0.1/6379; then echo "Waiting for Redis to be available..."; sleep 5; else exit 0; fi; done; exit 1'
|
|
|
|
[Install]
|
|
WantedBy=nextcloud.target
|
|
|