0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-07-21 22:58:05 +02:00

Add nginx-unit server support

Signed-off-by: Alexander Olofsson <ace@haxalot.com>
This commit is contained in:
Alexander Olofsson 2021-10-14 14:48:26 +02:00 committed by Alexander Olofsson
parent dd663d60c6
commit a11a594a04
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
4 changed files with 361 additions and 2 deletions

View file

@ -17,24 +17,37 @@ declare -A cmd=(
[apache]='apache2-foreground'
[fpm]='php-fpm'
[fpm-alpine]='php-fpm'
[unit]='unitd --no-daemon'
)
declare -A base=(
[apache]='debian'
[fpm]='debian'
[fpm-alpine]='alpine'
[unit]='unit'
)
declare -A extras=(
[apache]='\nRUN a2enmod headers rewrite remoteip ; \\\n { \\\n echo '\''RemoteIPHeader X-Real-IP'\''; \\\n echo '\''RemoteIPInternalProxy 10.0.0.0/8'\''; \\\n echo '\''RemoteIPInternalProxy 172.16.0.0/12'\''; \\\n echo '\''RemoteIPInternalProxy 192.168.0.0/16'\''; \\\n } > /etc/apache2/conf-available/remoteip.conf; \\\n a2enconf remoteip\n\n# set apache config LimitRequestBody\nENV APACHE_BODY_LIMIT 1073741824\nRUN { \\\n echo '\''LimitRequestBody ${APACHE_BODY_LIMIT}'\''; \\\n } > /etc/apache2/conf-available/apache-limits.conf; \\\n a2enconf apache-limits'
[fpm]=''
[fpm-alpine]=''
[unit]=''
)
declare -A crontab_int=(
[default]='5'
)
unit_version="$(
git ls-remote --tags https://github.com/nginx/unit.git \
| cut -d/ -f3 \
| grep -v -- '-1' \
| grep -v '\^' \
| sed -E 's/^v//' \
| sort -V \
| tail -1
)"
apcu_version="$(
git ls-remote --tags https://github.com/krakjoe/apcu.git \
| cut -d/ -f3 \
@ -82,6 +95,7 @@ variants=(
apache
fpm
fpm-alpine
unit
)
min_version='28'
@ -91,6 +105,13 @@ function version_greater_or_equal() {
[[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" || "$1" == "$2" ]];
}
# joins a list of strings together with a delimiter
# join_by delim first rest...
function join_by() {
local delim=${1-} first=${2-}
shift 2 && printf %s "${first}" "${@/#/$delim}"
}
function create_variant() {
dir="$1/$variant"
alpineVersion=${alpine_version[$version]-${alpine_version[default]}}
@ -118,12 +139,13 @@ function create_variant() {
s/%%VERSION%%/'"$fullversion"'/g;
s/%%DOWNLOAD_URL%%/'"$(sed -e 's/[\/&]/\\&/g' <<< "$url")"'/g;
s/%%DOWNLOAD_URL_ASC%%/'"$(sed -e 's/[\/&]/\\&/g' <<< "$ascUrl")"'/g;
s/%%CMD%%/'"${cmd[$variant]}"'/g;
s/%%CMD%%/'"$(join_by '", "' ${cmd[$variant]})"'/g;
s|%%VARIANT_EXTRAS%%|'"${extras[$variant]}"'|g;
s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g;
s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g;
s/%%IMAGICK_VERSION%%/'"${pecl_versions[imagick]}"'/g;
s/%%UNIT_VERSION%%/'"${unit_version}"'/g;
s/%%CRONTAB_INT%%/'"$crontabInt"'/g;
' "$dir/Dockerfile"
@ -132,6 +154,11 @@ function create_variant() {
cp "docker-$name.sh" "$dir/$name.sh"
done
# Copy the nginx-unit configuration if unit variant.
if [ "$variant" == "unit" ]; then
cp nextcloud-unit.json "$dir/nextcloud-unit.json"
fi
# Copy the upgrade.exclude
cp upgrade.exclude "$dir/"