From dee586c380e6df990b0bc373b10e34f19d0401db Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 15:47:34 +0000 Subject: [PATCH 01/13] Rework image for v5 --- Dockerfile | 9 +- Dockerfile.aarch64 | 1 + readme-vars.yml | 75 ++---- .../s6-overlay/s6-rc.d/init-lychee-config/run | 225 +++++------------- 4 files changed, 78 insertions(+), 232 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9dbc53e..503b847 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ RUN \ exiftool \ ffmpeg \ gd \ + grep \ imagemagick \ jpegoptim \ php82-bcmath \ @@ -26,13 +27,11 @@ RUN \ php82-exif \ php82-gd \ php82-intl \ - php82-mysqli \ php82-pdo_mysql \ php82-pdo_pgsql \ php82-pdo_sqlite \ php82-pecl-imagick \ php82-pecl-redis \ - php82-pgsql \ php82-sqlite3 \ php82-tokenizer && \ echo "**** configure php-fpm to pass env vars ****" && \ @@ -44,7 +43,11 @@ RUN \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ mkdir -p /app/www && \ - git clone --branch "${LYCHEE_VERSION}" --recurse-submodules https://github.com/LycheeOrg/Lychee.git /app/www && \ + 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/www --strip-components=1 && \ echo "**** install composer dependencies ****" && \ composer install \ -d /app/www \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index ca19e4a..0f1cf39 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -19,6 +19,7 @@ RUN \ exiftool \ ffmpeg \ gd \ + grep \ imagemagick \ jpegoptim \ php82-bcmath \ diff --git a/readme-vars.yml b/readme-vars.yml index 7c62f0f..e1d02c2 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -7,9 +7,6 @@ project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/ma project_blurb: | [{{ project_name|capitalize }}]({{ project_url }}) is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely." - ### UPGRADE WARNING - - Please note that the v4 upgrade process resets ALL password-protected albums. Any albums that were made public with a password will need to be re-secured. project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}" # supported architectures @@ -22,70 +19,33 @@ common_param_env_vars_enabled: true param_container_name: "{{ project_name }}" param_usage_include_vols: true param_volumes: - - { vol_path: "/config", vol_host_path: "/path/to/config", desc: "Contains all relevant configuration files." } - - { vol_path: "/pictures", vol_host_path: "/path/to/pictures", desc: "Where lychee will store uploaded data." } + - { vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/config", desc: "Persistent config files." } + - { vol_path: "/pictures", vol_host_path: "/path/to/pictures", desc: "Where lychee will store uploaded images." } param_usage_include_ports: true param_ports: - { external_port: "80", internal_port: "80", port_desc: "http gui" } 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_CONNECTION", env_value: "mysql", desc: "for specifying the database type" } - - { 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" } + - { env_var: "DB_CONNECTION", env_value: "sqlite", desc: "DB type, from `sqlite`, `mysql`, `pqsql`." } + - { env_var: "DB_HOST", env_value: "", desc: "DB server hostname. For `mysql` and `pgsql` only." } + - { env_var: "DB_PORT", env_value: "", desc: "DB server port. For `mysql` and `pgsql` only." } + - { env_var: "DB_USERNAME", env_value: "", desc: "DB user. For `mysql` and `pgsql` only." } + - { env_var: "DB_PASSWORD", env_value: "", desc: "DB password. For `mysql` and `pgsql` only." } + - { env_var: "DB_DATABASE", env_value: "", desc: "Path to DB file for `sqlite`. DB name for `mysql` and `pgsql`." } -# optional parameters -optional_block_1: false -optional_block_1_items: "" - -custom_compose: | - version: "3" - services: - mariadb: - image: lscr.io/linuxserver/mariadb:latest - container_name: lychee_mariadb - restart: always - volumes: - - /path/to/mariadb/data:/config - environment: - - MYSQL_ROOT_PASSWORD=rootpassword - - MYSQL_DATABASE=lychee - - MYSQL_USER=lychee - - MYSQL_PASSWORD=dbpassword - - PGID=1000 - - PUID=1000 - - TZ=Europe/London - lychee: - image: lscr.io/linuxserver/lychee:latest - container_name: lychee - restart: always - depends_on: - - mariadb - volumes: - - /path/to/config:/config - - /path/to/pictures:/pictures - environment: - - DB_CONNECTION=mysql - - DB_HOST=mariadb - - DB_PORT=3306 - - DB_USERNAME=lychee - - DB_PASSWORD=dbpassword - - DB_DATABASE=lychee - - PGID=1000 - - PUID=1000 - - TZ=Europe/London - ports: - - 80:80 +opt_param_usage_include_env: true +opt_param_env_vars: + - { env_var: "APP_NAME", env_value: "Lychee", desc: "The gallery name." } + - { env_var: "APP_URL", env_value: "", desc: "The URL you will use to access Lychee including protocol, and port where appropriate." } + - { env_var: "APP_FORCE_HTTPS", env_value: "", desc: "Set to `true` if running behind an https reverse proxy." } # application setup block app_setup_block_enabled: true app_setup_block: | - **This image will not work with a prefilled `/pictures` mount, lychee wants total control over this folder** + **This image will not work with a prefilled `/pictures` mount, Lychee wants total control over this folder** + + Setup account via the webui, accessible at http://SERVERIP:PORT - Setup mysql/mariadb and account via the webui, accessible at http://SERVERIP:PORT More info at [lychee]({{ project_url }}). ### Customization @@ -101,12 +61,13 @@ app_setup_block: | upload_max_filesize = 500M ``` - After making these changes, you'll need to restart the Docker container for the changes to take effect. Here's how to do it: + After making these changes, you'll need to restart the Docker container for the changes to take effect. **Please note that these changes might have implications on your server's performance, depending on its available resources. Thus, it's recommended to modify these settings with caution.** # changelog changelogs: + - { date: "27.12.23:", desc: "Update image to support v5." } - { date: "25.12.23:", desc: "Existing users should update: site-confs/default.conf - Cleanup default site conf. Build npm dependencies into image." } - { date: "25.05.23:", desc: "Rebase to Alpine 3.18, deprecate armhf." } - { date: "13.04.23:", desc: "Move ssl.conf include to default.conf." } diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index 6fcd0a1..8580f49 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -1,9 +1,8 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -echo "**** Make sure the uploads (pictures), sym, and logs folders exist ****" mkdir -p \ - /config/{sym,logs} \ + /config/{sym,log} \ /pictures # pre-populate /pictures directory if it's empty @@ -14,230 +13,112 @@ 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 -echo "**** Create the symbolic link for the uploads folder ****" if [ ! -L /app/www/public/uploads ]; then - cp -nr /app/www/public/uploads/* /pictures rm -rf /app/www/public/uploads ln -s /pictures /app/www/public/uploads fi -echo "**** Create the symbolic link for the sym folder ****" if [ ! -L /app/www/public/sym ]; then - touch /app/www/public/sym/empty_file - cp -nr /app/www/public/sym/* /config/sym + cp -nr /app/www/public/sym/* /config/sym 2> >(grep -v 'cp: not replacing') rm -rf /app/www/public/sym ln -s /config/sym /app/www/public/sym fi -echo "**** Create the symbolic link for the logs folder ****" if [ ! -L /app/www/storage/logs ]; then - touch /app/www/storage/logs/empty_file - cp -nr /app/www/storage/logs/* /config/logs rm -rf /app/www/storage/logs - ln -s /config/logs /app/www/storage/logs + ln -s /config/log /app/www/storage/logs fi -echo "**** Create user.ini for php settings ****" -cp -n /defaults/user.ini /config/user.ini +cp -n /defaults/user.ini /config/user.ini 2> >(grep -v 'cp: not replacing') rm -rf /etc/php82/conf.d/99-user.ini ln -s /config/user.ini /etc/php82/conf.d/99-user.ini -if [ -z "${DB_CONNECTION}" ]; then - DB_CONNECTION=$(grep "^DB_CONNECTION=" /config/.env 2>/dev/null | cut -d'=' -f2-) -fi - cd /app/www || exit 1 if [ "${DB_CONNECTION}" = "sqlite" ] || [ -z "${DB_CONNECTION}" ]; then if [ -n "${DB_DATABASE}" ]; then if [ ! -e "${DB_DATABASE}" ]; then - echo "**** Specified sqlite database doesn't exist. Creating it ****" - echo "**** Please make sure your database is on a persistent volume ****" touch "${DB_DATABASE}" lsiown abc:abc "${DB_DATABASE}" fi lsiown abc:abc "${DB_DATABASE}" else - DB_DATABASE="/app/www/database/database.sqlite" + DB_DATABASE="/config/database.sqlite" export DB_DATABASE - if [ ! -L "${DB_DATABASE}" ]; then - if [ ! -e /config/database.sqlite ]; then - echo "**** Copy the default database to /config ****" - cp "${DB_DATABASE}" /config/database.sqlite + fi +elif [ "${DB_CONNECTION}" = "mysql" ]; then + if [[ -z "${DB_PORT}" ]]; then + DB_PORT="3306" + fi + echo "Waiting for DB to be available" + END=$((SECONDS + 30)) + while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do + if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then + if [[ -n "${RUN}" ]]; then + break fi - echo "**** Create the symbolic link for the database ****" - rm "${DB_DATABASE}" - ln -s /config/database.sqlite "${DB_DATABASE}" + RUN="RAN" + # we sleep here again due to first run init on DB containers + if [[ ! -f /dbwait.lock ]]; then + sleep 5 + fi + else + sleep 1 fi + done +elif [ "${DB_CONNECTION}" = "pgsql" ]; then + if [[ -z "${DB_PORT}" ]]; then + DB_PORT="5432" fi -else - if [ -n "${DB_HOST}" ] && [ -n "${DB_PORT}" ]; then - # check for the mysql endpoint for 30 seconds - until nc -z -v -w30 "${DB_HOST}" "${DB_PORT}"; do - echo "Waiting for database connection..." - sleep 5 - done - fi + echo "Waiting for DB to be available" + END=$((SECONDS + 30)) + while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do + if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then + if [[ -n "${RUN}" ]]; then + break + fi + RUN="RAN" + # we sleep here again due to first run init on DB containers + if [[ ! -f /dbwait.lock ]]; then + sleep 5 + fi + else + sleep 1 + fi + done fi -echo "**** Copy the .env to /config ****" if [ ! -e /config/.env ]; then - sed 's|^#DB_DATABASE=$|DB_DATABASE='"${DB_DATABASE}"'|' /app/www/.env.example >/config/.env + cp -n /app/www/.env.example /config/.env 2> >(grep -v 'cp: not replacing') fi if [ ! -L /app/www/.env ]; then rm -rf /app/www/.env ln -s /config/.env /app/www/.env fi -echo "**** Inject .env values ****" -if [ -n "${APP_NAME}" ]; then - sed -i "s|APP_NAME=.*|APP_NAME=${APP_NAME}|i" /config/.env -fi -if [ -n "${APP_ENV}" ]; then - sed -i "s|APP_ENV=.*|APP_ENV=${APP_ENV}|i" /config/.env -fi -if [ -n "${APP_DEBUG}" ]; then - sed -i "s|APP_DEBUG=.*|APP_DEBUG=${APP_DEBUG}|i" /config/.env -fi -if [ -n "${APP_URL}" ]; then - sed -i "s|APP_URL=.*|APP_URL=${APP_URL}|i" /config/.env -fi -if [ -n "${APP_FORCE_HTTPS}" ]; then - sed -i "s|APP_FORCE_HTTPS=.*|APP_FORCE_HTTPS=${APP_FORCE_HTTPS}|i" /config/.env -fi -if [ -n "${DEBUGBAR_ENABLED}" ]; then - sed -i "s|DEBUGBAR_ENABLED=.*|DEBUGBAR_ENABLED=${DEBUGBAR_ENABLED}|i" /config/.env -fi -if [ -n "${DB_OLD_LYCHEE_PREFIX}" ]; then - sed -i "s|DB_OLD_LYCHEE_PREFIX=.*|DB_OLD_LYCHEE_PREFIX=${DB_OLD_LYCHEE_PREFIX}|i" /config/.env -fi -if [ -n "${DB_CONNECTION}" ]; then - sed -i "s|DB_CONNECTION=.*|DB_CONNECTION=${DB_CONNECTION}|i" /config/.env -fi -if [ -n "${DB_HOST}" ]; then - sed -i "s|DB_HOST=.*|DB_HOST=${DB_HOST}|i" /config/.env -fi -if [ -n "${DB_PORT}" ]; then - sed -i "s|DB_PORT=.*|DB_PORT=${DB_PORT}|i" /config/.env -fi -if [ -n "${DB_DATABASE}" ]; then - sed -i "s|DB_DATABASE=.*|DB_DATABASE=${DB_DATABASE}|i" /config/.env -fi -if [ -n "${DB_USERNAME}" ]; then - sed -i "s|DB_USERNAME=.*|DB_USERNAME=${DB_USERNAME}|i" /config/.env -fi -if [ -n "${DB_PASSWORD_FILE}" ]; then - DB_PASSWORD=$(<"${DB_PASSWORD_FILE}") - export DB_PASSWORD -fi -if [ -n "${DB_PASSWORD}" ]; then - sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=${DB_PASSWORD}|i" /config/.env -fi -if [ -z "${TIMEZONE}" ] && [ -n "${TZ}" ]; then - TIMEZONE="${TZ}" - export TIMEZONE -fi -if [ -n "${TIMEZONE}" ]; then - sed -i "s|TIMEZONE=.*|TIMEZONE=${TIMEZONE}|i" /config/.env -fi -if [ -n "${ENABLE_TOKEN_AUTH}" ]; then - sed -i "s|ENABLE_TOKEN_AUTH=.*|ENABLE_TOKEN_AUTH=${ENABLE_TOKEN_AUTH}|i" /config/.env -fi -if [ -n "${CACHE_DRIVER}" ]; then - sed -i "s|CACHE_DRIVER=.*|CACHE_DRIVER=${CACHE_DRIVER}|i" /config/.env -fi -if [ -n "${SESSION_DRIVER}" ]; then - sed -i "s|SESSION_DRIVER=.*|SESSION_DRIVER=${SESSION_DRIVER}|i" /config/.env -fi -if [ -n "${SESSION_LIFETIME}" ]; then - sed -i "s|SESSION_LIFETIME=.*|SESSION_LIFETIME=${SESSION_LIFETIME}|i" /config/.env -fi -if [ -n "${QUEUE_CONNECTION}" ]; then - sed -i "s|QUEUE_DRIVER=.*|QUEUE_DRIVER=${QUEUE_DRIVER}|i" /config/.env -fi -if [ -n "${SECURITY_HEADER_HSTS_ENABLE}" ]; then - sed -i "s|SECURITY_HEADER_HSTS_ENABLE=.*|SECURITY_HEADER_HSTS_ENABLE=${SECURITY_HEADER_HSTS_ENABLE}|i" /config/.env -fi -if [ -n "${SESSION_SECURE_COOKIE}" ]; then - sed -i "s|SESSION_SECURE_COOKIE=.*|SESSION_SECURE_COOKIE=${SESSION_SECURE_COOKIE}|i" /config/.env -fi -if [ -n "${REDIS_SCHEME}" ]; then - sed -i "s|REDIS_SCHEME=.*|REDIS_SCHEME=${REDIS_SCHEME}|i" /config/.env -fi -if [ -n "${REDIS_PATH}" ]; then - sed -i "s|REDIS_PATH=.*|REDIS_PATH=${REDIS_PATH}|i" /config/.env -fi -if [ -n "${REDIS_HOST}" ]; then - sed -i "s|REDIS_HOST=.*|REDIS_HOST=${REDIS_HOST}|i" /config/.env -fi -if [ -n "${REDIS_PORT}" ]; then - sed -i "s|REDIS_PORT=.*|REDIS_PORT=${REDIS_PORT}|i" /config/.env -fi -if [ -n "${REDIS_PASSWORD_FILE}" ]; then - REDIS_PASSWORD=$(<"${REDIS_PASSWORD_FILE}") - export REDIS_PASSWORD -fi -if [ -n "${REDIS_PASSWORD}" ]; then - sed -i "s|REDIS_PASSWORD=.*|REDIS_PASSWORD=${REDIS_PASSWORD}|i" /config/.env -fi -if [ -n "${MAIL_DRIVER}" ]; then - sed -i "s|MAIL_DRIVER=.*|MAIL_DRIVER=${MAIL_DRIVER}|i" /config/.env -fi -if [ -n "${MAIL_HOST}" ]; then - sed -i "s|MAIL_HOST=.*|MAIL_HOST=${MAIL_HOST}|i" /config/.env -fi -if [ -n "${MAIL_PORT}" ]; then - sed -i "s|MAIL_PORT=.*|MAIL_PORT=${MAIL_PORT}|i" /config/.env -fi -if [ -n "${MAIL_USERNAME}" ]; then - sed -i "s|MAIL_USERNAME=.*|MAIL_USERNAME=${MAIL_USERNAME}|i" /config/.env -fi -if [ -n "${MAIL_PASSWORD_FILE}" ]; then - MAIL_PASSWORD=$(<"${MAIL_PASSWORD_FILE}") - export MAIL_PASSWORD -fi -if [ -n "${MAIL_PASSWORD}" ]; then - sed -i "s|MAIL_PASSWORD=.*|MAIL_PASSWORD=${MAIL_PASSWORD}|i" /config/.env -fi -if [ -n "${MAIL_ENCRYPTION}" ]; then - sed -i "s|MAIL_ENCRYPTION=.*|MAIL_ENCRYPTION=${MAIL_ENCRYPTION}|i" /config/.env -fi -if [ -n "${MAIL_FROM_NAME}" ]; then - sed -i "s|MAIL_FROM_NAME=.*|MAIL_FROM_NAME=${MAIL_FROM_NAME}|i" /config/.env -fi -if [ -n "${MAIL_FROM_ADDRESS}" ]; then - sed -i "s|MAIL_FROM_ADDRESS=.*|MAIL_FROM_ADDRESS=${MAIL_FROM_ADDRESS}|i" /config/.env -fi -if [ -n "${TRUSTED_PROXIES}" ]; then - sed -i "s|TRUSTED_PROXIES=.*|TRUSTED_PROXIES=${TRUSTED_PROXIES}|i" /config/.env +if grep -qPe '^APP_KEY=$' /config/.env; then + echo "**** Generating app key ****" + php /app/www/artisan key:generate -n fi -if [ ! -e /tmp/first_run ]; then - echo "**** Generate the key (to make sure that cookies cannot be decrypted etc) ****" - php artisan key:generate -n - echo "**** Migrate the database ****" - php artisan migrate --force - touch /tmp/first_run -fi +php /app/www/artisan migrate --force -echo "**** Make sure user.css exists and symlink it ****" touch -a /config/user.css if [ ! -L /app/www/public/dist/user.css ]; then rm /app/www/public/dist/user.css ln -s /config/user.css /app/www/public/dist/user.css fi -echo "**** Make sure custom.js exists and symlink it ****" touch -a /config/custom.js if [ ! -L /app/www/public/dist/custom.js ]; then rm /app/www/public/dist/custom.js ln -s /config/custom.js /app/www/public/dist/custom.js fi -echo "**** Make sure Laravel's log exists ****" -touch /config/logs/laravel.log - -echo "**** Set Permissions ****" +# permissions lsiown -R abc:abc \ - /app/www \ + /app/www/storage \ /config + +# set lockfile to avoid DB waits for this specific container +touch /dbwait.lock From 9450e86c578381919d75f40eca4c799963ca1528 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 15:49:03 +0000 Subject: [PATCH 02/13] Run builder --- Jenkinsfile | 6 ++-- README.md | 94 ++++++++++++++++++++++++----------------------------- 2 files changed, 46 insertions(+), 54 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed375be..a787814 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -460,7 +460,7 @@ pipeline { --label \"org.opencontainers.image.licenses=GPL-3.0-only\" \ --label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \ --label \"org.opencontainers.image.title=Lychee\" \ - --label \"org.opencontainers.image.description=[Lychee](https://lycheeorg.github.io/) is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely. ### UPGRADE WARNING Please note that the v4 upgrade process resets ALL password-protected albums. Any albums that were made public with a password will need to be re-secured. \" \ + --label \"org.opencontainers.image.description=[Lychee](https://lycheeorg.github.io/) is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely. \" \ --no-cache --pull -t ${IMAGE}:${META_TAG} --platform=linux/amd64 \ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." } @@ -491,7 +491,7 @@ pipeline { --label \"org.opencontainers.image.licenses=GPL-3.0-only\" \ --label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \ --label \"org.opencontainers.image.title=Lychee\" \ - --label \"org.opencontainers.image.description=[Lychee](https://lycheeorg.github.io/) is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely. ### UPGRADE WARNING Please note that the v4 upgrade process resets ALL password-protected albums. Any albums that were made public with a password will need to be re-secured. \" \ + --label \"org.opencontainers.image.description=[Lychee](https://lycheeorg.github.io/) is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely. \" \ --no-cache --pull -t ${IMAGE}:amd64-${META_TAG} --platform=linux/amd64 \ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." } @@ -519,7 +519,7 @@ pipeline { --label \"org.opencontainers.image.licenses=GPL-3.0-only\" \ --label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \ --label \"org.opencontainers.image.title=Lychee\" \ - --label \"org.opencontainers.image.description=[Lychee](https://lycheeorg.github.io/) is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely. ### UPGRADE WARNING Please note that the v4 upgrade process resets ALL password-protected albums. Any albums that were made public with a password will need to be re-secured. \" \ + --label \"org.opencontainers.image.description=[Lychee](https://lycheeorg.github.io/) is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely. \" \ --no-cache --pull -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} --platform=linux/arm64 \ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ." sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}" diff --git a/README.md b/README.md index c2ad33b..9ed0cf4 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,6 @@ Find us at: [Lychee](https://lycheeorg.github.io/) is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely." -### UPGRADE WARNING - -Please note that the v4 upgrade process resets ALL password-protected albums. Any albums that were made public with a password will need to be re-secured. - [![lychee](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/lychee-icon.png)](https://lycheeorg.github.io/) ## Supported Architectures @@ -63,9 +59,10 @@ The architectures supported by this image are: ## Application Setup -**This image will not work with a prefilled `/pictures` mount, lychee wants total control over this folder** +**This image will not work with a prefilled `/pictures` mount, Lychee wants total control over this folder** + +Setup account via the webui, accessible at http://SERVERIP:PORT -Setup mysql/mariadb and account via the webui, accessible at http://SERVERIP:PORT More info at [lychee](https://lycheeorg.github.io/). ### Customization @@ -81,7 +78,7 @@ post_max_size = 500M upload_max_filesize = 500M ``` -After making these changes, you'll need to restart the Docker container for the changes to take effect. Here's how to do it: +After making these changes, you'll need to restart the Docker container for the changes to take effect. **Please note that these changes might have implications on your server's performance, depending on its available resources. Thus, it's recommended to modify these settings with caution.** @@ -92,43 +89,31 @@ To help you get started creating a container from this image you can either use ### docker-compose (recommended, [click here for more info](https://docs.linuxserver.io/general/docker-compose)) ```yaml -version: "3" +--- +version: "2.1" services: - mariadb: - image: lscr.io/linuxserver/mariadb:latest - container_name: lychee_mariadb - restart: always - volumes: - - /path/to/mariadb/data:/config - environment: - - MYSQL_ROOT_PASSWORD=rootpassword - - MYSQL_DATABASE=lychee - - MYSQL_USER=lychee - - MYSQL_PASSWORD=dbpassword - - PGID=1000 - - PUID=1000 - - TZ=Europe/London lychee: image: lscr.io/linuxserver/lychee:latest container_name: lychee - restart: always - depends_on: - - mariadb - volumes: - - /path/to/config:/config - - /path/to/pictures:/pictures environment: - - DB_CONNECTION=mysql - - DB_HOST=mariadb - - DB_PORT=3306 - - DB_USERNAME=lychee - - DB_PASSWORD=dbpassword - - DB_DATABASE=lychee - - PGID=1000 - PUID=1000 - - TZ=Europe/London + - PGID=1000 + - TZ=Etc/UTC + - DB_CONNECTION=sqlite + - DB_HOST= + - DB_PORT= + - DB_USERNAME= + - DB_PASSWORD= + - DB_DATABASE= + - APP_NAME=Lychee #optional + - APP_URL= #optional + - APP_FORCE_HTTPS= #optional + volumes: + - /path/to/lychee/config:/config + - /path/to/pictures:/pictures ports: - 80:80 + restart: unless-stopped ``` ### docker cli ([click here for more info](https://docs.docker.com/engine/reference/commandline/cli/)) @@ -139,14 +124,17 @@ docker run -d \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Etc/UTC \ - -e DB_CONNECTION=mysql \ - -e DB_HOST=mariadb \ - -e DB_PORT=3306 \ - -e DB_USERNAME=lychee \ - -e DB_PASSWORD=dbpassword \ - -e DB_DATABASE=lychee \ + -e DB_CONNECTION=sqlite \ + -e DB_HOST= \ + -e DB_PORT= \ + -e DB_USERNAME= \ + -e DB_PASSWORD= \ + -e DB_DATABASE= \ + -e APP_NAME=Lychee `#optional` \ + -e APP_URL= `#optional` \ + -e APP_FORCE_HTTPS= `#optional` \ -p 80:80 \ - -v /path/to/config:/config \ + -v /path/to/lychee/config:/config \ -v /path/to/pictures:/pictures \ --restart unless-stopped \ lscr.io/linuxserver/lychee:latest @@ -162,14 +150,17 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e PUID=1000` | for UserID - see below for explanation | | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). | -| `-e DB_CONNECTION=mysql` | for specifying the database type | -| `-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 | -| `-v /config` | Contains all relevant configuration files. | -| `-v /pictures` | Where lychee will store uploaded data. | +| `-e DB_CONNECTION=sqlite` | DB type, from `sqlite`, `mysql`, `pqsql`. | +| `-e DB_HOST=` | DB server hostname. For `mysql` and `pgsql` only. | +| `-e DB_PORT=` | DB server port. For `mysql` and `pgsql` only. | +| `-e DB_USERNAME=` | DB user. For `mysql` and `pgsql` only. | +| `-e DB_PASSWORD=` | DB password. For `mysql` and `pgsql` only. | +| `-e DB_DATABASE=` | Path to DB file for `sqlite`. DB name for `mysql` and `pgsql`. | +| `-e APP_NAME=Lychee` | The gallery name. | +| `-e APP_URL=` | The URL you will use to access Lychee including protocol, and port where appropriate. | +| `-e APP_FORCE_HTTPS=` | Set to `true` if running behind an https reverse proxy. | +| `-v /config` | Persistent config files. | +| `-v /pictures` | Where lychee will store uploaded images. | ## Environment variables from files (Docker secrets) @@ -347,6 +338,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **27.12.23:** - Update image to support v5. * **25.12.23:** - Existing users should update: site-confs/default.conf - Cleanup default site conf. Build npm dependencies into image. * **25.05.23:** - Rebase to Alpine 3.18, deprecate armhf. * **13.04.23:** - Move ssl.conf include to default.conf. From 144b4289d54920ed91566827cb076b724ca1d5a2 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 15:49:57 +0000 Subject: [PATCH 03/13] Bashy brackets --- .../s6-overlay/s6-rc.d/init-lychee-config/run | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index 8580f49..ff878a8 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -6,25 +6,25 @@ mkdir -p \ /pictures # pre-populate /pictures directory if it's empty -if [ ! "$(ls -A /pictures)" ]; then +if [[ ! "$(ls -A /pictures)" ]]; then mv /app/www/public/uploads/* /pictures/ lsiown -R abc:abc /pictures -elif [ ! "$(ls -A /pictures/import 2>/dev/null)" ]; then +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 -if [ ! -L /app/www/public/uploads ]; then +if [[ ! -L /app/www/public/uploads ]]; then rm -rf /app/www/public/uploads ln -s /pictures /app/www/public/uploads fi -if [ ! -L /app/www/public/sym ]; then +if [[ ! -L /app/www/public/sym ]]; then cp -nr /app/www/public/sym/* /config/sym 2> >(grep -v 'cp: not replacing') rm -rf /app/www/public/sym ln -s /config/sym /app/www/public/sym fi -if [ ! -L /app/www/storage/logs ]; then +if [[ ! -L /app/www/storage/logs ]]; then rm -rf /app/www/storage/logs ln -s /config/log /app/www/storage/logs fi @@ -35,9 +35,9 @@ ln -s /config/user.ini /etc/php82/conf.d/99-user.ini cd /app/www || exit 1 -if [ "${DB_CONNECTION}" = "sqlite" ] || [ -z "${DB_CONNECTION}" ]; then - if [ -n "${DB_DATABASE}" ]; then - if [ ! -e "${DB_DATABASE}" ]; then +if [[ "${DB_CONNECTION}" = "sqlite" ]] || [[ -z "${DB_CONNECTION}" ]]; then + if [[ -n "${DB_DATABASE}" ]]; then + if [[ ! -e "${DB_DATABASE}" ]]; then touch "${DB_DATABASE}" lsiown abc:abc "${DB_DATABASE}" fi @@ -46,7 +46,7 @@ if [ "${DB_CONNECTION}" = "sqlite" ] || [ -z "${DB_CONNECTION}" ]; then DB_DATABASE="/config/database.sqlite" export DB_DATABASE fi -elif [ "${DB_CONNECTION}" = "mysql" ]; then +elif [[ "${DB_CONNECTION}" = "mysql" ]]; then if [[ -z "${DB_PORT}" ]]; then DB_PORT="3306" fi @@ -66,7 +66,7 @@ elif [ "${DB_CONNECTION}" = "mysql" ]; then sleep 1 fi done -elif [ "${DB_CONNECTION}" = "pgsql" ]; then +elif [[ "${DB_CONNECTION}" = "pgsql" ]]; then if [[ -z "${DB_PORT}" ]]; then DB_PORT="5432" fi @@ -88,10 +88,10 @@ elif [ "${DB_CONNECTION}" = "pgsql" ]; then done fi -if [ ! -e /config/.env ]; then +if [[ ! -e /config/.env ]]; then cp -n /app/www/.env.example /config/.env 2> >(grep -v 'cp: not replacing') fi -if [ ! -L /app/www/.env ]; then +if [[ ! -L /app/www/.env ]]; then rm -rf /app/www/.env ln -s /config/.env /app/www/.env fi @@ -104,13 +104,13 @@ fi php /app/www/artisan migrate --force touch -a /config/user.css -if [ ! -L /app/www/public/dist/user.css ]; then +if [[ ! -L /app/www/public/dist/user.css ]]; then rm /app/www/public/dist/user.css ln -s /config/user.css /app/www/public/dist/user.css fi touch -a /config/custom.js -if [ ! -L /app/www/public/dist/custom.js ]; then +if [[ ! -L /app/www/public/dist/custom.js ]]; then rm /app/www/public/dist/custom.js ln -s /config/custom.js /app/www/public/dist/custom.js fi From 6b7da39dc5fb1ffd7a2716eeaa586e8ae846c0e0 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 15:53:45 +0000 Subject: [PATCH 04/13] Make consistent with amd64 --- Dockerfile.aarch64 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 0f1cf39..7d6206c 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -27,13 +27,11 @@ RUN \ php82-exif \ php82-gd \ php82-intl \ - php82-mysqli \ php82-pdo_mysql \ php82-pdo_pgsql \ php82-pdo_sqlite \ php82-pecl-imagick \ php82-pecl-redis \ - php82-pgsql \ php82-sqlite3 \ php82-tokenizer && \ echo "**** configure php-fpm to pass env vars ****" && \ @@ -45,7 +43,11 @@ RUN \ | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ mkdir -p /app/www && \ - git clone --branch "${LYCHEE_VERSION}" --recurse-submodules https://github.com/LycheeOrg/Lychee.git /app/www && \ + 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/www --strip-components=1 && \ echo "**** install composer dependencies ****" && \ composer install \ -d /app/www \ From 814ff1f291dad80b56653f4448101aed2b4161d7 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 15:59:14 +0000 Subject: [PATCH 05/13] Don't copy empty sym directory contents --- root/etc/s6-overlay/s6-rc.d/init-lychee-config/run | 1 - 1 file changed, 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index ff878a8..34172ed 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -19,7 +19,6 @@ if [[ ! -L /app/www/public/uploads ]]; then fi if [[ ! -L /app/www/public/sym ]]; then - cp -nr /app/www/public/sym/* /config/sym 2> >(grep -v 'cp: not replacing') rm -rf /app/www/public/sym ln -s /config/sym /app/www/public/sym fi From e7177cf013e65993600ba9ca58aea72e0159f0f2 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 16:14:28 +0000 Subject: [PATCH 06/13] Add pg client --- Dockerfile | 3 ++- Dockerfile.aarch64 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 503b847..3bc8099 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,8 @@ RUN \ php82-pecl-imagick \ php82-pecl-redis \ php82-sqlite3 \ - php82-tokenizer && \ + php82-tokenizer \ + postgresql15-client && \ echo "**** configure php-fpm to pass env vars ****" && \ sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php82/php-fpm.d/www.conf && \ grep -qxF 'clear_env = no' /etc/php82/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php82/php-fpm.d/www.conf && \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 7d6206c..b2d8057 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -33,7 +33,8 @@ RUN \ php82-pecl-imagick \ php82-pecl-redis \ php82-sqlite3 \ - php82-tokenizer && \ + php82-tokenizer \ + postgresql15-client && \ echo "**** configure php-fpm to pass env vars ****" && \ sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php82/php-fpm.d/www.conf && \ grep -qxF 'clear_env = no' /etc/php82/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php82/php-fpm.d/www.conf && \ From 3380886580cb75532ec7c152455b9b7999fbf4be Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 16:14:47 +0000 Subject: [PATCH 07/13] Fix PG ready test, remove port assumptions --- root/etc/s6-overlay/s6-rc.d/init-lychee-config/run | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index 34172ed..d8beff8 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -43,12 +43,9 @@ if [[ "${DB_CONNECTION}" = "sqlite" ]] || [[ -z "${DB_CONNECTION}" ]]; then lsiown abc:abc "${DB_DATABASE}" else DB_DATABASE="/config/database.sqlite" - export DB_DATABASE + printf "/config/database.sqlite" > /var/run/s6/container_environment/DB_DATABASE fi elif [[ "${DB_CONNECTION}" = "mysql" ]]; then - if [[ -z "${DB_PORT}" ]]; then - DB_PORT="3306" - fi echo "Waiting for DB to be available" END=$((SECONDS + 30)) while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do @@ -66,13 +63,10 @@ elif [[ "${DB_CONNECTION}" = "mysql" ]]; then fi done elif [[ "${DB_CONNECTION}" = "pgsql" ]]; then - if [[ -z "${DB_PORT}" ]]; then - DB_PORT="5432" - fi echo "Waiting for DB to be available" END=$((SECONDS + 30)) while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do - if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then + if pg_isready -h "${DB_HOST}" -p "${DB_PORT}" -q; then if [[ -n "${RUN}" ]]; then break fi From 579030bcca8281f4d2ad191d28a9aa8a40a9cc49 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 16:16:45 +0000 Subject: [PATCH 08/13] Export sqlite path properly --- root/etc/s6-overlay/s6-rc.d/init-lychee-config/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index d8beff8..910434a 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -43,7 +43,7 @@ if [[ "${DB_CONNECTION}" = "sqlite" ]] || [[ -z "${DB_CONNECTION}" ]]; then lsiown abc:abc "${DB_DATABASE}" else DB_DATABASE="/config/database.sqlite" - printf "/config/database.sqlite" > /var/run/s6/container_environment/DB_DATABASE + export DB_DATABASE fi elif [[ "${DB_CONNECTION}" = "mysql" ]]; then echo "Waiting for DB to be available" From c3b7d028e92098294010de0e0a626b6475caf93f Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 16:28:05 +0000 Subject: [PATCH 09/13] Clean up npm cache --- Dockerfile | 3 ++- Dockerfile.aarch64 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3bc8099..390d919 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,7 +73,8 @@ RUN \ rm -rf \ /tmp/* \ $HOME/.cache \ - $HOME/.composer + $HOME/.composer \ + $HOME/.npm # copy local files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index b2d8057..fa9cf29 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -73,7 +73,8 @@ RUN \ rm -rf \ /tmp/* \ $HOME/.cache \ - $HOME/.composer + $HOME/.composer \ + $HOME/.npm # copy local files COPY root/ / From 17c1b1dccd2e0536488a739efee6cec4ccbf1e03 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 16:36:47 +0000 Subject: [PATCH 10/13] Actually fix sqlite path export --- root/etc/s6-overlay/s6-rc.d/init-lychee-config/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index 910434a..d8beff8 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -43,7 +43,7 @@ if [[ "${DB_CONNECTION}" = "sqlite" ]] || [[ -z "${DB_CONNECTION}" ]]; then lsiown abc:abc "${DB_DATABASE}" else DB_DATABASE="/config/database.sqlite" - export DB_DATABASE + printf "/config/database.sqlite" > /var/run/s6/container_environment/DB_DATABASE fi elif [[ "${DB_CONNECTION}" = "mysql" ]]; then echo "Waiting for DB to be available" From 3caa48cda3eaa1e74b57dd2bec0298ded2bb14a6 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 17:02:31 +0000 Subject: [PATCH 11/13] Require DB_CONNECTION to be set --- jenkins-vars.yml | 2 +- readme-vars.yml | 2 +- root/etc/s6-overlay/s6-rc.d/init-lychee-config/run | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 37f7452..46fd903 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -25,6 +25,6 @@ repo_vars: - CI_PORT='80' - CI_SSL='false' - CI_DELAY='120' - - CI_DOCKERENV='TZ=US/Pacific' + - CI_DOCKERENV='TZ=Europe/London|DB_CONNECTION=sqlite' - CI_AUTH='user:password' - CI_WEBPATH='' diff --git a/readme-vars.yml b/readme-vars.yml index e1d02c2..f540e37 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -26,7 +26,7 @@ param_ports: - { external_port: "80", internal_port: "80", port_desc: "http gui" } param_usage_include_env: true param_env_vars: - - { env_var: "DB_CONNECTION", env_value: "sqlite", desc: "DB type, from `sqlite`, `mysql`, `pqsql`." } + - { env_var: "DB_CONNECTION", env_value: "", desc: "DB type, from `sqlite`, `mysql`, `pqsql`." } - { env_var: "DB_HOST", env_value: "", desc: "DB server hostname. For `mysql` and `pgsql` only." } - { env_var: "DB_PORT", env_value: "", desc: "DB server port. For `mysql` and `pgsql` only." } - { env_var: "DB_USERNAME", env_value: "", desc: "DB user. For `mysql` and `pgsql` only." } diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index d8beff8..a34f236 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -34,7 +34,10 @@ ln -s /config/user.ini /etc/php82/conf.d/99-user.ini cd /app/www || exit 1 -if [[ "${DB_CONNECTION}" = "sqlite" ]] || [[ -z "${DB_CONNECTION}" ]]; then +if [[ -z "${DB_CONNECTION}" ]]; then + echo "**** No DB_CONNECTION configured, halting init ****" + sleep infinity +elif [[ "${DB_CONNECTION}" = "sqlite" ]]; then if [[ -n "${DB_DATABASE}" ]]; then if [[ ! -e "${DB_DATABASE}" ]]; then touch "${DB_DATABASE}" @@ -43,6 +46,7 @@ if [[ "${DB_CONNECTION}" = "sqlite" ]] || [[ -z "${DB_CONNECTION}" ]]; then lsiown abc:abc "${DB_DATABASE}" else DB_DATABASE="/config/database.sqlite" + export DB_DATABASE printf "/config/database.sqlite" > /var/run/s6/container_environment/DB_DATABASE fi elif [[ "${DB_CONNECTION}" = "mysql" ]]; then From 498fa265df93233e4e1bd503e7be0b443578fff8 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Wed, 27 Dec 2023 17:06:32 +0000 Subject: [PATCH 12/13] Remembered to run builder --- Jenkinsfile | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a787814..d10e9d1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ pipeline { CI_PORT='80' CI_SSL='false' CI_DELAY='120' - CI_DOCKERENV='TZ=US/Pacific' + CI_DOCKERENV='TZ=Europe/London|DB_CONNECTION=sqlite' CI_AUTH='user:password' CI_WEBPATH='' } diff --git a/README.md b/README.md index 9ed0cf4..823a246 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ services: - PUID=1000 - PGID=1000 - TZ=Etc/UTC - - DB_CONNECTION=sqlite + - DB_CONNECTION= - DB_HOST= - DB_PORT= - DB_USERNAME= @@ -124,7 +124,7 @@ docker run -d \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Etc/UTC \ - -e DB_CONNECTION=sqlite \ + -e DB_CONNECTION= \ -e DB_HOST= \ -e DB_PORT= \ -e DB_USERNAME= \ @@ -150,7 +150,7 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e PUID=1000` | for UserID - see below for explanation | | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). | -| `-e DB_CONNECTION=sqlite` | DB type, from `sqlite`, `mysql`, `pqsql`. | +| `-e DB_CONNECTION=` | DB type, from `sqlite`, `mysql`, `pqsql`. | | `-e DB_HOST=` | DB server hostname. For `mysql` and `pgsql` only. | | `-e DB_PORT=` | DB server port. For `mysql` and `pgsql` only. | | `-e DB_USERNAME=` | DB user. For `mysql` and `pgsql` only. | From b2fe18b51eff9bf9eefcb3fb6899be3a657b79d2 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Thu, 28 Dec 2023 18:57:07 +0000 Subject: [PATCH 13/13] Create subfolder for lychee logs --- root/etc/s6-overlay/s6-rc.d/init-lychee-config/run | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run index a34f236..046d3c7 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-lychee-config/run @@ -2,7 +2,8 @@ # shellcheck shell=bash mkdir -p \ - /config/{sym,log} \ + /config/sym \ + /config/log/lychee \ /pictures # pre-populate /pictures directory if it's empty @@ -25,7 +26,7 @@ fi if [[ ! -L /app/www/storage/logs ]]; then rm -rf /app/www/storage/logs - ln -s /config/log /app/www/storage/logs + ln -s /config/log/lychee /app/www/storage/logs fi cp -n /defaults/user.ini /config/user.ini 2> >(grep -v 'cp: not replacing')