diff --git a/Dockerfile b/Dockerfile index 756148f..c5fce70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15-php8 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.17 # set version label ARG BUILD_DATE @@ -10,49 +12,42 @@ LABEL maintainer="hackerman" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --virtual=build-dependencies \ - composer \ - git && \ + composer && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ - curl \ exiftool \ ffmpeg \ gd \ imagemagick \ jpegoptim \ - php8-bcmath \ - php8-ctype \ - php8-dom \ - php8-exif \ - php8-gd \ - php8-pecl-imagick \ - php8-intl \ - php8-json \ - php8-mbstring \ - php8-mysqli \ - php8-pdo_mysql \ - php8-session \ - php8-tokenizer \ - php8-xml \ - php8-zip && \ + php81-bcmath \ + php81-ctype \ + php81-dom \ + php81-exif \ + php81-gd \ + php81-intl \ + php81-mysqli \ + php81-pdo_mysql \ + php81-pecl-imagick \ + php81-phar \ + php81-tokenizer \ + php81-zip && \ + echo "**** configure php-fpm to pass env vars ****" && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \ echo "**** install lychee ****" && \ - mkdir -p /app/lychee && \ - if [ -z ${LYCHEE_VERSION} ]; then \ + if [ -z "${LYCHEE_VERSION}" ]; then \ LYCHEE_VERSION=$(curl -sX GET "https://api.github.com/repos/LycheeOrg/Lychee/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - curl -o \ - /tmp/lychee.tar.gz -L \ - "https://github.com/LycheeOrg/Lychee/archive/${LYCHEE_VERSION}.tar.gz" && \ - tar xf \ - /tmp/lychee.tar.gz -C \ - /app/lychee/ --strip-components=1 && \ - cd /app/lychee && \ + mkdir -p /app/www && \ + git clone --recurse-submodules https://github.com/LycheeOrg/Lychee.git /app/www && \ + cd /app/www && \ + git checkout "${LYCHEE_VERSION}" && \ echo "**** install composer dependencies ****" && \ composer install \ - -d /app/lychee \ + -d /app/www \ --no-dev \ - --no-suggest \ --no-interaction && \ echo "**** cleanup ****" && \ apk del --purge \ @@ -62,5 +57,9 @@ RUN \ /root/.composer \ /tmp/* -# add local files +# copy local files COPY root/ / + +# ports and volumes +EXPOSE 80 443 +VOLUME /config diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 68d71c8..bd1676d 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15-php8 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.17 # set version label ARG BUILD_DATE @@ -10,56 +12,54 @@ LABEL maintainer="hackerman" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --virtual=build-dependencies \ - composer \ - git && \ + composer && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ - curl \ exiftool \ ffmpeg \ gd \ imagemagick \ jpegoptim \ - php8-bcmath \ - php8-ctype \ - php8-dom \ - php8-exif \ - php8-gd \ - php8-pecl-imagick \ - php8-intl \ - php8-json \ - php8-mbstring \ - php8-mysqli \ - php8-pdo_mysql \ - php8-session \ - php8-tokenizer \ - php8-xml \ - php8-zip && \ + php81-bcmath \ + php81-ctype \ + php81-dom \ + php81-exif \ + php81-gd \ + php81-intl \ + php81-mysqli \ + php81-pdo_mysql \ + php81-pecl-imagick \ + php81-phar \ + php81-tokenizer \ + php81-zip && \ + echo "**** configure php-fpm to pass env vars ****" && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \ echo "**** install lychee ****" && \ - mkdir -p /app/lychee && \ - if [ -z ${LYCHEE_VERSION} ]; then \ + if [ -z "${LYCHEE_VERSION}" ]; then \ LYCHEE_VERSION=$(curl -sX GET "https://api.github.com/repos/LycheeOrg/Lychee/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - curl -o \ - /tmp/lychee.tar.gz -L \ - "https://github.com/LycheeOrg/Lychee/archive/${LYCHEE_VERSION}.tar.gz" && \ - tar xf \ - /tmp/lychee.tar.gz -C \ - /app/lychee/ --strip-components=1 && \ - cd /app/lychee && \ + mkdir -p /app/www && \ + git clone --recurse-submodules https://github.com/LycheeOrg/Lychee.git /app/www && \ + cd /app/www && \ + git checkout "${LYCHEE_VERSION}" && \ echo "**** install composer dependencies ****" && \ composer install \ - -d /app/lychee \ + -d /app/www \ --no-dev \ - --no-suggest \ --no-interaction && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ rm -rf \ /root/.cache \ + /root/.composer \ /tmp/* -# add local files +# copy local files COPY root/ / + +# ports and volumes +EXPOSE 80 443 +VOLUME /config diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 63bc1ea..f3e8b95 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,6 @@ -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15-php8 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.17 # set version label ARG BUILD_DATE @@ -10,56 +12,54 @@ LABEL maintainer="hackerman" RUN \ echo "**** install build packages ****" && \ apk add --no-cache --virtual=build-dependencies \ - composer \ - git && \ + composer && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ - curl \ exiftool \ ffmpeg \ gd \ imagemagick \ jpegoptim \ - php8-bcmath \ - php8-ctype \ - php8-dom \ - php8-exif \ - php8-gd \ - php8-pecl-imagick \ - php8-intl \ - php8-json \ - php8-mbstring \ - php8-mysqli \ - php8-pdo_mysql \ - php8-session \ - php8-tokenizer \ - php8-xml \ - php8-zip && \ + php81-bcmath \ + php81-ctype \ + php81-dom \ + php81-exif \ + php81-gd \ + php81-intl \ + php81-mysqli \ + php81-pdo_mysql \ + php81-pecl-imagick \ + php81-phar \ + php81-tokenizer \ + php81-zip && \ + echo "**** configure php-fpm to pass env vars ****" && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \ echo "**** install lychee ****" && \ - mkdir -p /app/lychee && \ - if [ -z ${LYCHEE_VERSION} ]; then \ + if [ -z "${LYCHEE_VERSION}" ]; then \ LYCHEE_VERSION=$(curl -sX GET "https://api.github.com/repos/LycheeOrg/Lychee/releases/latest" \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ - curl -o \ - /tmp/lychee.tar.gz -L \ - "https://github.com/LycheeOrg/Lychee/archive/${LYCHEE_VERSION}.tar.gz" && \ - tar xf \ - /tmp/lychee.tar.gz -C \ - /app/lychee/ --strip-components=1 && \ - cd /app/lychee && \ + mkdir -p /app/www && \ + git clone --recurse-submodules https://github.com/LycheeOrg/Lychee.git /app/www && \ + cd /app/www && \ + git checkout "${LYCHEE_VERSION}" && \ echo "**** install composer dependencies ****" && \ composer install \ - -d /app/lychee \ + -d /app/www \ --no-dev \ - --no-suggest \ --no-interaction && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ rm -rf \ /root/.cache \ + /root/.composer \ /tmp/* -# add local files +# copy local files COPY root/ / + +# ports and volumes +EXPOSE 80 443 +VOLUME /config diff --git a/README.md b/README.md index 479722f..033c179 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ docker run -d \ -e PGID=1000 \ -e TZ=Europe/London \ -e DB_HOST=mariadb \ + -e DB_PORT=3306 \ -e DB_USERNAME=lychee \ -e DB_PASSWORD=dbpassword \ -e DB_DATABASE=lychee \ @@ -145,6 +146,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 | | `-e DB_HOST=mariadb` | for specifying the database host | +| `-e DB_PORT=3306` | for specifying the database port | | `-e DB_USERNAME=lychee` | for specifying the database user | | `-e DB_PASSWORD=dbpassword` | for specifying the database password | | `-e DB_DATABASE=lychee` | for specifying the database to be used | @@ -260,7 +262,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions -* **04.12.21:** - Rebase to alpine 3.15 with php8. +* **04.10.22:** - Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)). Switch to git clone as builds fail with the release artifact. * **13.05.21:** - Make readme clearer. * **18.04.21:** - Add php-intl for v4.3. * **31.01.21:** - Add jpegoptim. diff --git a/package_versions.txt b/package_versions.txt index 65d4a46..25fe363 100755 --- a/package_versions.txt +++ b/package_versions.txt @@ -2,38 +2,38 @@ alpine-baselayout-3.2.0-r18 alpine-keys-2.4-r1 alsa-lib-1.2.5.1-r1 aom-libs-3.2.0-r0 -apache2-utils-2.4.54-r0 +apache2-utils-2.4.51-r1 apk-tools-2.12.7-r3 -apr-1.7.0-r1 +apr-1.7.0-r0 apr-util-1.6.1-r11 argon2-libs-20190702-r1 avahi-libs-0.8-r5 -bash-5.1.16-r0 +bash-5.1.8-r0 brotli-libs-1.0.9-r5 -busybox-1.34.1-r7 -ca-certificates-20220614-r0 -ca-certificates-bundle-20220614-r0 -cairo-1.16.0-r5 -cairo-gobject-1.16.0-r5 +busybox-1.34.1-r3 +ca-certificates-20191127-r7 +ca-certificates-bundle-20191127-r7 +cairo-1.16.0-r3 +cairo-gobject-1.16.0-r3 coreutils-9.0-r2 -cups-libs-2.3.3-r6 -curl-7.80.0-r2 +cups-libs-2.3.3-r4 +curl-7.80.0-r0 dbus-libs-1.12.20-r4 exiftool-12.30-r0 -expat-2.4.7-r0 +expat-2.4.1-r0 ffmpeg-4.4.1-r2 ffmpeg-libs-4.4.1-r2 fontconfig-2.13.1-r4 -freetype-2.11.1-r2 +freetype-2.11.0-r0 fribidi-1.0.11-r0 gd-2.3.2-r1 -gdk-pixbuf-2.42.8-r0 +gdk-pixbuf-2.42.6-r0 ghostscript-9.55.0-r0 -git-2.34.4-r0 -git-perl-2.34.4-r0 +git-2.34.1-r0 +git-perl-2.34.1-r0 glib-2.70.1-r0 -gmp-6.2.1-r1 -gnutls-3.7.1-r1 +gmp-6.2.1-r0 +gnutls-3.7.1-r0 graphite2-1.3.14-r0 harfbuzz-3.0.0-r2 icu-libs-69.1-r1 @@ -46,14 +46,14 @@ lcms2-2.12-r1 libacl-2.2.53-r0 libass-0.15.2-r0 libattr-2.5.1-r1 -libblkid-2.37.4-r0 +libblkid-2.37.2-r1 libbsd-0.11.3-r1 libbz2-1.0.8-r1 libc-utils-0.7.2-r3 -libcrypto1.1-1.1.1q-r0 -libcurl-7.80.0-r2 +libcrypto1.1-1.1.1l-r7 +libcurl-7.80.0-r0 libdav1d-0.9.2-r0 -libde265-1.0.8-r2 +libde265-1.0.8-r1 libdrm-2.4.109-r0 libedit-20210910.3.1-r0 libffi-3.4.2-r1 @@ -66,29 +66,29 @@ libintl-0.21-r0 libjpeg-turbo-2.1.2-r0 libltdl-2.4.6-r7 libmd-1.0.3-r0 -libmount-2.37.4-r0 +libmount-2.37.2-r1 libogg-1.3.5-r0 libpciaccess-0.16-r0 libpng-1.6.37-r1 libproc-3.3.17-r0 -libressl3.4-libcrypto-3.4.3-r0 -libressl3.4-libssl-3.4.3-r0 -libretls-3.3.4-r3 +libressl3.4-libcrypto-3.4.1-r0 +libressl3.4-libssl-3.4.1-r0 +libretls-3.3.4-r2 librsvg-2.50.7-r1 libsm-1.2.3-r0 libsrt-1.4.2-r1 libssh-0.9.6-r1 -libssl1.1-1.1.1q-r0 +libssl1.1-1.1.1l-r7 libstdc++-10.3.1_git20211027-r0 libtasn1-4.18.0-r0 libtheora-1.1.1-r16 libunistring-0.9.10-r1 -libuuid-2.37.4-r0 +libuuid-2.37.2-r1 libva-2.13.0-r0 libvdpau-1.4-r0 libvorbis-1.3.7-r0 libvpx-1.10.0-r0 -libwebp-1.2.2-r0 +libwebp-1.2.1-r0 libx11-1.7.2-r0 libxau-1.0.9-r0 libxcb-1.14-r2 @@ -96,55 +96,55 @@ libxdmcp-1.1.3-r0 libxext-1.3.4-r0 libxfixes-6.0.0-r0 libxft-2.3.4-r0 -libxml2-2.9.14-r0 +libxml2-2.9.12-r2 libxpm-3.5.13-r0 libxrender-0.9.10-r3 libxt-1.2.1-r0 libzip-1.8.0-r1 linux-pam-1.5.2-r0 -logrotate-3.18.1-r3 +logrotate-3.18.1-r0 musl-1.2.2-r7 musl-utils-1.2.2-r7 nano-5.9-r0 -ncurses-libs-6.3_p20211120-r1 -ncurses-terminfo-base-6.3_p20211120-r1 +ncurses-libs-6.3_p20211120-r0 +ncurses-terminfo-base-6.3_p20211120-r0 nettle-3.7.3-r0 nghttp2-libs-1.46.0-r0 -nginx-1.20.2-r1 +nginx-1.20.2-r0 oniguruma-6.9.7.1-r0 -openssl-1.1.1q-r0 +openssl-1.1.1l-r7 opus-1.3.1-r1 p11-kit-0.24.0-r1 pango-1.48.10-r0 pcre-8.45-r1 -pcre2-10.40-r0 +pcre2-10.39-r0 perl-5.34.0-r1 perl-error-0.17029-r1 -perl-git-2.34.4-r0 +perl-git-2.34.1-r0 perl-image-exiftool-12.30-r0 -php8-8.0.18-r0 -php8-bcmath-8.0.18-r0 -php8-common-8.0.18-r0 -php8-ctype-8.0.18-r0 -php8-dom-8.0.18-r0 -php8-exif-8.0.18-r0 -php8-fileinfo-8.0.18-r0 -php8-fpm-8.0.18-r0 -php8-gd-8.0.18-r0 -php8-intl-8.0.18-r0 -php8-mbstring-8.0.18-r0 -php8-mysqli-8.0.18-r0 -php8-mysqlnd-8.0.18-r0 -php8-openssl-8.0.18-r0 -php8-pdo-8.0.18-r0 -php8-pdo_mysql-8.0.18-r0 +php8-8.0.13-r0 +php8-bcmath-8.0.13-r0 +php8-common-8.0.13-r0 +php8-ctype-8.0.13-r0 +php8-dom-8.0.13-r0 +php8-exif-8.0.13-r0 +php8-fileinfo-8.0.13-r0 +php8-fpm-8.0.13-r0 +php8-gd-8.0.13-r0 +php8-intl-8.0.13-r0 +php8-mbstring-8.0.13-r0 +php8-mysqli-8.0.13-r0 +php8-mysqlnd-8.0.13-r0 +php8-openssl-8.0.13-r0 +php8-pdo-8.0.13-r0 +php8-pdo_mysql-8.0.13-r0 php8-pecl-imagick-3.6.0-r0 -php8-session-8.0.18-r0 -php8-simplexml-8.0.18-r0 -php8-tokenizer-8.0.18-r0 -php8-xml-8.0.18-r0 -php8-xmlwriter-8.0.18-r0 -php8-zip-8.0.18-r0 +php8-session-8.0.13-r0 +php8-simplexml-8.0.13-r0 +php8-tokenizer-8.0.13-r0 +php8-xml-8.0.13-r0 +php8-xmlwriter-8.0.13-r0 +php8-zip-8.0.13-r0 pixman-0.40.0-r3 pkgconf-1.8.0-r0 popt-1.18-r0 @@ -157,9 +157,9 @@ shadow-4.8.1-r1 shared-mime-info-2.1-r0 skalibs-2.11.0.0-r0 soxr-0.1.3-r2 -ssl_client-1.34.1-r7 -tiff-4.3.0-r1 -tzdata-2022a-r0 +ssl_client-1.34.1-r3 +tiff-4.3.0-r0 +tzdata-2021e-r0 utmps-0.1.0.3-r0 v4l-utils-libs-1.22.1-r1 vidstab-1.1.0-r1 @@ -168,7 +168,7 @@ wayland-libs-client-1.19.0-r1 x264-libs-20210613-r0 x265-libs-3.5-r0 xvidcore-1.3.7-r1 -xz-5.2.5-r1 -xz-libs-5.2.5-r1 -zlib-1.2.12-r1 +xz-5.2.5-r0 +xz-libs-5.2.5-r0 +zlib-1.2.11-r3 zstd-libs-1.5.0-r0 diff --git a/readme-vars.yml b/readme-vars.yml index d45dd58..eb071a3 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -32,6 +32,7 @@ param_usage_include_env: true param_env_vars: - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"} - { env_var: "DB_HOST", env_value: "mariadb", desc: "for specifying the database host" } + - { env_var: "DB_PORT", env_value: "3306", desc: "for specifying the database port" } - { env_var: "DB_USERNAME", env_value: "lychee", desc: "for specifying the database user" } - { env_var: "DB_PASSWORD", env_value: "dbpassword", desc: "for specifying the database password" } - { env_var: "DB_DATABASE", env_value: "lychee", desc: "for specifying the database to be used" } @@ -88,7 +89,7 @@ app_setup_block: | # changelog changelogs: - - { date: "04.12.21:", desc: "Rebase to alpine 3.15 with php8." } + - { date: "11.01.23:", desc: "Rebasing to alpine 3.17 with php8.1. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)). Switch to git clone as builds fail with the release artifact." } - { date: "13.05.21:", desc: "Make readme clearer." } - { date: "18.04.21:", desc: "Add php-intl for v4.3." } - { date: "31.01.21:", desc: "Add jpegoptim." } diff --git a/root/app/lychee/public/index.html b/root/app/lychee/public/index.html new file mode 100644 index 0000000..2ac31be --- /dev/null +++ b/root/app/lychee/public/index.html @@ -0,0 +1,40 @@ + + + Upgrade Required! + + + +
+

Upgrade Required!

+

The application inside this image has been moved to a new folder.

+

You will need to update your /config/nginx/nginx.conf and /config/nginx/site-confs/default.conf in order for the application to work.

+

New config samples are located at /config/nginx/nginx.conf.sample and /config/nginx/site-confs/default.conf.sample

+

Please review our announcement: Significant changes to nginx based images

+
+ + diff --git a/root/defaults/default b/root/defaults/default deleted file mode 100644 index 16d4816..0000000 --- a/root/defaults/default +++ /dev/null @@ -1,33 +0,0 @@ -server { - listen 80 default_server; - - listen 443 ssl; - - root /app/lychee/public; - index index.php index.html index.htm; - - server_name _; - - ssl_certificate /config/keys/cert.crt; - ssl_certificate_key /config/keys/cert.key; - - client_max_body_size 0; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - # unless the request is for a valid file (image, js, css, etc.), send to bootstrap - if (!-e $request_filename) - { - rewrite ^/(.*)$ /index.php?/$1 last; - break; - } - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - include /etc/nginx/fastcgi_params; - } -} diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample new file mode 100644 index 0000000..30779c0 --- /dev/null +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -0,0 +1,44 @@ +## Version 2023/01/11 - Changelog: https://github.com/linuxserver/docker-lychee/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 _; + + set $root /app/www/public; + if (!-d /app/www/public) { + set $root /config/www; + } + root $root; + 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; + } + + # unless the request is for a valid file (image, js, css, etc.), send to bootstrap + if (!-e $request_filename) { + rewrite ^/(.*)$ /index.php?/$1 last; + break; + } + + 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; + } +} diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-lychee-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-lychee-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/dependencies.d/init-nginx-end b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/dependencies.d/init-nginx-end new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/cont-init.d/40-config b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run old mode 100644 new mode 100755 similarity index 68% rename from root/etc/cont-init.d/40-config rename to root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index c46735a..69219d7 --- a/root/etc/cont-init.d/40-config +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -1,31 +1,37 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash mkdir -p /pictures -cd /app/lychee +cd /app/www || exit 1 # copy config -[[ ! -e /config/user.ini ]] && \ +if [[ ! -e /config/user.ini ]]; then cp /defaults/user.ini /config/user.ini -cp /config/user.ini /etc/php8/conf.d/99-user.ini +fi +cp /config/user.ini /etc/php81/conf.d/99-user.ini # pre-populate /pictures directory if it's empty if [ ! "$(ls -A /pictures)" ]; then - mv /app/lychee/public/uploads/* /pictures/ - chown -R abc:abc /pictures + mv /app/www/public/uploads/* /pictures/ + lsiown -R abc:abc /pictures elif [ ! "$(ls -A /pictures/import 2>/dev/null)" ]; then printf "\n\n\n\nSeems like you tried to use a path thats not managed by lychee, this is unsupported\n\n\n\n" fi -[[ ! -L "/app/lychee/public/uploads" ]] && rm -rf /app/lychee/public/uploads && ln -sf /pictures /app/lychee/public/uploads +if [[ ! -L "/app/www/public/uploads" ]]; then + rm -rf /app/www/public/uploads + ln -sf /pictures /app/www/public/uploads +fi # handle storage directory -[[ ! -e "/config/storage" ]] && \ - mv /app/lychee/storage /config/ +if [[ ! -e "/config/storage" ]]; then + mv /app/www/storage /config/ +fi -rm -rf /app/lychee/storage -ln -s /config/storage /app/lychee/storage -ln -sf /config/.env /app/lychee/.env +rm -rf /app/www/storage +ln -s /config/storage /app/www/storage +ln -sf /config/.env /app/www/.env # check for .env and copy default if needed if [ ! -f "/config/.env" ]; then @@ -39,7 +45,7 @@ if [ ! -f "/config/.env" ]; then done # populate config from variables - cp /app/lychee/.env.example /config/.env + cp /app/www/.env.example /config/.env echo "Populating config from variables" sed -i "s|DB_CONNECTION=sqlite|DB_CONNECTION=mysql|g" /config/.env @@ -54,13 +60,13 @@ if [ ! -f "/config/.env" ]; then php artisan migrate --force elif [ -f "/config/lychee/config.php" ]; then # attempt upgrade - cp /app/lychee/.env.example /config/.env + cp /app/www/.env.example /config/.env php /defaults/upgrade.php mv /config/lychee /config/lychee.old # force nginx config upgrade - mv /config/nginx/site-confs/default /config/nginx/default.bak - mv /defaults/default /config/nginx/site-confs/default + mv /config/nginx/site-confs/default.conf /config/nginx/site-confs/default.conf.bak + cp /defaults/nginx/site-confs/default.conf.sample /config/nginx/site-confs/default.conf php artisan key:generate php artisan migrate --force @@ -79,11 +85,7 @@ else php artisan migrate --force fi -# add line to preserve environment variables in FPM so Lychee can use $PATH (for things like ffprobe) -sed -E -i 's/^clear_env =.*$/clear_env = no/g' /config/php/www2.conf -grep -qxF 'clear_env = no' /config/php/www2.conf || echo 'clear_env = no' >> /config/php/www2.conf - # permissions -chown -R abc:abc \ - /app/lychee \ +lsiown -R abc:abc \ + /app/www \ /config diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/type b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/up b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/up new file mode 100644 index 0000000..3e92847 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-lychee-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-lychee-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-lychee-config new file mode 100644 index 0000000..e69de29 diff --git a/root/migrations/02-default-location b/root/migrations/02-default-location new file mode 100644 index 0000000..88e3f36 --- /dev/null +++ b/root/migrations/02-default-location @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +DEFAULT_CONF="/config/nginx/site-confs/default.conf" +OLD_ROOT="root /app/lychee/public;" +NEW_ROOT="root /app/www/public;" + +if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}"; then + echo "updating root in ${DEFAULT_CONF}" + sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}" +fi