From 26f0b1228eb397f416b415ba7dd8418b6a74fd67 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Tue, 8 Nov 2022 22:03:06 +0000 Subject: [PATCH 01/14] Rebase to Alpine 3.16, migrate to s6v3, fix awfulness --- Dockerfile | 9 +-- Dockerfile.aarch64 | 9 +-- Dockerfile.armhf | 13 ++-- README.md | 20 +++--- readme-vars.yml | 21 ++---- .../nginx/site-confs/default.conf.sample | 2 +- root/etc/cont-init.d/40-install | 33 ---------- .../dependencies.d/init-piwigo-config | 0 .../dependencies.d/init-config | 0 .../s6-overlay/s6-rc.d/init-piwigo-config/run | 64 +++++++++++++++++++ .../s6-rc.d/init-piwigo-config/type | 1 + .../s6-overlay/s6-rc.d/init-piwigo-config/up | 1 + .../user/contents.d/init-piwigo-config | 0 13 files changed, 101 insertions(+), 72 deletions(-) delete mode 100644 root/etc/cont-init.d/40-install create mode 100644 root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-piwigo-config create mode 100644 root/etc/s6-overlay/s6-rc.d/init-piwigo-config/dependencies.d/init-config create mode 100755 root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run create mode 100644 root/etc/s6-overlay/s6-rc.d/init-piwigo-config/type create mode 100644 root/etc/s6-overlay/s6-rc.d/init-piwigo-config/up create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-piwigo-config diff --git a/Dockerfile b/Dockerfile index 2d7906b..764a1d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.16 # set version label ARG BUILD_DATE @@ -10,7 +10,6 @@ LABEL maintainer="sparklyballs" RUN \ echo "**** install packages ****" && \ apk add --no-cache --upgrade \ - curl \ exiftool \ ffmpeg \ imagemagick \ @@ -43,10 +42,12 @@ RUN \ PIWIGO_RELEASE=$(curl -sX GET "https://api.github.com/repos/Piwigo/Piwigo/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - mkdir /piwigo && \ + mkdir -p /app/www/public && \ curl -o \ - /piwigo/piwigo.zip -L \ + /tmp/piwigo.zip -L \ "https://piwigo.org/download/dlcounter.php?code=${PIWIGO_RELEASE}" && \ + unzip -q /tmp/piwigo.zip -d /tmp && \ + mv /tmp/piwigo/* /app/www/public && \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index f008f5b..90cb6fb 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.16 # set version label ARG BUILD_DATE @@ -10,7 +10,6 @@ LABEL maintainer="sparklyballs" RUN \ echo "**** install packages ****" && \ apk add --no-cache --upgrade \ - curl \ exiftool \ ffmpeg \ imagemagick \ @@ -43,10 +42,12 @@ RUN \ PIWIGO_RELEASE=$(curl -sX GET "https://api.github.com/repos/Piwigo/Piwigo/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - mkdir /piwigo && \ + mkdir -p /app/www/public && \ curl -o \ - /piwigo/piwigo.zip -L \ + /tmp/piwigo.zip -L \ "https://piwigo.org/download/dlcounter.php?code=${PIWIGO_RELEASE}" && \ + unzip -q /tmp/piwigo.zip -d /tmp && \ + mv /tmp/piwigo/* /app/www/public && \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 26fd428..2507fba 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.16 # set version label ARG BUILD_DATE @@ -10,7 +10,6 @@ LABEL maintainer="sparklyballs" RUN \ echo "**** install packages ****" && \ apk add --no-cache --upgrade \ - curl \ exiftool \ ffmpeg \ imagemagick \ @@ -40,13 +39,15 @@ RUN \ php8-pecl-xmlrpc && \ echo "**** download piwigo ****" && \ if [ -z ${PIWIGO_RELEASE+x} ]; then \ - PIWIGO_RELEASE=$(curl -sX GET "https://api.github.com/repos/Piwigo/Piwigo/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + PIWIGO_RELEASE=$(curl -sX GET "https://api.github.com/repos/Piwigo/Piwigo/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - mkdir /piwigo && \ + mkdir -p /app/www/public && \ curl -o \ - /piwigo/piwigo.zip -L \ + /tmp/piwigo.zip -L \ "https://piwigo.org/download/dlcounter.php?code=${PIWIGO_RELEASE}" && \ + unzip -q /tmp/piwigo.zip -d /tmp && \ + mv /tmp/piwigo/* /app/www/public && \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize diff --git a/README.md b/README.md index ab25696..cf86572 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,11 @@ The architectures supported by this image are: ## Application Setup -Docker image update and recreation of container alone won't update Piwigo version. In order to update Piwigo version, firstly make sure you are using the latest docker image, then go to Admin->Tools->Updates and use the app updater. -* You must create a user and database for piwigo to use in a mysql/mariadb server. -* In the setup page for database, use the ip address rather than hostname. -* A basic nginx configuration file can be found in `/config/nginx/site-confs`, edit the file to enable ssl (port 443 by default), set servername etc. +* You must create a user and database for piwigo to use in a mysql/mariadb server. + * Self-signed keys are generated the first time you run the container and can be found in `/config/keys`, if needed, you can replace them with your own. -* The easiest way to edit the configuration file is to enable local files editor from the plugins page and use it to configure email settings etc. + +* The easiest way to edit the configuration file is to enable local files editor from the plugins page and use it to configure email settings etc." ## Usage @@ -85,8 +84,8 @@ services: - PGID=1000 - TZ=Europe/London volumes: - - :/config - - :/gallery + - /path/to/appdata/config:/config + - /path/to/appdata/gallery:/gallery ports: - 80:80 restart: unless-stopped @@ -101,8 +100,8 @@ docker run -d \ -e PGID=1000 \ -e TZ=Europe/London \ -p 80:80 \ - -v :/config \ - -v :/gallery \ + -v /path/to/appdata/config:/config \ + -v /path/to/appdata/gallery:/gallery \ --restart unless-stopped \ lscr.io/linuxserver/piwigo:latest ``` @@ -118,7 +117,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. | | `-v /config` | Configuration files. | -| `-v /gallery` | Image, plugin, & theme storage for Piwigo | +| `-v /gallery` | Image storage for Piwigo | ## Environment variables from files (Docker secrets) @@ -229,6 +228,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **08.11.22:** - Rebase to Alpine 3.16, migrate to s6v3. Move application install to /app/www/public, add migration for existing users. Container updates should now update the application correctly. * **20.08.22:** - Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)). * **29.06.21:** - Rebase to 3.14, Add php7-zip package * **20.05.21:** - Create separate volume for image data diff --git a/readme-vars.yml b/readme-vars.yml index e78c179..0fac460 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -21,31 +21,24 @@ param_env_vars: - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London." } param_usage_include_vols: true param_volumes: - - { vol_path: "/config", vol_host_path: "", desc: "Configuration files." } - - { vol_path: "/gallery", vol_host_path: "", desc: "Image, plugin, & theme storage for Piwigo" } + - { vol_path: "/config", vol_host_path: "/path/to/appdata/config", desc: "Configuration files." } + - { vol_path: "/gallery", vol_host_path: "/path/to/appdata/gallery", desc: "Image storage for Piwigo" } param_usage_include_ports: true param_ports: - { external_port: "80", internal_port: "80", port_desc: "Application WebUI" } # application setup block app_setup_block_enabled: true -app_setup_block: "Docker image update and recreation of container alone won't update Piwigo version. In order to update Piwigo version, firstly make sure you are using the latest docker image, then go to Admin->Tools->Updates and use the app updater. +app_setup_block: | + * You must create a user and database for piwigo to use in a mysql/mariadb server. -* You must create a user and database for piwigo to use in a mysql/mariadb server. + * Self-signed keys are generated the first time you run the container and can be found in `/config/keys`, if needed, you can replace them with your own. -* In the setup page for database, use the ip address rather than hostname. - -* A basic nginx configuration file can be found in `/config/nginx/site-confs`, edit the file to enable ssl (port 443 by default), set servername etc. - -* Self-signed keys are generated the first time you run the container and can be found in `/config/keys`, if needed, you can replace them with your own. - -* The easiest way to edit the configuration file is to enable local files editor from the plugins page and use it to configure email settings etc." - -app_setup_nginx_reverse_proxy_snippet: false -app_setup_nginx_reverse_proxy_block: "" + * The easiest way to edit the configuration file is to enable local files editor from the plugins page and use it to configure email settings etc." # changelog changelogs: + - { date: "08.11.22:", desc: "Rebase to Alpine 3.16, migrate to s6v3. Move application install to /app/www/public, add migration for existing users. Container updates should now update the application correctly." } - { date: "20.08.22:", desc: "Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base))." } - { date: "29.06.21:", desc: "Rebase to 3.14, Add php7-zip package" } - { date: "20.05.21:", desc: "Create separate volume for image data" } diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 3c045c1..a04cc27 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -9,7 +9,7 @@ server { server_name _; - root /config/www/gallery; + root /app/www/public; index index.html index.htm index.php; location / { diff --git a/root/etc/cont-init.d/40-install b/root/etc/cont-init.d/40-install deleted file mode 100644 index 6d7f504..0000000 --- a/root/etc/cont-init.d/40-install +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/with-contenv bash - -# make our folders -mkdir -p \ - /gallery - -# install piwigo -if [ ! -f "/config/www/gallery/index.php" ] && [ ! -f "/gallery/index.php" ]; then - unzip -q /piwigo/piwigo.zip -d /tmp - mv /tmp/piwigo/* /gallery - rm -rf /tmp/piwigo -fi - -# copy config -if [ ! -f "/config/www/gallery/local/config/config.inc.php" ] && [ ! -f "/gallery/local/config/config.inc.php" ]; then - cp /gallery/include/config_default.inc.php /gallery/local/config/config.inc.php -fi - - -if [ ! -d "/config/www/gallery" ]; then - ln -s /gallery /config/www/gallery -fi - -if [[ -d /gallery ]]; then - if [[ "$(stat -c '%U' /gallery)" != "abc" ]]; then - chown -R abc:abc /gallery - fi -fi - -# permissions -chown -R abc:abc \ - /config - diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-piwigo-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-piwigo-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/dependencies.d/init-config b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/dependencies.d/init-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run new file mode 100755 index 0000000..5fb19af --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -0,0 +1,64 @@ +#!/usr/bin/with-contenv bash + +# make our folders +mkdir -p \ + /config/www/piwigo/_data \ + /gallery/upload + +# Migrate old data +if [[ -f /gallery/index.php ]]; then + echo "*******************************************************************************" + echo "" + echo "Migrating old install..." + mv /gallery/_data/ /config/www/piwigo/_data + mv /gallery/language/ /config/www/piwigo/language + mv /gallery/plugins/ /config/www/piwigo/plugins + mv /gallery/themes/ /config/www/piwigo/themes + mv /gallery/local/ /config/www/piwigo/local + rm /gallery/index.php + rm /config/www/gallery + sed -i "s|root /config/www/gallery;|root /app/www/public;|" /config/nginx/site-confs/default.conf + echo "Migration completed." + echo "You can now safely delete everything in /gallery *except* for the upload folder" + echo "" + echo "*******************************************************************************" +fi + +rm -rf /app/www/public/upload +ln -s /gallery/upload /app/www/public/upload +rm -rf /app/www/public/_data +ln -s /config/www/piwigo/_data /app/www/public/_data + +shopt -s globstar dotglob + +symlinks=( \ +/app/www/public/language \ +/app/www/public/plugins \ +/app/www/public/local \ +/app/www/public/themes \ +) + +for i in "${symlinks[@]}"; do +if [[ -d /config/www/piwigo/"$(basename "$i")" && ! -L "$i" ]]; then + rm -rf "$i" +fi +if [[ ! -d /config/www/piwigo/"$(basename "$i")" && ! -L "$i" ]]; then + mv "$i" /config/www/piwigo/ +fi +if [[ -d /config/www/piwigo/"$(basename "$i")" && ! -L "$i" ]]; then + ln -s /config/www/piwigo/"$(basename "$i")" "$i" +fi +done + +shopt -u globstar dotglob + +# copy config +if [[ ! -f "/config/www/piwigo/local/config/config.inc.php" ]]; then + cp /app/www/public/include/config_default.inc.php /config/www/piwigo/local/config/config.inc.php +fi + +# permissions +chown -R abc:abc \ + /config \ + /app \ + /gallery diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/type b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/up b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/up new file mode 100644 index 0000000..d252e03 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-piwigo-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-piwigo-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-piwigo-config new file mode 100644 index 0000000..e69de29 From 52406c73673e777a926a76a5f97e6e24e8f56542 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Tue, 8 Nov 2022 22:03:53 +0000 Subject: [PATCH 02/14] Fix mkdir path --- root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run index 5fb19af..874e376 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -2,7 +2,7 @@ # make our folders mkdir -p \ - /config/www/piwigo/_data \ + /config/www/piwigo \ /gallery/upload # Migrate old data From 4cbe20b87d621ebd018d1ec1dceab90aefc1a5d1 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Tue, 8 Nov 2022 22:15:20 +0000 Subject: [PATCH 03/14] Tidy up symlinking --- root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run index 874e376..ba57f8e 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -26,8 +26,6 @@ fi rm -rf /app/www/public/upload ln -s /gallery/upload /app/www/public/upload -rm -rf /app/www/public/_data -ln -s /config/www/piwigo/_data /app/www/public/_data shopt -s globstar dotglob @@ -36,6 +34,7 @@ symlinks=( \ /app/www/public/plugins \ /app/www/public/local \ /app/www/public/themes \ +/app/www/public/_data \ ) for i in "${symlinks[@]}"; do From 06f97b4539b482eac806b4eef3a3960740785af2 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 9 Nov 2022 09:12:45 +0000 Subject: [PATCH 04/14] Use nginx conf from base --- .../nginx/site-confs/default.conf.sample | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 root/defaults/nginx/site-confs/default.conf.sample diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample deleted file mode 100644 index a04cc27..0000000 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ /dev/null @@ -1,34 +0,0 @@ -## Version 2022/08/20 - Changelog: https://github.com/linuxserver/docker-piwigo/commits/master/root/defaults/nginx/site-confs/default.conf.sample - -server { - listen 80 default_server; - listen [::]:80 default_server; - - listen 443 ssl http2 default_server; - listen [::]:443 ssl http2 default_server; - - server_name _; - - root /app/www/public; - index index.html index.htm index.php; - - location / { - # enable for basic auth - #auth_basic "Restricted"; - #auth_basic_user_file /config/nginx/.htpasswd; - - try_files $uri $uri/ /index.html /index.php$is_args$args =404; - } - - location ~ ^(.+\.php)(.*)$ { - fastcgi_split_path_info ^(.+\.php)(.*)$; - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - include /etc/nginx/fastcgi_params; - } - - # deny access to .htaccess/.htpasswd files - location ~ /\.ht { - deny all; - } -} From 553a78c0e4fd9d6354967e9b8d78709b1d89c54f Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 9 Nov 2022 14:11:12 +0000 Subject: [PATCH 05/14] Add galleries to /gallery symlinks --- root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run index ba57f8e..f87111d 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -3,7 +3,8 @@ # make our folders mkdir -p \ /config/www/piwigo \ - /gallery/upload + /gallery/upload \ + /gallery/galleries # Migrate old data if [[ -f /gallery/index.php ]]; then @@ -19,13 +20,16 @@ if [[ -f /gallery/index.php ]]; then rm /config/www/gallery sed -i "s|root /config/www/gallery;|root /app/www/public;|" /config/nginx/site-confs/default.conf echo "Migration completed." - echo "You can now safely delete everything in /gallery *except* for the upload folder" + echo "" + echo "You can now safely delete everything in /gallery *except*" + echo "for the upload and galleries directories" echo "" echo "*******************************************************************************" fi -rm -rf /app/www/public/upload +rm -rf /app/www/public/{upload,galleries} ln -s /gallery/upload /app/www/public/upload +ln -s /gallery/galleries /app/www/public/galleries shopt -s globstar dotglob From b6451cf78fdb64057c6d2c505b5a6b203e2efafe Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 9 Nov 2022 14:19:05 +0000 Subject: [PATCH 06/14] Use /config/www/gallery as the migration check --- root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run index f87111d..7ee6994 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -7,7 +7,7 @@ mkdir -p \ /gallery/galleries # Migrate old data -if [[ -f /gallery/index.php ]]; then +if [[ -f /config/www/gallery ]]; then echo "*******************************************************************************" echo "" echo "Migrating old install..." From cc39bc88517a7ba89ed2c2d0b851c2ce0077575f Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 9 Nov 2022 14:39:51 +0000 Subject: [PATCH 07/14] Remove lynx --- Dockerfile | 1 - Dockerfile.aarch64 | 1 - Dockerfile.armhf | 1 - 3 files changed, 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 764a1d8..08616bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,6 @@ RUN \ ffmpeg \ imagemagick \ libjpeg-turbo-utils \ - lynx \ mediainfo \ php8-apcu \ php8-cgi \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 90cb6fb..4586a5f 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -14,7 +14,6 @@ RUN \ ffmpeg \ imagemagick \ libjpeg-turbo-utils \ - lynx \ mediainfo \ php8-apcu \ php8-cgi \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 2507fba..ff35025 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -14,7 +14,6 @@ RUN \ ffmpeg \ imagemagick \ libjpeg-turbo-utils \ - lynx \ mediainfo \ php8-apcu \ php8-cgi \ From ce1008c48a2b4fe71b25df847d5b5d8fd12b114e Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 9 Nov 2022 14:40:05 +0000 Subject: [PATCH 08/14] Fix check as it's actually a link not a file. --- root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run index 7ee6994..1d4a298 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -7,7 +7,7 @@ mkdir -p \ /gallery/galleries # Migrate old data -if [[ -f /config/www/gallery ]]; then +if [[ -L /config/www/gallery ]]; then echo "*******************************************************************************" echo "" echo "Migrating old install..." From 512e3aeb3b74af92b1e097517121768f9302f170 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 9 Nov 2022 15:00:08 +0000 Subject: [PATCH 09/14] Add cleanup to end of build, remove unzip & wget as they're part of busybox --- Dockerfile | 9 +++++---- Dockerfile.aarch64 | 9 +++++---- Dockerfile.armhf | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 08616bf..c8fed4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,9 +30,7 @@ RUN \ php8-xsl \ php8-zip \ poppler-utils \ - re2c \ - unzip \ - wget && \ + re2c && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ php8-pecl-xmlrpc && \ @@ -50,7 +48,10 @@ RUN \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize - sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini + sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini && \ + echo "**** cleanup ****" && \ + rm -rf \ + /tmp/* # copy local files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 4586a5f..5cd9aab 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -30,9 +30,7 @@ RUN \ php8-xsl \ php8-zip \ poppler-utils \ - re2c \ - unzip \ - wget && \ + re2c && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ php8-pecl-xmlrpc && \ @@ -50,7 +48,10 @@ RUN \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize - sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini + sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini && \ + echo "**** cleanup ****" && \ + rm -rf \ + /tmp/* # copy local files COPY root/ / diff --git a/Dockerfile.armhf b/Dockerfile.armhf index ff35025..04d26b9 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -30,9 +30,7 @@ RUN \ php8-xsl \ php8-zip \ poppler-utils \ - re2c \ - unzip \ - wget && \ + re2c && \ apk add --no-cache \ --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ php8-pecl-xmlrpc && \ @@ -50,7 +48,10 @@ RUN \ # The max filesize is 2M by default, which is way to small for most photos sed -ri 's/^upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php8/php.ini && \ # The max post size is 8M by default, it must be at least max_filesize - sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini + sed -ri 's/^post_max_size = .*/post_max_size = 100M/' /etc/php8/php.ini && \ + echo "**** cleanup ****" && \ + rm -rf \ + /tmp/* # copy local files COPY root/ / From e04d2d83fca7cd56c907241ad38440871867f4ff Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 9 Nov 2022 19:54:04 +0000 Subject: [PATCH 10/14] Update maintainer --- Dockerfile | 2 +- Dockerfile.aarch64 | 2 +- Dockerfile.armhf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c8fed4c..0b3718d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG BUILD_DATE ARG VERSION ARG PIWIGO_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="thespad" RUN \ echo "**** install packages ****" && \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 5cd9aab..b481877 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -5,7 +5,7 @@ ARG BUILD_DATE ARG VERSION ARG PIWIGO_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="thespad" RUN \ echo "**** install packages ****" && \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 04d26b9..072bf9f 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -5,7 +5,7 @@ ARG BUILD_DATE ARG VERSION ARG PIWIGO_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="sparklyballs" +LABEL maintainer="thespad" RUN \ echo "**** install packages ****" && \ From 3f759d26ddc2eebe657570be6046936ab3962c95 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Thu, 10 Nov 2022 11:32:59 +0000 Subject: [PATCH 11/14] Move piwigo down one directory level in /config, switch to lsiown --- .../s6-overlay/s6-rc.d/init-piwigo-config/run | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run index 1d4a298..29405b5 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -2,20 +2,20 @@ # make our folders mkdir -p \ - /config/www/piwigo \ + /config/www \ /gallery/upload \ /gallery/galleries # Migrate old data -if [[ -L /config/www/gallery ]]; then +if [[ -f /gallery/index.php ]]; then echo "*******************************************************************************" echo "" echo "Migrating old install..." - mv /gallery/_data/ /config/www/piwigo/_data - mv /gallery/language/ /config/www/piwigo/language - mv /gallery/plugins/ /config/www/piwigo/plugins - mv /gallery/themes/ /config/www/piwigo/themes - mv /gallery/local/ /config/www/piwigo/local + mv /gallery/_data/ /config/www/_data + mv /gallery/language/ /config/www/language + mv /gallery/plugins/ /config/www/plugins + mv /gallery/themes/ /config/www/themes + mv /gallery/local/ /config/www/local rm /gallery/index.php rm /config/www/gallery sed -i "s|root /config/www/gallery;|root /app/www/public;|" /config/nginx/site-confs/default.conf @@ -42,26 +42,26 @@ symlinks=( \ ) for i in "${symlinks[@]}"; do -if [[ -d /config/www/piwigo/"$(basename "$i")" && ! -L "$i" ]]; then +if [[ -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then rm -rf "$i" fi -if [[ ! -d /config/www/piwigo/"$(basename "$i")" && ! -L "$i" ]]; then - mv "$i" /config/www/piwigo/ +if [[ ! -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then + mv "$i" /config/www/ fi -if [[ -d /config/www/piwigo/"$(basename "$i")" && ! -L "$i" ]]; then - ln -s /config/www/piwigo/"$(basename "$i")" "$i" +if [[ -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then + ln -s /config/www/"$(basename "$i")" "$i" fi done shopt -u globstar dotglob # copy config -if [[ ! -f "/config/www/piwigo/local/config/config.inc.php" ]]; then - cp /app/www/public/include/config_default.inc.php /config/www/piwigo/local/config/config.inc.php +if [[ ! -f "/config/www/local/config/config.inc.php" ]]; then + cp /app/www/public/include/config_default.inc.php /config/www/local/config/config.inc.php fi # permissions -chown -R abc:abc \ +lsiown -R abc:abc \ /config \ /app \ /gallery From 5d3e13d46e752c52a97a8a8fc4efcdd6bda8763e Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 16 Nov 2022 19:50:38 +0000 Subject: [PATCH 12/14] Check gallery locations aren't symlinked before deletion --- .../s6-overlay/s6-rc.d/init-piwigo-config/run | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run index 29405b5..7941012 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -27,12 +27,22 @@ if [[ -f /gallery/index.php ]]; then echo "*******************************************************************************" fi -rm -rf /app/www/public/{upload,galleries} -ln -s /gallery/upload /app/www/public/upload -ln -s /gallery/galleries /app/www/public/galleries - shopt -s globstar dotglob +symlinks=( \ +/app/www/public/upload \ +/app/www/public/galleries \ +) + +for i in "${symlinks[@]}"; do +if [[ -d /gallery/"$(basename "$i")" && ! -L "$i" ]]; then + rm -rf "$i" +fi +if [[ -d /gallery/"$(basename "$i")" && ! -L "$i" ]]; then + ln -s /gallery/"$(basename "$i")" "$i" +fi +done + symlinks=( \ /app/www/public/language \ /app/www/public/plugins \ From f4f288985f29feca3715df5521aa23ff0f53d424 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 16 Nov 2022 19:53:41 +0000 Subject: [PATCH 13/14] Provide better migration feedback --- root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run index 7941012..f2e88ad 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-piwigo-config/run @@ -21,8 +21,8 @@ if [[ -f /gallery/index.php ]]; then sed -i "s|root /config/www/gallery;|root /app/www/public;|" /config/nginx/site-confs/default.conf echo "Migration completed." echo "" - echo "You can now safely delete everything in /gallery *except*" - echo "for the upload and galleries directories" + echo "You can now safely delete everything in /gallery *except* for the upload and" + echo "galleries directories. If your photos are stored elsewhere you can ignore this." echo "" echo "*******************************************************************************" fi From 7dead2c3203f2d3272da8d1e1cb20c11b0021373 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Sat, 19 Nov 2022 18:42:54 +0000 Subject: [PATCH 14/14] Make /gallery a force volume to prevent data loss --- Dockerfile | 2 +- Dockerfile.aarch64 | 2 +- Dockerfile.armhf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0b3718d..8701551 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,4 +58,4 @@ COPY root/ / # ports and volumes EXPOSE 80 443 -VOLUME /config +VOLUME /config /gallery diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index b481877..6e30d2c 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -58,4 +58,4 @@ COPY root/ / # ports and volumes EXPOSE 80 443 -VOLUME /config +VOLUME /config /gallery diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 072bf9f..b011965 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -58,4 +58,4 @@ COPY root/ / # ports and volumes EXPOSE 80 443 -VOLUME /config +VOLUME /config /gallery