From b817c88fc79a42326263bf5f93fdeb3bffe6ae04 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 24 Apr 2023 10:55:56 +0200 Subject: [PATCH] test https://github.com/alexbelgium/hassio-addons/issues/798#issuecomment-1519633404 --- photoprism/CHANGELOG.md | 12 ++++++ photoprism/Dockerfile | 9 ++--- photoprism/config.json | 4 +- .../rootfs/etc/cont-init.d/00-folders.sh | 5 +++ photoprism/rootfs/etc/cont-init.d/99-run.sh | 38 +++++++++++++------ 5 files changed, 50 insertions(+), 18 deletions(-) diff --git a/photoprism/CHANGELOG.md b/photoprism/CHANGELOG.md index 90e1a640a..a99322aa3 100644 --- a/photoprism/CHANGELOG.md +++ b/photoprism/CHANGELOG.md @@ -1,42 +1,54 @@ +- Allow environment to be available from command line ### Preview-6 (15-04-2023) + - Minor bugs fixed - Implemented healthcheck - Add message if ingress disabled ## Preview (27-01-2023) + - Switch build to preview - Add "video": true - Default PHOTOPRISM_DETECT_NSFW true - Add sys_rawio ## 20220121 (10-12-2022) + - Update to latest version from photoprism/photoprism - BREAKING CHANGE : url for direct access to be updated, check logs for url to use - WARNING : update to supervisor 2022.11 before installing ## 20220121 (01-09-2022) + - Update to latest version from photoprism/photoprism ## 220730-jammy (04-08-2022) + - Update to latest version from photoprism/photoprism ## 220728-jammy (30-07-2022) + - Update to latest version from photoprism/photoprism ## 220629-jammy (30-06-2022) + - Update to latest version from photoprism/photoprism ## 220617-jammy (18-06-2022) + - Update to latest version from photoprism/photoprism ## 220614-jammy (16-06-2022) + - Update to latest version from photoprism/photoprism ## 220528-jammy (31-05-2022) + - Update to latest version from photoprism/photoprism ## 220524-bookworm (26-05-2022) + - Update to latest version from photoprism/photoprism - Feat: ingress implementation diff --git a/photoprism/Dockerfile b/photoprism/Dockerfile index e5df90457..b91e9f1df 100644 --- a/photoprism/Dockerfile +++ b/photoprism/Dockerfile @@ -28,9 +28,8 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \ S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ S6_SERVICES_GRACETIME=0 -ENV \ - working_dir="/data/photoprism" \ - HOME="/data/photoprism" +RUN \ + sed -i "s|HOME=\"/photoprism|HOME=\"/data/photoprism|g" /scripts/entrypoint.sh ################## # 3 Install apps # @@ -77,9 +76,9 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get ################ RUN chmod 777 /entrypoint.sh +ENTRYPOINT [ "/usr/bin/env" ] +CMD [ "/entrypoint.sh" ] WORKDIR "/data/photprism" -ENTRYPOINT [ "/entrypoint.sh" ] -CMD ["/opt/photoprism/bin/photoprism", "start"] ############ # 5 Labels # diff --git a/photoprism/config.json b/photoprism/config.json index 55abeca9c..8c113d08e 100644 --- a/photoprism/config.json +++ b/photoprism/config.json @@ -118,6 +118,6 @@ ], "slug": "photoprism", "url": "https://github.com/alexbelgium/hassio-addons-test", - "version": "DONOTUSE_test-14", + "version": "DONOTUSE_test-15", "video": true -} +} \ No newline at end of file diff --git a/photoprism/rootfs/etc/cont-init.d/00-folders.sh b/photoprism/rootfs/etc/cont-init.d/00-folders.sh index abb852226..1a2573bfb 100755 --- a/photoprism/rootfs/etc/cont-init.d/00-folders.sh +++ b/photoprism/rootfs/etc/cont-init.d/00-folders.sh @@ -22,3 +22,8 @@ echo "... setting permissions" chmod -R 777 /data/photoprism chown -Rf photoprism:photoprism /data/photoprism chmod -Rf a+rwx /data/photoprism +for line in BACKUP_PATH IMPORT_PATH ORIGINALS_PATH STORAGE_PATH; do + mkdir -p "$line" + chmod -R 777 "$line" + chown -Rf photoprism:photoprism "$line" +done diff --git a/photoprism/rootfs/etc/cont-init.d/99-run.sh b/photoprism/rootfs/etc/cont-init.d/99-run.sh index 9ab5fc194..78abf6060 100755 --- a/photoprism/rootfs/etc/cont-init.d/99-run.sh +++ b/photoprism/rootfs/etc/cont-init.d/99-run.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bashio # shellcheck shell=bash +set +u + ################### # Define database # ################### @@ -32,13 +34,23 @@ case $(bashio::config 'DB_TYPE') in PHOTOPRISM_DATABASE_NAME="photoprism" PHOTOPRISM_DATABASE_USER="$(bashio::services 'mysql' 'username')" PHOTOPRISM_DATABASE_PASSWORD="$(bashio::services 'mysql' 'password')" - export PHOTOPRISM_DATABASE_DRIVER && bashio::log.blue "PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER" - export PHOTOPRISM_DATABASE_SERVER && bashio::log.blue "PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER" - export PHOTOPRISM_DATABASE_NAME && bashio::log.blue "PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME" - export PHOTOPRISM_DATABASE_USER && bashio::log.blue "PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER" - export PHOTOPRISM_DATABASE_PASSWORD && bashio::log.blue "PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD" + export PHOTOPRISM_DATABASE_DRIVER && \ + sed -i "1a PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER" /scripts/entrypoint.sh && \ + bashio::log.blue "PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER" + export PHOTOPRISM_DATABASE_SERVER && \ + sed -i "1a PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER" /scripts/entrypoint.sh && \ + bashio::log.blue "PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER" + export PHOTOPRISM_DATABASE_NAME && \ + sed -i "1a PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME" /scripts/entrypoint.sh && \ + bashio::log.blue "PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME" + export PHOTOPRISM_DATABASE_USER && \ + sed -i "1a PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER" /scripts/entrypoint.sh && \ + bashio::log.blue "PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER" + export PHOTOPRISM_DATABASE_PASSWORD && \ + sed -i "1a PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD" /scripts/entrypoint.sh && \ + bashio::log.blue "PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD" - bashio::log.warning "Webtrees is using the Maria DB addon" + bashio::log.warning "Photoprism is using the Maria DB addon" bashio::log.warning "Please ensure this is included in your backups" bashio::log.warning "Uninstalling the MariaDB addon will remove any data" @@ -62,6 +74,7 @@ if bashio::config.true "ingress_disabled"; then else PHOTOPRISM_SITE_URL="$(bashio::addon.ingress_entry)/" export PHOTOPRISM_SITE_URL + sed -i "1a PHOTOPRISM_SITE_URL=$PHOTOPRISM_SITE_URL" /scripts/entrypoint.sh bashio::log.warning "Ingress is enabled. To connect, you must add $PHOTOPRISM_SITE_URL to the end of your access point. Example : http://my-url:8123$PHOTOPRISM_SITE_URL" fi @@ -80,6 +93,11 @@ export PHOTOPRISM_STORAGE_PATH export PHOTOPRISM_ORIGINALS_PATH export PHOTOPRISM_IMPORT_PATH export PHOTOPRISM_BACKUP_PATH +sed -i "1a PHOTOPRISM_UPLOAD_NSFW=$PHOTOPRISM_UPLOAD_NSFW" /scripts/entrypoint.sh +sed -i "1a PHOTOPRISM_STORAGE_PATH=$PHOTOPRISM_STORAGE_PATH" /scripts/entrypoint.sh +sed -i "1a PHOTOPRISM_ORIGINALS_PATH=$PHOTOPRISM_ORIGINALS_PATH" /scripts/entrypoint.sh +sed -i "1a PHOTOPRISM_IMPORT_PATH=$PHOTOPRISM_IMPORT_PATH" /scripts/entrypoint.sh +sed -i "1a PHOTOPRISM_BACKUP_PATH=$PHOTOPRISM_BACKUP_PATH" /scripts/entrypoint.sh # Test configs for variabletest in $PHOTOPRISM_STORAGE_PATH $PHOTOPRISM_ORIGINALS_PATH $PHOTOPRISM_IMPORT_PATH $PHOTOPRISM_BACKUP_PATH; do @@ -101,17 +119,15 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then PGID="$(bashio::config "PGID")" export PHOTOPRISM_UID="$PUID" export PHOTOPRISM_GID="$PGID" + sed -i "1a PHOTOPRISM_UID=$PHOTOPRISM_UID" /scripts/entrypoint.sh + sed -i "1a PHOTOPRISM_GID=$PHOTOPRISM_GID" /scripts/entrypoint.sh fi # Start messages bashio::log.info "Please wait 1 or 2 minutes to allow the server to load" bashio::log.info 'Default username : admin, default password: "please_change_password"' -set +u - -# shellcheck source=/dev/null -. /scripts/entrypoint.sh photoprism start & \ -bashio::log.info "Starting, please wait for \"App launched\" green text..." +. /scripts/entrypoint.sh photoprism start & bashio::log.info "Starting, please wait for next green text..." bashio::net.wait_for 2341 localhost 900 bashio::log.info "App launched"