diff --git a/Dockerfile b/Dockerfile index e5c68e17..0eb34d33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -106,7 +106,8 @@ ENV PUID=0 \ CLEAN=true \ FULLCLEAN=false \ PHP81=false \ - PHP82=false + PHP82=false \ + PHP83=false WORKDIR /app ENTRYPOINT ["tini", "--", "start.sh"] diff --git a/README.md b/README.md index ea955308..597a58dd 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ so that the barrier for entry here is low. - Access Log disabled - Error Log written to console - `Server` response header hidden -- PHP optional, with option to add extensions; available packages can be found [here](https://pkgs.alpinelinux.org/packages?branch=v3.18&repo=community&arch=x86_64&name=php81-*) and [here](https://pkgs.alpinelinux.org/packages?branch=v3.18&repo=community&arch=x86_64&name=php82-*) +- PHP 8.1/8.2/8.3 optional, with option to add extensions; available packages can added using envs in the compose file - Allows different acme servers/certbot config file (/opt/npm/tls/certbot/config.ini) - Supports up to 99 domains per cert - Brotli compression can be enabled @@ -128,15 +128,15 @@ location / { ``` b) Custom Nginx Configuration (advanced tab), which looks the following for file server and **php**: - Note: the slash at the end of the file path is important -- Note: first enable `PHP81` and/or `PHP82` inside your compose file -- Note: you can replace `fastcgi_pass php82;` with `fastcgi_pass` `php81`/`php82` `;` -- Note: to add more php extension use the packages from [here](https://pkgs.alpinelinux.org/packages?branch=v3.17&repo=community&arch=x86_64&name=php8*-*) and add them using the `PHP_APKS` env (see compose file) +- Note: first enable `PHP81`, `PHP82` and/or `PHP83` inside your compose file +- Note: you can replace `fastcgi_pass php81;` with `fastcgi_pass` `php82`/`php83` `;` +- Note: to add more php extension using envs you can set in the compose file ``` location / { alias /var/www//; location ~ [^/]\.php(/|$) { - fastcgi_pass php82; + fastcgi_pass php81; fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; diff --git a/compose.yaml b/compose.yaml index dcd70183..333a0e45 100644 --- a/compose.yaml +++ b/compose.yaml @@ -28,6 +28,9 @@ services: # - "CLEAN=false" # Clean folders, default true # - "FULLCLEAN=true" # Clean unused config folders, default false # - "PHP81=true" # Activate PHP81, default false -# - "PHP81_APKS=php81-curl php-81-curl" # Add php extensions, see available packages here: https://pkgs.alpinelinux.org/packages?branch=v3.18&repo=community&arch=x86_64&name=php81-*, default none +# - "PHP81_APKS=php81-curl php81-openssl" # Add php extensions, see available packages here: https://pkgs.alpinelinux.org/packages?branch=v3.19&repo=community&arch=x86_64&name=php81-*, default none # - "PHP82=true" # Activate PHP82, default false -# - "PHP82_APKS=php82-curl php-82-curl" # Add php extensions, see available packages here: https://pkgs.alpinelinux.org/packages?branch=v3.18&repo=community&arch=x86_64&name=php82-*, default none +# - "PHP82_APKS=php82-curl php-82openssl" # Add php extensions, see available packages here: https://pkgs.alpinelinux.org/packages?branch=v3.19&repo=community&arch=x86_64&name=php82-*, default none +# - "PHP83=true" # Activate PHP83, default false +# - "PHP83_APKS=php83-curl php83-openssl" # Add php extensions, see available packages here: https://pkgs.alpinelinux.org/packages?branch=v3.19&repo=community&arch=x86_64&name=php83-*, default none +# - "PHP_APKS=php-pecl-apcu php-pecl-redis" # Add php extensions, see available packages here: https://pkgs.alpinelinux.org/packages?branch=v3.19&repo=community&arch=x86_64&name=php-*, default none diff --git a/frontend/package.json b/frontend/package.json index cf712d12..038ad186 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -31,7 +31,7 @@ "nodemon": "3.0.2", "numeral": "2.0.6", "sass-loader": "10.5.2", - "style-loader": "3.3.3", + "style-loader": "3.3.4", "tabler-ui": "git+https://github.com/tabler/tabler.git#00f78ad823311bc3ad974ac3e5b0126198f0a813", "underscore": "1.13.6", "webpack": "4.47.0", diff --git a/rootfs/bin/cbr.sh b/rootfs/bin/cbr.sh deleted file mode 100755 index 892c9ef8..00000000 --- a/rootfs/bin/cbr.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -while [ "$(healthcheck.sh)" != "OK" ]; do sleep 10s; done -certbot --logs-dir /tmp/certbot-log --work-dir /tmp/certbot-work --config-dir /data/tls/certbot renew --quiet --config "/data/tls/certbot/config.ini" --preferred-challenges "dns,http" --no-random-sleep-on-renew diff --git a/rootfs/bin/healthcheck.sh b/rootfs/bin/healthcheck.sh index 4227cd17..d016318d 100755 --- a/rootfs/bin/healthcheck.sh +++ b/rootfs/bin/healthcheck.sh @@ -16,7 +16,7 @@ if [ "$NPM_IPV6_BINDING" != "[::]" ] && [ "$NPM_IPV4_BINDING" != "0.0.0.0" ]; th fi fi -if (if [ "$PHP81" = true ]; then cgi-fcgi -bind -connect /dev/php81.sock > /dev/null 2>&1; fi && if [ "$PHP82" = true ]; then cgi-fcgi -bind -connect /dev/php82.sock > /dev/null 2>&1; fi && [ "$(curl -sk https://"$HC_IP":"$NPM_PORT"/api/ | jq --raw-output .status)" = "OK" ]); then +if (if [ "$PHP81" = true ]; then cgi-fcgi -bind -connect /dev/php81.sock > /dev/null 2>&1; fi && if [ "$PHP82" = true ]; then cgi-fcgi -bind -connect /dev/php82.sock > /dev/null 2>&1; fi && if [ "$PHP83" = true ]; then cgi-fcgi -bind -connect /dev/php83.sock > /dev/null 2>&1; fi && [ "$(curl -sk https://"$HC_IP":"$NPM_PORT"/api/ | jq --raw-output .status)" = "OK" ]); then echo "OK" exit 0 else diff --git a/rootfs/bin/launch.sh b/rootfs/bin/launch.sh index 6b78759e..fd677989 100755 --- a/rootfs/bin/launch.sh +++ b/rootfs/bin/launch.sh @@ -36,8 +36,15 @@ if [ "$PHP82" = "true" ]; then fi fi +if [ "$PHP83" = "true" ]; then + if ! PHP_INI_SCAN_DIR=/data/php/83/conf.d php-fpm83 -c /data/php/83 -y /data/php/83/php-fpm.conf -FORt > /dev/null 2>&1; then + PHP_INI_SCAN_DIR=/data/php/83/conf.d php-fpm83 -c /data/php/83 -y /data/php/83/php-fpm.conf -FORt + sleep inf + fi +fi + if [ "$PHP81" = "true" ]; then PHP_INI_SCAN_DIR=/data/php/81/conf.d php-fpm81 -c /data/php/81 -y /data/php/81/php-fpm.conf -FOR; fi & if [ "$PHP82" = "true" ]; then PHP_INI_SCAN_DIR=/data/php/82/conf.d php-fpm82 -c /data/php/82 -y /data/php/82/php-fpm.conf -FOR; fi & -cbr.sh & +if [ "$PHP83" = "true" ]; then PHP_INI_SCAN_DIR=/data/php/83/conf.d php-fpm83 -c /data/php/83 -y /data/php/83/php-fpm.conf -FOR; fi & aio.sh & index.js diff --git a/rootfs/bin/start.sh b/rootfs/bin/start.sh index 595af4d3..d826c17a 100755 --- a/rootfs/bin/start.sh +++ b/rootfs/bin/start.sh @@ -152,13 +152,9 @@ if [ "$NPM_LISTEN_LOCALHOST" = "true" ]; then fi -if [ "$PHP81" = "true" ] || [ "$PHP82" = "true" ]; then - apk add --no-cache fcgi -fi - if [ "$PHP81" = "true" ]; then -apk add --no-cache php81-fpm + apk add --no-cache php81-fpm # From https://github.com/nextcloud/all-in-one/pull/1377/files if [ -n "$PHP81_APKS" ]; then @@ -190,7 +186,7 @@ fi if [ "$PHP82" = "true" ]; then -apk add --no-cache php82-fpm + apk add --no-cache php82-fpm # From https://github.com/nextcloud/all-in-one/pull/1377/files if [ -n "$PHP82_APKS" ]; then @@ -220,6 +216,63 @@ elif [ "$FULLCLEAN" = "true" ]; then rm -vrf /data/php/82 fi +if [ "$PHP83" = "true" ]; then + + apk add --no-cache php83-fpm + + # From https://github.com/nextcloud/all-in-one/pull/1377/files + if [ -n "$PHP83_APKS" ]; then + for apk in $(echo "$PHP83_APKS" | tr " " "\n"); do + + if ! echo "$apk" | grep -q "^php83-.*$"; then + echo "$apk is a non allowed value." + echo "It needs to start with \"php83-\"." + echo "It is set to \"$apk\"." + sleep inf + fi + + echo "Installing $apk via apk..." + if ! apk add --no-cache "$apk" > /dev/null 2>&1; then + echo "The apk \"$apk\" was not installed!" + fi + + done + fi + + mkdir -vp /data/php + cp -vrnT /etc/php83 /data/php/83 + sed -i "s|listen =.*|listen = /run/php83.sock|" /data/php/83/php-fpm.d/www.conf + sed -i "s|include=.*|include=/data/php/83/php-fpm.d/*.conf|g" /data/php/83/php-fpm.conf + +elif [ "$FULLCLEAN" = "true" ]; then + rm -vrf /data/php/83 +fi + +if [ "$PHP81" = "true" ] || [ "$PHP82" = "true" ] || [ "$PHP83" = "true" ]; then + + apk add --no-cache fcgi + + # From https://github.com/nextcloud/all-in-one/pull/1377/files + if [ -n "$PHP_APKS" ]; then + for apk in $(echo "$PHP_APKS" | tr " " "\n"); do + + if ! echo "$apk" | grep -q "^php-.*$"; then + echo "$apk is a non allowed value." + echo "It needs to start with \"php-\"." + echo "It is set to \"$apk\"." + sleep inf + fi + + echo "Installing $apk via apk..." + if ! apk add --no-cache "$apk" > /dev/null 2>&1; then + echo "The apk \"$apk\" was not installed!" + fi + + done + fi +fi + + mkdir -p /tmp/acme-challenge \ /tmp/certbot-work \ /tmp/certbot-log \ @@ -320,7 +373,7 @@ if [ -s "$DB_SQLITE_FILE" ]; then fi if [ "$FULLCLEAN" = "true" ]; then - if [ "$PHP81" != "true" ] && [ "$PHP82" != "true" ]; then + if [ "$PHP81" != "true" ] && [ "$PHP82" != "true" ] && [ "$PHP83" != "true" ]; then rm -vrf /data/php fi fi @@ -652,6 +705,10 @@ if [ "$PUID" != "0" ]; then sed -i "s|user =.*|;user = root|" /data/php/82/php-fpm.d/www.conf sed -i "s|group =.*|;group = root|" /data/php/82/php-fpm.d/www.conf fi + if [ "$PHP83" = "true" ]; then + sed -i "s|user =.*|;user = root|" /data/php/83/php-fpm.d/www.conf + sed -i "s|group =.*|;group = root|" /data/php/83/php-fpm.d/www.conf + fi sed -i "s|user root;|#user root;|g" /usr/local/nginx/conf/nginx.conf sudo -Eu npm launch.sh else @@ -668,6 +725,10 @@ else sed -i "s|;user =.*|user = root|" /data/php/82/php-fpm.d/www.conf sed -i "s|;group =.*|group = root|" /data/php/82/php-fpm.d/www.conf fi + if [ "$PHP83" = "true" ]; then + sed -i "s|;user =.*|user = root|" /data/php/83/php-fpm.d/www.conf + sed -i "s|;group =.*|group = root|" /data/php/83/php-fpm.d/www.conf + fi sed -i "s|#user root;|user root;|g" /usr/local/nginx/conf/nginx.conf launch.sh fi diff --git a/rootfs/usr/local/nginx/conf/nginx.conf b/rootfs/usr/local/nginx/conf/nginx.conf index 6b0cab93..37248bc3 100644 --- a/rootfs/usr/local/nginx/conf/nginx.conf +++ b/rootfs/usr/local/nginx/conf/nginx.conf @@ -81,6 +81,10 @@ http { server unix:/run/php82.sock; } + upstream php83 { + server unix:/run/php83.sock; + } + # Fancy Index fancyindex on; fancyindex_localtime on;