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.
55 lines
1.9 KiB
55 lines
1.9 KiB
[Unit]
|
|
Description=Nextcloud Application - Initialization
|
|
Documentation=https://hub.docker.com/_/nextcloud/
|
|
After=network.target nextcloud-redis.service postgresql-server.service
|
|
Before=nextcloud-app.service
|
|
Requires=nextcloud-redis.service postgresql-server.service
|
|
|
|
# Only start if Nextcloud has been configured
|
|
ConditionPathExists=/etc/quadlets/nextcloud/config.env
|
|
# and NOT initialized (config.php does NOT exist)
|
|
ConditionPathExists=!/var/lib/quadlets/nextcloud/data/config/config.php
|
|
|
|
# Start/stop this unit when the target is started/stopped
|
|
#PartOf=nextcloud.target
|
|
|
|
[Container]
|
|
ContainerName=nextcloud-init-job
|
|
Image=docker.io/library/nextcloud:${NEXTCLOUD_MAJOR}-fpm-alpine
|
|
|
|
# Fix the UID/GID of the PHP-FPM daemon
|
|
User=82:82
|
|
|
|
# Network configuration
|
|
Network=host
|
|
|
|
# Environment variables from config
|
|
EnvironmentFile=/etc/quadlets/nextcloud/config.env
|
|
|
|
# This is specific to the initialization container
|
|
Environment=NEXTCLOUD_UPDATE=1
|
|
Exec=/bin/true
|
|
|
|
# Volume mounts
|
|
Volume=/var/lib/quadlets/nextcloud/data:/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
|
|
|
|
[Service]
|
|
Restart=no
|
|
TimeoutStartSec=600
|
|
|
|
# These environment variables are sourced to be used by systemd in the Exec* commands
|
|
EnvironmentFile=/etc/quadlets/nextcloud/config.env
|
|
|
|
# This container is a job - run once to completion
|
|
Type=oneshot
|
|
|
|
# Wait for PostgreSQL to be ready
|
|
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
|
|
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
|
|
|