Files
selfhost_podman/nextcloud/nextcloud-entrypoint.sh
2025-10-26 15:52:14 +05:30

55 lines
1.5 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. #
#################################################################
# fix nextcloud not setting Local Time zone
apk add --no-cache tzdata
# default to UID=1000 if not set
TARGET_UID="${PUID:-1000}"
# add user as the su in image doesn't know user ID we will pass
adduser -D -u "${TARGET_UID}" "abc" || true
# 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/abc/g" /entrypoint.sh
# execute the patched entrypoint with all args
exec /entrypoint.sh php-fpm