Files
selfhost_podman/nextcloud/nextcloud-entrypoint.sh
2025-10-02 13:39:40 +05:30

49 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
set -eu
####################
# My Special Sauce #
####################
#################################################################
# This script is to make the www-data in /entrypoint.sh to #
# any user specified by $PUID environment variable, #
# so that your nextcloud can run or update properly. #
#################################################################
# default to UID=1000 if not set
TARGET_UID="${PUID:-1000}"
# Overwrite /usr/local/etc/php-fpm.d/zz-docker.conf to make php-fpm listen on unix socket
cat << EOF > /usr/local/etc/php-fpm.d/zz-docker.conf
; Generated by /nextcloud-entrypoint.sh
; DO NOT EDIT THIS FILE, IT WILL BE OVERWRITTEN !!
; please make changes in the /nextcloud-entrypoint.sh script
[global]
daemonize = no
[www]
access.log = /tmp/fpm-access.log
listen = ${NEXTCLOUD_FPM_SOCK:-/tmp/docker/nextcloud-fpm.sock}
listen.owner = ${TARGET_UID}
listen.group = ${TARGET_UID}
; Restricting socket to owner and group only
listen.mode = 0660
user = ${TARGET_UID}
group = ${TARGET_UID}
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 15
pm.max_requests = 1000
EOF
# replace "www-data" with numeric $PUID in /entrypoint.sh
sed -i "s/www-data/${TARGET_UID}/g" /entrypoint.sh
# execute the patched entrypoint with all args
exec /entrypoint.sh php-fpm