From dd2c803b13ffaf485147f5b709fbbd60ccf5c9d3 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 27 Mar 2023 23:11:41 +0200 Subject: [PATCH 01/56] initial v2 --- conf/.env | 4 +- conf/docker-image-extract.src | 7 --- conf/options.yml | 2 +- conf/systemd.service | 6 +- manifest.toml | 84 +++++++++++++++++++++++++ scripts/_common.sh | 4 +- scripts/backup | 20 +++--- scripts/change_url | 88 +++++++++++++------------- scripts/install | 114 +++++++++++++++++----------------- scripts/remove | 34 +++++----- scripts/restore | 58 ++++++++--------- scripts/upgrade | 92 +++++++++++++-------------- 12 files changed, 296 insertions(+), 217 deletions(-) delete mode 100644 conf/docker-image-extract.src create mode 100644 manifest.toml diff --git a/conf/.env b/conf/.env index 5348400..45a980d 100644 --- a/conf/.env +++ b/conf/.env @@ -3,7 +3,7 @@ PHOTOPRISM_CACHE_PATH="/home/yunohost.app/__APP__/cache" PHOTOPRISM_ORIGINALS_PATH="/home/yunohost.app/__APP__/photos/originals" PHOTOPRISM_IMPORT_PATH="/home/yunohost.app/__APP__/photos/import" PHOTOPRISM_TEMP_PATH="/home/yunohost.app/__APP__/temp" -PHOTOPRISM_SITE_URL="https://__DOMAIN____PATH_URL__" +PHOTOPRISM_SITE_URL="https://__DOMAIN____PATH__" PHOTOPRISM_ADMIN_PASSWORD="__PASSWORD__" PHOTOPRISM_HTTP_HOST="127.0.0.1" PHOTOPRISM_HTTP_MODE="release" @@ -18,7 +18,7 @@ PHOTOPRISM_DEFAULT_LOCALE="__LANGUAGE_KEY__" PHOTOPRISM_SITE_DESCRIPTION="__APP__" PHOTOPRISM_DEBUG="false" PHOTOPRISM_DARKTABLE_BIN="/usr/bin/darktable-cli" -PHOTOPRISM_HEIFCONVERT_BIN="__FINALPATH__/bin/heif-convert" +PHOTOPRISM_HEIFCONVERT_BIN="__INSTALL_DIR__/bin/heif-convert" PHOTOPRISM_FFMPEG_BIN="/usr/bin/ffmpeg" PHOTOPRISM_EXIFTOOL_BIN="/usr/bin/exiftool" PHOTOPRISM_UPLOAD_NSFW="true" \ No newline at end of file diff --git a/conf/docker-image-extract.src b/conf/docker-image-extract.src deleted file mode 100644 index 64fe1a1..0000000 --- a/conf/docker-image-extract.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://codeload.github.com/jjlin/docker-image-extract/tar.gz/a9e455e44bbbfba897bf3342d9661b182cee67a9 -SOURCE_SUM=9eb0c734e83a3fd7102fc7209af4977024ec467fbc819782491af47295675f67 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/options.yml b/conf/options.yml index 193ec99..730b5cb 100644 --- a/conf/options.yml +++ b/conf/options.yml @@ -5,7 +5,7 @@ CachePath: /home/yunohost.app/__APP__/cache OriginalsPath: /home/yunohost.app/__APP__/photos/originals ImportPath: /home/yunohost.app/__APP__/photos/import TempPath: /home/yunohost.app/__APP__/temp -SiteUrl: https://__DOMAIN____PATH_URL__ +SiteUrl: https://__DOMAIN____PATH__ AdminPassword: __PASSWORD__ HttpServerHost: 127.0.0.1 HttpMode: release diff --git a/conf/systemd.service b/conf/systemd.service index bc93e44..36af161 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -17,9 +17,9 @@ BindReadOnlyPaths=-/lib/ -/lib64/ -/usr/lib/ -/usr/lib64/ -/etc/ld.so.cache -/et BindReadOnlyPaths=-/dev/log -/run/systemd/journal/socket -/run/systemd/journal/stdout -/run/systemd/notify BindPaths=/var/www/photoprism /var/www/photoprism/live/bin /home/yunohost.app/photoprism -/usr -/etc -/var -/home -/dev -/etc -/media -/mnt -/opt -/proc -/run -/srv -/sys -/tmp -EnvironmentFile=__FINALPATH__/.env -WorkingDirectory=__FINALPATH__/live/bin -ExecStart=__FINALPATH__/live/bin/photoprism --trace start +EnvironmentFile=__INSTALL_DIR__/.env +WorkingDirectory=__INSTALL_DIR__/live/bin +ExecStart=__INSTALL_DIR__/live/bin/photoprism --trace start StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit TimeoutSec=900 diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..9f42f7b --- /dev/null +++ b/manifest.toml @@ -0,0 +1,84 @@ +packaging_format = 2 + +id = "photoprism" +name = "Photoprism" +description.en = "AI-Powered Photos App for the Decentralized Web" +description.fr = "Gestion de photos en ligne" + +version = "2022.09.01~ynh3" + +maintainers = ["Thovi98"] + +[upstream] +license = "AGPL-3.0-only" +website = "https://photoprism.app" +demo = "https://demo-fr.photoprism.app" +admindoc = "https://docs.photoprism.app/developer-guide/" +userdoc = "https://docs.photoprism.app/user-guide/" +code = "https://github.com/photoprism/photoprism" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 11.0.9.11" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = true +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + + [install.path] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "path" + default = "/example" + + [install.init_main_permission] + help.en = "If enabled, Photoprism will be accessible by mobile apps and by users without a YunoHost account. This can be changed later in the webadmin." + help.fr = "Si cette case est cochée, Photoprism sera accessible par des applications mobiles et par les utilisateurs n’ayant pas de compte YunoHost. Vous pourrez changer cela dans la webadmin." + type = "group" + default = "visitors" + + [install.language] + ask.en = "Choose the application language" + ask.fr = "Choisissez la langue de l'application" + type = "string" + choices = ["fr", "en"] + default = "fr" + + [install.password] + # this is a generic question - ask strings are automatically handled by Yunohost's core + help.en = "Photoprism currently supports only one user : admin. Choose a password here." + help.fr = "Photoprism ne permet qu'un seul utilisateur pour le moment. Choisissez un mot de passe ici." + type = "password" + +[resources] + [resources.sources] + [resources.sources.docker-image-extract] + url = "https://codeload.github.com/jjlin/docker-image-extract/tar.gz/a9e455e44bbbfba897bf3342d9661b182cee67a9" + sha256 = "9eb0c734e83a3fd7102fc7209af4977024ec467fbc819782491af47295675f67" + + + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 8095 + + [resources.apt] + packages = "libc6-dev, libssl-dev, libxft-dev, libhdf5-serial-dev, libpng-dev, libheif-examples, librsvg2-bin, libx264-dev, libx265-dev, libnss3, libfreetype6, libfreetype6-dev, libfontconfig1, libfontconfig1-dev, libzmq3-dev, ffmpeg, libimage-exiftool-perl" + + [resources.database] + type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index ef8c307..cd72703 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -24,8 +24,8 @@ function detect_arch() { esac } -#pkg_dependencies="libc6-dev libssl-dev libxft-dev libhdf5-serial-dev libpng-dev libheif-examples librsvg2-bin libx264-dev libx265-dev libnss3 libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev libzmq3-dev" -pkg_dependencies="ffmpeg libimage-exiftool-perl" +#REMOVEME? #pkg_dependencies="libc6-dev libssl-dev libxft-dev libhdf5-serial-dev libpng-dev libheif-examples librsvg2-bin libx264-dev libx265-dev libnss3 libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev libzmq3-dev" +#REMOVEME? pkg_dependencies="ffmpeg libimage-exiftool-perl" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index bcc70c1..d84a2f2 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -41,13 +41,13 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE DATA DIR #================================================= -ynh_backup --src_path="$datadir" --is_big +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index c969588..11d7794 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,63 +13,63 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) # Add settings here as needed by your application -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -language_key=$(ynh_app_setting_get --app=$app --key=language_key) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -port=$(ynh_app_setting_get --app=$app --key=port) -password=$(ynh_app_setting_get --app=$app --key=password) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." +#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { + #REMOVEME? ynh_clean_check_starting # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -86,28 +86,30 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +ynh_change_url_nginx_config + +#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf # Change the path in the NGINX config file if [ $change_path -eq 1 ] then # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? ynh_add_nginx_config fi # Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -116,14 +118,14 @@ fi # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." - +#REMOVEME? domain=$new_domain -path_url=$new_path +path=$new_path -ynh_add_config --template="options.yml" --destination="$final_path/live/config/options.yml" +ynh_add_config --template="options.yml" --destination="$install_dir/live/config/options.yml" -chmod 400 "$final_path/live/config/options.yml" -chown $app:$app "$final_path/live/config/options.yml" +chmod 400 "$install_dir/live/config/options.yml" +chown $app:$app "$install_dir/live/config/options.yml" #================================================= # GENERIC FINALISATION @@ -138,9 +140,9 @@ ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 4f77f31..0792520 100755 --- a/scripts/install +++ b/scripts/install @@ -13,23 +13,23 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC -language=$YNH_APP_ARG_LANGUAGE -password=$YNH_APP_ARG_PASSWORD +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? language=$YNH_APP_ARG_LANGUAGE +#REMOVEME? password=$YNH_APP_ARG_PASSWORD -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME if [ $language == "fr" ]; then language_key="french" @@ -40,72 +40,72 @@ fi #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." +#REMOVEME? ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=language_key --value=$language_key -ynh_app_setting_set --app=$app --key=password --value=$password +#REMOVEME? ynh_app_setting_set --app=$app --key=password --value=$password #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." +#REMOVEME? ynh_script_progression --message="Finding an available port..." # Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=8095) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." +#REMOVEME? ynh_script_progression --message="Installing dependencies..." -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." +#REMOVEME? ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." +#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." -db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) +#REMOVEME? db_user=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path/build/" --source_id="docker-image-extract" +ynh_setup_source --dest_dir="$install_dir/build/" --source_id="docker-image-extract" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -123,43 +123,43 @@ ynh_add_nginx_config ynh_script_progression --message="Making install..." # Install photoprism -pushd $final_path/build +pushd $install_dir/build detect_arch ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION popd -mkdir -p "$final_path/live/" -rsync -a "$final_path/build/output/opt/photoprism/" "$final_path/live/" -ynh_secure_remove --file="$final_path/build" +mkdir -p "$install_dir/live/" +rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" +#REMOVEME? ynh_secure_remove --file="$install_dir/build" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # CREATE DATA DIRECTORY #================================================= ynh_script_progression --message="Creating a data directory..." -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir +#REMOVEME? data_dir=/home/yunohost.app/$app +#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir -mkdir -p $datadir -rsync -a "$final_path/live/assets/" "$datadir/assets/" -ynh_secure_remove --file="$final_path/live/assets/" +mkdir -p $data_dir +rsync -a "$install_dir/live/assets/" "$data_dir/assets/" +#REMOVEME? ynh_secure_remove --file="$install_dir/live/assets/" -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 600 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 600 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # SETUP SYSTEMD @@ -197,25 +197,25 @@ ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +#REMOVEME? ynh_script_progression --message="Configuring permissions..." # Make app public if necessary -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then # Everyone can access the app. # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi # Permission to make link-sharing work -ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" +#REMOVEME? ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 59b3537..f45d82e 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # STANDARD REMOVE @@ -55,18 +55,18 @@ ynh_remove_logrotate #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." +#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." +#REMOVEME? ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE DATA DIR @@ -76,7 +76,7 @@ ynh_secure_remove --file="$final_path" if [ "${YNH_APP_PURGE:-0}" -eq 1 ] then ynh_script_progression --message="Removing app data directory..." - ynh_secure_remove --file="$datadir" +#REMOVEME? ynh_secure_remove --file="$data_dir" fi #================================================= @@ -90,10 +90,10 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." +#REMOVEME? ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # CLOSE A PORT @@ -120,10 +120,10 @@ ynh_secure_remove --file="/var/log/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 78ffe43..cdc7b94 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,77 +14,77 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= ynh_script_progression --message="Restoring the data directory..." -ynh_restore_file --origin_path="$datadir" --not_mandatory +ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $datadir +mkdir -p $data_dir -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE NGINX CONFIGURATION @@ -96,10 +96,10 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." +#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e80393f..541d63d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,20 +12,20 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -language_key=$(ynh_app_setting_get --app=$app --key=language_key) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -port=$(ynh_app_setting_get --app=$app --key=port) -password=$(ynh_app_setting_get --app=$app --key=password) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # CHECK VERSION @@ -37,17 +37,17 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -65,23 +65,23 @@ ynh_script_progression --message="Ensuring downward compatibility..." # If language_key doesn't exist, create it if [ -z "$language_key" ]; then - language_key=$(ynh_app_setting_get --app=$app --key=language) +#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language) ynh_app_setting_set --app=$app --key=language_key --value=$language_key ynh_app_setting_delete --app=$app --key=language fi # Create sharing permission if needed -if ! ynh_permission_exists --permission="sharing"; then - ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" +#REMOVEME? if ! ynh_permission_exists --permission="sharing"; then +#REMOVEME? ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -92,19 +92,19 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path/build/" --source_id="docker-image-extract" + ynh_setup_source --dest_dir="$install_dir/build/" --source_id="docker-image-extract" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # NGINX CONFIGURATION @@ -124,44 +124,44 @@ ynh_script_progression --message="Making install..." if [ "$upgrade_type" == "UPGRADE_APP" ] then # Install photoprism - pushd $final_path/build + pushd $install_dir/build detect_arch ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION popd - mkdir -p "$final_path/live/" - rsync -a "$final_path/build/output/opt/photoprism/" "$final_path/live/" - ynh_secure_remove --file="$final_path/build" + mkdir -p "$install_dir/live/" + rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" +#REMOVEME? ynh_secure_remove --file="$install_dir/build" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # UPDATE DATA DIRECTORY #================================================= ynh_script_progression --message="Updating data directory..." -mkdir -p $datadir +mkdir -p $data_dir if [ "$upgrade_type" == "UPGRADE_APP" ] then - rsync -a "$final_path/live/assets/" "$datadir/assets/" - ynh_secure_remove --file="$final_path/live/assets/" + rsync -a "$install_dir/live/assets/" "$data_dir/assets/" +#REMOVEME? ynh_secure_remove --file="$install_dir/live/assets/" fi -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 600 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 600 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # SETUP SYSTEMD @@ -198,9 +198,9 @@ ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From b1c0e309fafa6c4fba6057962f268f87b8f299a9 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 27 Mar 2023 23:19:53 +0200 Subject: [PATCH 02/56] First v2 (not yet clean) --- check_process | 27 ---------- doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 manifest.json | 71 --------------------------- 4 files changed, 98 deletions(-) delete mode 100644 check_process rename doc/{DISCLAIMER.md => ADMIN.md} (100%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (100%) delete mode 100644 manifest.json diff --git a/check_process b/check_process deleted file mode 100644 index 85dea2f..0000000 --- a/check_process +++ /dev/null @@ -1,27 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - language="fr" - password="1Strong-Password" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - backup_restore=1 - multi_instance=0 - port_already_use=0 - change_url=1 - # 2022.06.17~ynh1 - upgrade=1 from_commit=4de2ab27722b2300a6faff4f910ecf5b93160cb6 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=4de2ab27722b2300a6faff4f910ecf5b93160cb6 - name=2022.06.17~ynh1 diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index fdc6e5e..0000000 --- a/manifest.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "Photoprism", - "id": "photoprism", - "packaging_format": 1, - "description": { - "en": "AI-Powered Photos App for the Decentralized Web", - "fr": "Gestion de photos en ligne" - }, - "version": "2022.09.01~ynh3", - "url": "photoprism.app", - "upstream": { - "license": "AGPL-3.0-only", - "website": "https://photoprism.app", - "demo": "https://demo-fr.photoprism.app", - "admindoc": "https://docs.photoprism.app/developer-guide/", - "userdoc": "https://docs.photoprism.app/user-guide/", - "code": "https://github.com/photoprism/photoprism" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "Thovi98" - }, - "requirements": { - "yunohost": ">= 11.0.9.11" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/example", - "default": "/example" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, Photoprism will be accessible by mobile apps and by users without a YunoHost account. This can be changed later in the webadmin.", - "fr": "Si cette case est cochée, Photoprism sera accessible par des applications mobiles et par les utilisateurs n’ayant pas de compte YunoHost. Vous pourrez changer cela dans la webadmin." - }, - "default": true - }, - { - "name": "language", - "type": "string", - "ask": { - "en": "Choose the application language", - "fr": "Choisissez la langue de l'application" - }, - "choices": ["fr", "en"], - "default": "fr" - }, - { - "name": "password", - "type": "password", - "help": { - "en": "Photoprism currently supports only one user : admin. Choose a password here.", - "fr": "Photoprism ne permet qu'un seul utilisateur pour le moment. Choisissez un mot de passe ici." - } - } - ] - } -} From 3f111308f5334224eec99e85e650769343096c15 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 28 Mar 2023 07:51:28 +0200 Subject: [PATCH 03/56] Update install --- scripts/install | 9 --------- 1 file changed, 9 deletions(-) diff --git a/scripts/install b/scripts/install index 0792520..5bbdaa4 100755 --- a/scripts/install +++ b/scripts/install @@ -9,15 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST From 7d99d196f8758dcce59cb21886e97da7a7c2f9e3 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 28 Mar 2023 07:52:24 +0200 Subject: [PATCH 04/56] Create tests.toml --- tests.toml | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests.toml diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests.toml @@ -0,0 +1 @@ + From 6b2688e6cbe01ab8b6bc9d38e1040a68e644153d Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 28 Mar 2023 07:57:59 +0200 Subject: [PATCH 05/56] Update tests.toml --- tests.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests.toml b/tests.toml index 8b13789..cbbeef1 100644 --- a/tests.toml +++ b/tests.toml @@ -1 +1,3 @@ +test_format = 1.0 +[default] From 77942fd90e87986e423cfa7d7acc3d8881057e1f Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:05:50 +0200 Subject: [PATCH 06/56] tests --- manifest.toml | 25 ++++++++++++++----------- scripts/install | 8 ++++---- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/manifest.toml b/manifest.toml index 9f42f7b..d75c3f0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,25 +17,23 @@ admindoc = "https://docs.photoprism.app/developer-guide/" userdoc = "https://docs.photoprism.app/user-guide/" code = "https://github.com/photoprism/photoprism" cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. +fund = "https://www.photoprism.app/membership" [integration] -yunohost = ">= 11.0.9.11" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.15" +architectures = ["amd64", "arm64" "armhf"] multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +ldap = false +sso = false disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/example" @@ -53,16 +51,21 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = "fr" [install.password] - # this is a generic question - ask strings are automatically handled by Yunohost's core help.en = "Photoprism currently supports only one user : admin. Choose a password here." help.fr = "Photoprism ne permet qu'un seul utilisateur pour le moment. Choisissez un mot de passe ici." type = "password" [resources] [resources.sources] - [resources.sources.docker-image-extract] - url = "https://codeload.github.com/jjlin/docker-image-extract/tar.gz/a9e455e44bbbfba897bf3342d9661b182cee67a9" - sha256 = "9eb0c734e83a3fd7102fc7209af4977024ec467fbc819782491af47295675f67" + url = "photoprism/photoprism" + format = docker + platform = linux/amd64 + amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + platform = linux/arm64 + arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" + platform = linux/armhf + armhf.sha256 = "sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" + [resources.system_user] diff --git a/scripts/install b/scripts/install index 5bbdaa4..380be4f 100755 --- a/scripts/install +++ b/scripts/install @@ -114,10 +114,10 @@ ynh_add_nginx_config ynh_script_progression --message="Making install..." # Install photoprism -pushd $install_dir/build - detect_arch - ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION -popd +# pushd $install_dir/build + # detect_arch +# ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION +#popd mkdir -p "$install_dir/live/" rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" #REMOVEME? ynh_secure_remove --file="$install_dir/build" From 13e7240d6aefbd7ef530dfbb242a394b7f97d801 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:06:33 +0200 Subject: [PATCH 07/56] fix --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index d75c3f0..37a0042 100644 --- a/manifest.toml +++ b/manifest.toml @@ -81,7 +81,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen main.default = 8095 [resources.apt] - packages = "libc6-dev, libssl-dev, libxft-dev, libhdf5-serial-dev, libpng-dev, libheif-examples, librsvg2-bin, libx264-dev, libx265-dev, libnss3, libfreetype6, libfreetype6-dev, libfontconfig1, libfontconfig1-dev, libzmq3-dev, ffmpeg, libimage-exiftool-perl" + packages = "libc6-dev, libssl-dev, libxft-dev, libhdf5-serial-dev, libpng-dev, libheif-examples, librsvg2-bin, libx264-dev, libx265-dev, libnss3, libfreetype6, libfreetype6-dev, libfontconfig1, libfontconfig1-dev, libzmq3-dev, ffmpeg, libimage-exiftool-perl, mariadb-server" [resources.database] type = "mysql" From a5ea3b6b5083a50c2bad590e6d8e7c5a2240fdae Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:08:11 +0200 Subject: [PATCH 08/56] fixes --- manifest.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index 37a0042..65663f2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -58,12 +58,12 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources] [resources.sources] url = "photoprism/photoprism" - format = docker - platform = linux/amd64 + format = "docker" + platform = "linux/amd64" amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" - platform = linux/arm64 + platform = "linux/arm64" arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" - platform = linux/armhf + platform = "linux/armhf" armhf.sha256 = "sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" From 5bdc77fd98b34707ff169dfaffb9d713cd7158df Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:12:51 +0200 Subject: [PATCH 09/56] fix toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 65663f2..6eaf53a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,7 @@ fund = "https://www.photoprism.app/membership" [integration] yunohost = ">= 11.1.15" -architectures = ["amd64", "arm64" "armhf"] +architectures = ["amd64", "arm64", "armhf"] multi_instance = true ldap = false sso = false From 33c777ebb49b241cc5bd2e877f2aec24bf649425 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:14:56 +0200 Subject: [PATCH 10/56] fix toml --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 6eaf53a..280d00f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -59,11 +59,11 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.sources] url = "photoprism/photoprism" format = "docker" - platform = "linux/amd64" + amd64.platform = "linux/amd64" amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" - platform = "linux/arm64" + arm64.platform = "linux/arm64" arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" - platform = "linux/armhf" + armhf.platform = "linux/armhf" armhf.sha256 = "sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" From e705584a10d923dae9db3af9c44186c2933e645b Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:19:55 +0200 Subject: [PATCH 11/56] test --- manifest.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manifest.toml b/manifest.toml index 280d00f..244f53e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -59,12 +59,12 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.sources] url = "photoprism/photoprism" format = "docker" - amd64.platform = "linux/amd64" - amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" - arm64.platform = "linux/arm64" - arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" - armhf.platform = "linux/armhf" - armhf.sha256 = "sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" + platform = "linux/amd64" + #amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + #arm64.platform = "linux/arm64" + #arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" + #armhf.platform = "linux/armhf" + #armhf.sha256 = "sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" From a3a1a8c22d7a48e6a70182c7e110d11ccc0b8997 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:26:40 +0200 Subject: [PATCH 12/56] test --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 244f53e..9dd9e7e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,7 +57,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources] [resources.sources] - url = "photoprism/photoprism" + url = "https://hub.docker.com/layers/photoprism/photoprism/220901-bullseye/images/sha256-3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4?context=explore" format = "docker" platform = "linux/amd64" #amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" From fdaab87cb99514aedc29fe791cf2bd8af63bf2dc Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:30:29 +0200 Subject: [PATCH 13/56] test --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 9dd9e7e..c30f2be 100644 --- a/manifest.toml +++ b/manifest.toml @@ -60,7 +60,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen url = "https://hub.docker.com/layers/photoprism/photoprism/220901-bullseye/images/sha256-3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4?context=explore" format = "docker" platform = "linux/amd64" - #amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" #arm64.platform = "linux/arm64" #arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" #armhf.platform = "linux/armhf" From b5fcd15f85a0c11ad0d12d00b35473ce56f46bea Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:30:41 +0200 Subject: [PATCH 14/56] fix --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index c30f2be..377245d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -60,7 +60,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen url = "https://hub.docker.com/layers/photoprism/photoprism/220901-bullseye/images/sha256-3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4?context=explore" format = "docker" platform = "linux/amd64" - amd64.sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" #arm64.platform = "linux/arm64" #arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" #armhf.platform = "linux/armhf" From af6464f66abc6c174450ae660ed0e69496d29c00 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:48:29 +0200 Subject: [PATCH 15/56] test --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 377245d..8bc6f13 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,10 +57,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources] [resources.sources] - url = "https://hub.docker.com/layers/photoprism/photoprism/220901-bullseye/images/sha256-3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4?context=explore" + url = "photoprism/photoprism:220901-bullseye" format = "docker" platform = "linux/amd64" - sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" #arm64.platform = "linux/arm64" #arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" #armhf.platform = "linux/armhf" From add54b04166dbc223b86bc1a17a052a92f7fffc9 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 21:01:52 +0200 Subject: [PATCH 16/56] test --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 8bc6f13..96c1b45 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,7 @@ fund = "https://www.photoprism.app/membership" [integration] yunohost = ">= 11.1.15" -architectures = ["amd64", "arm64", "armhf"] +architectures = "all" multi_instance = true ldap = false sso = false From 3c07c05f499520af1fce9c883b47130bdf678594 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 21:26:26 +0200 Subject: [PATCH 17/56] cleanup --- scripts/install | 103 +++++------------------------------------------- 1 file changed, 9 insertions(+), 94 deletions(-) diff --git a/scripts/install b/scripts/install index 380be4f..530aecb 100755 --- a/scripts/install +++ b/scripts/install @@ -14,85 +14,25 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? language=$YNH_APP_ARG_LANGUAGE -#REMOVEME? password=$YNH_APP_ARG_PASSWORD - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - if [ $language == "fr" ]; then language_key="french" else language_key="english" fi -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=language_key --value=$language_key -#REMOVEME? ynh_app_setting_set --app=$app --key=password --value=$password - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=8095) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - -#================================================= -# CREATE A MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." - -#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? db_user=$db_name -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir/build/" --source_id="docker-image-extract" +ynh_setup_source chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" @@ -113,14 +53,15 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Making install..." -# Install photoprism -# pushd $install_dir/build - # detect_arch -# ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION -#popd +Install photoprism +pushd $install_dir/build + detect_arch + ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION +popd + mkdir -p "$install_dir/live/" rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" -#REMOVEME? ynh_secure_remove --file="$install_dir/build" +ynh_secure_remove --file="$install_dir/build" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" @@ -131,12 +72,9 @@ chown -R $app:$app "$install_dir" #================================================= ynh_script_progression --message="Creating a data directory..." -#REMOVEME? data_dir=/home/yunohost.app/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir - mkdir -p $data_dir rsync -a "$install_dir/live/assets/" "$data_dir/assets/" -#REMOVEME? ynh_secure_remove --file="$install_dir/live/assets/" +ynh_secure_remove --file="$install_dir/live/assets/" chmod 750 "$data_dir" chmod -R o-rwx "$data_dir" @@ -185,29 +123,6 @@ ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." - -# Make app public if necessary -#REMOVEME? if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -# Permission to make link-sharing work -#REMOVEME? ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= From 53b0e0a954b8c53e99f5783e9b53d3d7334f1470 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 21:44:00 +0200 Subject: [PATCH 18/56] fixes --- manifest.toml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/manifest.toml b/manifest.toml index 96c1b45..d099feb 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,14 +57,17 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources] [resources.sources] - url = "photoprism/photoprism:220901-bullseye" - format = "docker" - platform = "linux/amd64" - sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" - #arm64.platform = "linux/arm64" - #arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" - #armhf.platform = "linux/armhf" - #armhf.sha256 = "sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" + [resources.sources.main] + url = "photoprism/photoprism:220901-bullseye" + format = "docker" + platform = "linux/amd64" + sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + xtract = true + in_subdir = true + #arm64.platform = "linux/arm64" + #arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" + #armhf.platform = "linux/armhf" + #armhf.sha256 = "sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" From fad6a747fbcb183a31532e6aa47d1d8a5123a0b7 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 21:49:20 +0200 Subject: [PATCH 19/56] test --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index d099feb..1baab0e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -58,7 +58,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources] [resources.sources] [resources.sources.main] - url = "photoprism/photoprism:220901-bullseye" + url = "https://hub.docker.com/layers/photoprism/photoprism/220901-bullseye/images/sha256-3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4?context=explore" format = "docker" platform = "linux/amd64" sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" From 68218c37bd6845b0175fee8557a9061dfc967eaa Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 21:54:27 +0200 Subject: [PATCH 20/56] test --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 1baab0e..98d36ed 100644 --- a/manifest.toml +++ b/manifest.toml @@ -61,7 +61,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen url = "https://hub.docker.com/layers/photoprism/photoprism/220901-bullseye/images/sha256-3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4?context=explore" format = "docker" platform = "linux/amd64" - sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" xtract = true in_subdir = true #arm64.platform = "linux/arm64" From 5ccb3dc13739a2c2e1eab8e7dcfe99feb212e41c Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 21:58:50 +0200 Subject: [PATCH 21/56] fix shasum --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 98d36ed..ef4f28b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -61,7 +61,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen url = "https://hub.docker.com/layers/photoprism/photoprism/220901-bullseye/images/sha256-3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4?context=explore" format = "docker" platform = "linux/amd64" - sha256 = "sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + sha256 = "bce58aa68677dec456dddcf2c494e316c1d6dbf23f0283a9879b25c2232289f4" xtract = true in_subdir = true #arm64.platform = "linux/arm64" From ace79661046214b8754ce334feb0863315520181 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 22:05:48 +0200 Subject: [PATCH 22/56] test --- scripts/install | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index 530aecb..58a5560 100755 --- a/scripts/install +++ b/scripts/install @@ -32,7 +32,7 @@ ynh_app_setting_set --app=$app --key=language_key --value=$language_key ynh_script_progression --message="Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source + chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" @@ -54,10 +54,7 @@ ynh_add_nginx_config ynh_script_progression --message="Making install..." Install photoprism -pushd $install_dir/build - detect_arch - ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION -popd +ynh_setup_source --dest_dir="$final_path/build" mkdir -p "$install_dir/live/" rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" From 5241d1102c501be6a1d59473e60388f3bcc7aa2c Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 22:14:43 +0200 Subject: [PATCH 23/56] fix --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index 58a5560..9176aac 100755 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,6 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Making install..." -Install photoprism ynh_setup_source --dest_dir="$final_path/build" mkdir -p "$install_dir/live/" From a8b10b4418d61102ce7c88113299b31f7f8b9b34 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 22:20:58 +0200 Subject: [PATCH 24/56] fix --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 9176aac..06eb82e 100755 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Making install..." -ynh_setup_source --dest_dir="$final_path/build" +ynh_setup_source --dest_dir="$install_dir/build" mkdir -p "$install_dir/live/" rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" From 5b35ddbd23056251287f4e3898c2e59434919cb1 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 29 Mar 2023 22:28:41 +0200 Subject: [PATCH 25/56] test --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index ef4f28b..d099feb 100644 --- a/manifest.toml +++ b/manifest.toml @@ -58,10 +58,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources] [resources.sources] [resources.sources.main] - url = "https://hub.docker.com/layers/photoprism/photoprism/220901-bullseye/images/sha256-3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4?context=explore" + url = "photoprism/photoprism:220901-bullseye" format = "docker" platform = "linux/amd64" - sha256 = "bce58aa68677dec456dddcf2c494e316c1d6dbf23f0283a9879b25c2232289f4" + sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" xtract = true in_subdir = true #arm64.platform = "linux/arm64" From e4de6280730f613805f23c43e70d5b2c37499f7c Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 30 Mar 2023 12:29:07 +0200 Subject: [PATCH 26/56] prefetch = false --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index d099feb..cc79fe1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -62,8 +62,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen format = "docker" platform = "linux/amd64" sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" - xtract = true - in_subdir = true + extract = true + prefetch = false #arm64.platform = "linux/arm64" #arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" #armhf.platform = "linux/armhf" From c53cf2d66b846a21997466a2a0ea9731cbb08a21 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 30 Mar 2023 21:07:27 +0200 Subject: [PATCH 27/56] test --- scripts/install | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/install b/scripts/install index 06eb82e..aeb4916 100755 --- a/scripts/install +++ b/scripts/install @@ -56,6 +56,13 @@ ynh_script_progression --message="Making install..." ynh_setup_source --dest_dir="$install_dir/build" mkdir -p "$install_dir/live/" + +ls -lah "$install_dir/" +ls -lah "$install_dir/build/" +ls -lah "$install_dir/build/output/" +ls -lah "$install_dir/build/output/opt/" +ls -lah "$install_dir/build/output/opt/photoprism/" + rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" ynh_secure_remove --file="$install_dir/build" From 05164105b8af213fe6cfa9ccb217412cf5ebb940 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 30 Mar 2023 21:31:03 +0200 Subject: [PATCH 28/56] test --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index aeb4916..02cb93e 100755 --- a/scripts/install +++ b/scripts/install @@ -59,6 +59,8 @@ mkdir -p "$install_dir/live/" ls -lah "$install_dir/" ls -lah "$install_dir/build/" +ls -lah "$install_dir/build/opt/" +ls -lah "$install_dir/build/photoprism/" ls -lah "$install_dir/build/output/" ls -lah "$install_dir/build/output/opt/" ls -lah "$install_dir/build/output/opt/photoprism/" From 4dd17970667749fd5dd986c45e2aa72091277344 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 30 Mar 2023 22:19:45 +0200 Subject: [PATCH 29/56] update dir --- scripts/install | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 02cb93e..6ab4940 100755 --- a/scripts/install +++ b/scripts/install @@ -61,11 +61,9 @@ ls -lah "$install_dir/" ls -lah "$install_dir/build/" ls -lah "$install_dir/build/opt/" ls -lah "$install_dir/build/photoprism/" -ls -lah "$install_dir/build/output/" -ls -lah "$install_dir/build/output/opt/" -ls -lah "$install_dir/build/output/opt/photoprism/" -rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" + +rsync -a "$install_dir/build/opt/photoprism/" "$install_dir/live/" ynh_secure_remove --file="$install_dir/build" chmod 750 "$install_dir" From 2f50faa998814b89a440ac204f50c8778459b7a4 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 30 Mar 2023 22:20:25 +0200 Subject: [PATCH 30/56] update dir --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 6ab4940..f192416 100755 --- a/scripts/install +++ b/scripts/install @@ -60,6 +60,7 @@ mkdir -p "$install_dir/live/" ls -lah "$install_dir/" ls -lah "$install_dir/build/" ls -lah "$install_dir/build/opt/" +ls -lah "$install_dir/build/opt/photoprism/" ls -lah "$install_dir/build/photoprism/" From 3d720df96745e070966cf8a432920b584b9b6548 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 08:00:35 +0200 Subject: [PATCH 31/56] fix backup --- scripts/backup | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/scripts/backup b/scripts/backup index d84a2f2..f0a47cd 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP From aff25055f085301e20c2019a14a6441bc75b47d2 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 08:13:15 +0200 Subject: [PATCH 32/56] first fix upgrade --- scripts/upgrade | 70 ++++++------------------------------------------- 1 file changed, 8 insertions(+), 62 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 541d63d..d32ec9b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,23 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # CHECK VERSION @@ -34,29 +17,6 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." - -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -65,23 +25,18 @@ ynh_script_progression --message="Ensuring downward compatibility..." # If language_key doesn't exist, create it if [ -z "$language_key" ]; then -#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language) + language_key=$(ynh_app_setting_get --app=$app --key=language) ynh_app_setting_set --app=$app --key=language_key --value=$language_key ynh_app_setting_delete --app=$app --key=language fi # Create sharing permission if needed -#REMOVEME? if ! ynh_permission_exists --permission="sharing"; then -#REMOVEME? ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" + if ! ynh_permission_exists --permission="sharing"; then + ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" fi -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -92,19 +47,13 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir/build/" --source_id="docker-image-extract" + ynh_setup_source --dest_dir="$install_dir/build/" fi chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # NGINX CONFIGURATION @@ -146,7 +95,7 @@ mkdir -p $data_dir if [ "$upgrade_type" == "UPGRADE_APP" ] then rsync -a "$install_dir/live/assets/" "$data_dir/assets/" -#REMOVEME? ynh_secure_remove --file="$install_dir/live/assets/" + ynh_secure_remove --file="$install_dir/live/assets/" fi chmod 750 "$data_dir" @@ -195,12 +144,9 @@ ynh_script_progression --message="Starting a systemd service..." ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload + + #================================================= # END OF SCRIPT From 85cc9925f0ff37e7ed18753c1bd28414a12dc54f Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 08:21:00 +0200 Subject: [PATCH 33/56] fix upgrade --- scripts/upgrade | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d32ec9b..c5ef3d0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,8 +46,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir/build/" + fi chmod 750 "$install_dir" @@ -72,14 +71,13 @@ ynh_script_progression --message="Making install..." if [ "$upgrade_type" == "UPGRADE_APP" ] then - # Install photoprism - pushd $install_dir/build - detect_arch - ./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION - popd + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$install_dir/build/" + mkdir -p "$install_dir/live/" rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" -#REMOVEME? ynh_secure_remove --file="$install_dir/build" + ynh_secure_remove --file="$install_dir/build" fi chmod 750 "$install_dir" From c63a6a8cc29a04247e084f2c1b688ea03b7ad877 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 12:08:26 +0200 Subject: [PATCH 34/56] fix restore --- scripts/restore | 50 +------------------------------------------------ 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/scripts/restore b/scripts/restore index cdc7b94..5af031e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,47 +10,12 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS #================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" + #================================================= # RESTORE THE APP MAIN DIR @@ -79,12 +44,7 @@ chown -R $app:www-data "$data_dir" #================================================= # SPECIFIC RESTORATION #================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE NGINX CONFIGURATION @@ -93,14 +53,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." - -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RESTORE SYSTEMD From 1016bc310742af9e5617a914bc7d53082eb11926 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 12:11:58 +0200 Subject: [PATCH 35/56] fix change_url --- scripts/change_url | 84 ++-------------------------------------------- 1 file changed, 3 insertions(+), 81 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 11d7794..b7f92a1 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,68 +9,9 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -# Add settings here as needed by your application -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - #REMOVEME? ynh_clean_check_starting - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi #================================================= # STANDARD MODIFICATIONS @@ -88,29 +29,10 @@ ynh_script_progression --message="Updating NGINX web server configuration..." ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? ynh_add_nginx_config -fi -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi + + #================================================= # SPECIFIC MODIFICATIONS @@ -118,7 +40,7 @@ fi # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." -#REMOVEME? + domain=$new_domain path=$new_path From c7bab74463700625783ff813316c977704419bfa Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:27:53 +0200 Subject: [PATCH 36/56] v2 cleanup + readd permissions --- manifest.toml | 8 ++++-- scripts/backup | 1 - scripts/change_url | 16 ----------- scripts/remove | 69 ---------------------------------------------- 4 files changed, 6 insertions(+), 88 deletions(-) diff --git a/manifest.toml b/manifest.toml index cc79fe1..173a985 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,13 +16,12 @@ demo = "https://demo-fr.photoprism.app" admindoc = "https://docs.photoprism.app/developer-guide/" userdoc = "https://docs.photoprism.app/user-guide/" code = "https://github.com/photoprism/photoprism" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) fund = "https://www.photoprism.app/membership" [integration] yunohost = ">= 11.1.15" architectures = "all" -multi_instance = true +multi_instance = false ldap = false sso = false disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... @@ -80,6 +79,11 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + sharing.url = "/s" + sharing.allowd = "visitors" + sharing.show_tile = false + sharing.protected = true + [resources.ports] main.default = 8095 diff --git a/scripts/backup b/scripts/backup index f0a47cd..e038863 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,7 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index b7f92a1..c6af2bb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,10 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers - - - - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -29,11 +25,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." ynh_change_url_nginx_config - - - - - #================================================= # SPECIFIC MODIFICATIONS #================================================= @@ -59,13 +50,6 @@ ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index f45d82e..3a39fdc 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,20 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - #================================================= # STANDARD REMOVE #================================================= @@ -52,33 +38,6 @@ ynh_script_progression --message="Removing logrotate configuration..." # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." -#REMOVEME? ynh_secure_remove --file="$data_dir" -fi - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -87,24 +46,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # SPECIFIC REMOVE #================================================= @@ -115,16 +56,6 @@ ynh_script_progression --message="Removing various files..." # Remove the log files ynh_secure_remove --file="/var/log/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= From 8283aaf4bf74a86f550f34c55bcb9cea7b928285 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:31:09 +0200 Subject: [PATCH 37/56] test adding multiple platforms --- manifest.toml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/manifest.toml b/manifest.toml index 173a985..57b4785 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,16 +57,21 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources] [resources.sources] [resources.sources.main] - url = "photoprism/photoprism:220901-bullseye" format = "docker" - platform = "linux/amd64" - sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" extract = true prefetch = false - #arm64.platform = "linux/arm64" - #arm64.sha256 = "sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" - #armhf.platform = "linux/armhf" - #armhf.sha256 = "sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" + + amd64.url = "photoprism/photoprism:220901-bullseye" + amd64.platform = "linux/amd64" + amd64.sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" + + arm64.url = "photoprism/photoprism:220901-bullseye" + arm64.platform = "linux/arm64" + arm64.sha256 = "3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" + + armhf.url = "photoprism/photoprism:220901-bullseye" + armhf.platform = "linux/armhf" + armhf.sha256 = "a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" From a80b113259da1f01850f6b732010682fa0a94a04 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:58:34 +0200 Subject: [PATCH 38/56] Fix upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index c5ef3d0..932e5e2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,7 +76,7 @@ then ynh_setup_source --dest_dir="$install_dir/build/" mkdir -p "$install_dir/live/" - rsync -a "$install_dir/build/output/opt/photoprism/" "$install_dir/live/" + rsync -a "$install_dir/build/opt/photoprism/" "$install_dir/live/" ynh_secure_remove --file="$install_dir/build" fi From 147f54897637e81077f6e97f5326635a17c45f5c Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 18:24:59 +0200 Subject: [PATCH 39/56] fix --- manifest.toml | 6 +++--- scripts/change_url | 2 ++ scripts/upgrade | 9 +-------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/manifest.toml b/manifest.toml index 57b4785..2276d61 100644 --- a/manifest.toml +++ b/manifest.toml @@ -24,9 +24,9 @@ architectures = "all" multi_instance = false ldap = false sso = false -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] diff --git a/scripts/change_url b/scripts/change_url index c6af2bb..2e45e03 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,6 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers +password=$(ynh_app_setting_get --app=$app --key=password) + #================================================= # STANDARD MODIFICATIONS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 932e5e2..71e9cf3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,6 +9,7 @@ source _common.sh source /usr/share/yunohost/helpers +password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # CHECK VERSION @@ -30,14 +31,6 @@ if [ -z "$language_key" ]; then ynh_app_setting_delete --app=$app --key=language fi -# Create sharing permission if needed - if ! ynh_permission_exists --permission="sharing"; then - ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true" -fi - - - - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From 6e9cae37a1a30b7ad74236391dfd7b6301a978f0 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 20:11:04 +0200 Subject: [PATCH 40/56] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 2276d61..a8cbcfa 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,7 +20,7 @@ fund = "https://www.photoprism.app/membership" [integration] yunohost = ">= 11.1.15" -architectures = "all" +architectures = ["amd64", "arm64", "armhf"] multi_instance = false ldap = false sso = false From 090a8c7126fc80513cef245117005c1861df1c7a Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 20:14:18 +0200 Subject: [PATCH 41/56] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index a8cbcfa..69ff5ba 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Photoprism" description.en = "AI-Powered Photos App for the Decentralized Web" description.fr = "Gestion de photos en ligne" -version = "2022.09.01~ynh3" +version = "2022.09.01~ynh4" maintainers = ["Thovi98"] From 6b77932686b3a1ae324fb788760f1727eec20923 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 23:25:21 +0200 Subject: [PATCH 42/56] Update tests.toml --- tests.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests.toml b/tests.toml index cbbeef1..1cbd6ce 100644 --- a/tests.toml +++ b/tests.toml @@ -1,3 +1,5 @@ test_format = 1.0 [default] + +test_upgrade_from.fe71ba9.name = "Upgrade from packaging v1" From b192bcb703d7c2005f77e22f902b7488e1bce935 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 15 Jun 2023 22:25:30 +0200 Subject: [PATCH 43/56] some cleanings --- scripts/change_url | 2 +- scripts/install | 9 +-------- scripts/restore | 2 +- scripts/upgrade | 22 +--------------------- tests.toml | 2 +- 5 files changed, 5 insertions(+), 32 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 2e45e03..63b5a55 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -50,7 +50,7 @@ chown $app:$app "$install_dir/live/config/options.yml" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" +ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started AI-Powered Photos App for the Decentralized Web" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index f192416..8c49a55 100755 --- a/scripts/install +++ b/scripts/install @@ -57,13 +57,6 @@ ynh_setup_source --dest_dir="$install_dir/build" mkdir -p "$install_dir/live/" -ls -lah "$install_dir/" -ls -lah "$install_dir/build/" -ls -lah "$install_dir/build/opt/" -ls -lah "$install_dir/build/opt/photoprism/" -ls -lah "$install_dir/build/photoprism/" - - rsync -a "$install_dir/build/opt/photoprism/" "$install_dir/live/" ynh_secure_remove --file="$install_dir/build" @@ -125,7 +118,7 @@ yunohost service add $app --description="AI-Powered Photos App for the Decentral ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" +ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started AI-Powered Photos App for the Decentralized Web" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 5af031e..c8e492f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -84,7 +84,7 @@ yunohost service add $app --description="AI-Powered Photos App for the Decentral #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" +ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started AI-Powered Photos App for the Decentralized Web" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 71e9cf3..0edc771 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,22 +31,6 @@ if [ -z "$language_key" ]; then ynh_app_setting_delete --app=$app --key=language fi -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." - - -fi - -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - - #================================================= # NGINX CONFIGURATION #================================================= @@ -133,11 +117,7 @@ yunohost service add $app --description="AI-Powered Photos App for the Decentral #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at" - - - - +ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started AI-Powered Photos App for the Decentralized Web" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml index 1cbd6ce..08e2532 100644 --- a/tests.toml +++ b/tests.toml @@ -2,4 +2,4 @@ test_format = 1.0 [default] -test_upgrade_from.fe71ba9.name = "Upgrade from packaging v1" +test_upgrade_from.fe71ba9.name = "Packaging v1" From 002a5a720e8b098861309512491d5cd3fe3c41f7 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 17 Jul 2023 20:56:38 +0000 Subject: [PATCH 44/56] Auto-update README --- README.md | 17 +---------------- README_fr.md | 21 +++------------------ 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 3288aa5..fc137cb 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ PhotoPrism® is an AI-Powered Photos App for the Decentralized Web. It makes use - Automatic classification of pictures based on their content and location -**Shipped version:** 2022.09.01~ynh3 +**Shipped version:** 2022.09.01~ynh4 **Demo:** https://demo-fr.photoprism.app @@ -36,21 +36,6 @@ PhotoPrism® is an AI-Powered Photos App for the Decentralized Web. It makes use ![Screenshot of Photoprism](./doc/screenshots/photoprism.jpg) -## Disclaimers / important information - -* Known limitations: - * Although reaching level 7, Photoprism hasn't yet been extensively tested in real conditions - * Please use with **extreme care** if you install it on a test server ! - * Photoprism currently supports only one user. OIDC should be supported within a few months - * Photoprism requires an important amount of RAM and disk to install or to work properly - -* All data is stored in `/home/yunohost.app/photoprism/photos/` - * Be careful, this data is not backed-up by default when doing a backup - -* At first install, you'll be prompted for credentials - * Username is "admin" - * Password is the password you have set during the installation - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index dc3880a..eb9787c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -28,7 +28,7 @@ PhotoPrism® est une application de photos alimentée par l'IA pour le Web déce - Classification automatique des photos en fonction de leur contenu et de leur emplacement -**Version incluse :** 2022.09.01~ynh3 +**Version incluse :** 2022.09.01~ynh4 **Démo :** https://demo-fr.photoprism.app @@ -36,28 +36,13 @@ PhotoPrism® est une application de photos alimentée par l'IA pour le Web déce ![Capture d’écran de Photoprism](./doc/screenshots/photoprism.jpg) -## Avertissements / informations importantes - -* Limites connues : - * Bien qu'ayant atteint le niveau 7, Photoprism n'a pas encore été testé de manière approfondie en conditions réelles. - * Veuillez l'utiliser avec **extrême prudence** si vous l'installez sur un serveur de test ! - * Photoprism ne supporte actuellement qu'un seul utilisateur. OIDC devrait être supporté d'ici quelques mois. - * Photoprism nécessite une quantité importante de RAM et de disque pour être installé et fonctionner correctement. - -* Les données sont stockées dans `/home/yunohost.app/photoprism/photos/` - * Attention, ces données ne sont pas sauvegardées par défaut lorsqu'une sauvegarde est lancée - -* Lors de la première installation, il vous sera demandé de fournir des informations d'identification. - * Le nom d'utilisateur est "admin". - * Le mot de passe est celui que vous avez défini lors de l'installation. - ## Documentations et ressources * Site officiel de l’app : * Documentation officielle utilisateur : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* YunoHost Store: +* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs @@ -72,4 +57,4 @@ ou sudo yunohost app upgrade photoprism -u https://github.com/YunoHost-Apps/photoprism_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** From 2589edf9800ce8295b48977388ae49c07b33fdde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 17 Jul 2023 23:11:24 +0200 Subject: [PATCH 45/56] cleaning --- .github/workflows/updater.sh | 137 ----------------------------------- manifest.toml | 13 ++-- scripts/_common.sh | 3 - 3 files changed, 6 insertions(+), 147 deletions(-) delete mode 100755 .github/workflows/updater.sh diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100755 index 72eb5cb..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - -#================================================= -# PACKAGE UPDATING HELPER -#================================================= - -# This script is meant to be run by GitHub Actions -# The YunoHost-Apps organisation offers a template Action to run this script periodically -# Since each app is different, maintainers can adapt its contents so as to perform -# automatic actions when a new upstream release is detected. - -# Remove this exit command when you are ready to run this Action -exit 1 - -#================================================= -# FETCHING LATEST RELEASE AND ITS ASSETS -#================================================= - -# Fetching information -current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') -repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') -# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) -version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) - -# Later down the script, we assume the version has only digits and dots -# Sometimes the release name starts with a "v", so let's filter it out. -# You may need more tweaks here if the upstream repository has different naming conventions. -if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then - version=${version:1} -fi - -# Setting up the environment variables -echo "Current version: $current_version" -echo "Latest release from upstream: $version" -echo "VERSION=$version" >> $GITHUB_ENV -echo "REPO=$repo" >> $GITHUB_ENV -# For the time being, let's assume the script will fail -echo "PROCEED=false" >> $GITHUB_ENV - -# Proceed only if the retrieved version is greater than the current one -if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then - echo "::warning ::No new version available" - exit 0 -# Proceed only if a PR for this new version does not already exist -elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then - echo "::warning ::A branch already exists for this update" - exit 0 -fi - -# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) -echo "${#assets[@]} available asset(s)" - -#================================================= -# UPDATE SOURCE FILES -#================================================= - -# Here we use the $assets variable to get the resources published in the upstream release. -# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. - -# Let's loop over the array of assets URLs -for asset_url in ${assets[@]}; do - -echo "Handling asset at $asset_url" - -# Assign the asset to a source file in conf/ directory -# Here we base the source file name upon a unique keyword in the assets url (admin vs. update) -# Leave $src empty to ignore the asset -case $asset_url in - *"admin"*) - src="app" - ;; - *"update"*) - src="app-upgrade" - ;; - *) - src="" - ;; -esac - -# If $src is not empty, let's process the asset -if [ ! -z "$src" ]; then - -# Create the temporary directory -tempdir="$(mktemp -d)" - -# Download sources and calculate checksum -filename=${asset_url##*/} -curl --silent -4 -L $asset_url -o "$tempdir/$filename" -checksum=$(sha256sum "$tempdir/$filename" | head -c 64) - -# Delete temporary directory -rm -rf $tempdir - -# Get extension -if [[ $filename == *.tar.gz ]]; then - extension=tar.gz -else - extension=${filename##*.} -fi - -# Rewrite source file -cat < conf/$src.src -SOURCE_URL=$asset_url -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=$extension -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -EOT -echo "... conf/$src.src updated" - -else -echo "... asset ignored" -fi - -done - -#================================================= -# SPECIFIC UPDATE STEPS -#================================================= - -# Any action on the app's source code can be done. -# The GitHub Action workflow takes care of committing all changes after this script ends. - -#================================================= -# GENERIC FINALIZATION -#================================================= - -# Replace new version in manifest -echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json - -# No need to update the README, yunohost-bot takes care of it - -# The Action will proceed only if the PROCEED environment variable is set to true -echo "PROCEED=true" >> $GITHUB_ENV -exit 0 diff --git a/manifest.toml b/manifest.toml index 69ff5ba..c66d88e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,13 +19,13 @@ code = "https://github.com/photoprism/photoprism" fund = "https://www.photoprism.app/membership" [integration] -yunohost = ">= 11.1.15" +yunohost = ">= 11.1.21" architectures = ["amd64", "arm64", "armhf"] multi_instance = false -ldap = false -sso = false +ldap = false +sso = false disk = "50M" -ram.build = "50M" +ram.build = "300M" ram.runtime = "50M" [install] @@ -34,7 +34,7 @@ ram.runtime = "50M" [install.path] type = "path" - default = "/example" + default = "/photoprism" [install.init_main_permission] help.en = "If enabled, Photoprism will be accessible by mobile apps and by users without a YunoHost account. This can be changed later in the webadmin." @@ -73,13 +73,12 @@ ram.runtime = "50M" armhf.platform = "linux/armhf" armhf.sha256 = "a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" - - [resources.system_user] [resources.install_dir] [resources.data_dir] + subdirs = ["assets"] [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index cd72703..6949207 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -24,9 +24,6 @@ function detect_arch() { esac } -#REMOVEME? #pkg_dependencies="libc6-dev libssl-dev libxft-dev libhdf5-serial-dev libpng-dev libheif-examples librsvg2-bin libx264-dev libx265-dev libnss3 libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev libzmq3-dev" -#REMOVEME? pkg_dependencies="ffmpeg libimage-exiftool-perl" - #================================================= # PERSONAL HELPERS #================================================= From 3c4cdc11cd7ed393ea83648586af597d12848fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 17 Jul 2023 23:12:07 +0200 Subject: [PATCH 46/56] Update install --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 8c49a55..3f99be2 100755 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,6 @@ ynh_script_progression --message="Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src - chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -69,7 +68,7 @@ chown -R $app:$app "$install_dir" #================================================= ynh_script_progression --message="Creating a data directory..." -mkdir -p $data_dir +#mkdir -p $data_dir rsync -a "$install_dir/live/assets/" "$data_dir/assets/" ynh_secure_remove --file="$install_dir/live/assets/" From baf6c5e5a59d723883a365722d4b460b463c11fe Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 24 Jul 2023 18:36:17 +0200 Subject: [PATCH 47/56] Rework ADMIN / POST_INSTALL notification ... the known limitation thing sounds outdated or covered by manifest v2, so idk, removing it ... --- doc/ADMIN.md | 13 +------------ doc/ADMIN_fr.md | 13 +------------ doc/POST_INSTALL.md | 5 +++++ doc/POST_INSTALL_fr.md | 5 +++++ 4 files changed, 12 insertions(+), 24 deletions(-) create mode 100644 doc/POST_INSTALL.md create mode 100644 doc/POST_INSTALL_fr.md diff --git a/doc/ADMIN.md b/doc/ADMIN.md index f695703..399c75c 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,12 +1 @@ -* Known limitations: - * Although reaching level 7, Photoprism hasn't yet been extensively tested in real conditions - * Please use with **extreme care** if you install it on a test server ! - * Photoprism currently supports only one user. OIDC should be supported within a few months - * Photoprism requires an important amount of RAM and disk to install or to work properly - -* All data is stored in `/home/yunohost.app/photoprism/photos/` - * Be careful, this data is not backed-up by default when doing a backup - -* At first install, you'll be prompted for credentials - * Username is "admin" - * Password is the password you have set during the installation +All data is stored in `__DATA_DIR__/photos/`. Be careful, this data is not backed-up by default when doing a backup diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index bbcf1c5..cf3b6fa 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,12 +1 @@ -* Limites connues : - * Bien qu'ayant atteint le niveau 7, Photoprism n'a pas encore été testé de manière approfondie en conditions réelles. - * Veuillez l'utiliser avec **extrême prudence** si vous l'installez sur un serveur de test ! - * Photoprism ne supporte actuellement qu'un seul utilisateur. OIDC devrait être supporté d'ici quelques mois. - * Photoprism nécessite une quantité importante de RAM et de disque pour être installé et fonctionner correctement. - -* Les données sont stockées dans `/home/yunohost.app/photoprism/photos/` - * Attention, ces données ne sont pas sauvegardées par défaut lorsqu'une sauvegarde est lancée - -* Lors de la première installation, il vous sera demandé de fournir des informations d'identification. - * Le nom d'utilisateur est "admin". - * Le mot de passe est celui que vous avez défini lors de l'installation. +Les données sont stockées dans `__DATA_DIR__/photos/`. Attention, ces données ne sont pas sauvegardées par défaut lorsqu'une sauvegarde est lancée diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md new file mode 100644 index 0000000..b4ca1d3 --- /dev/null +++ b/doc/POST_INSTALL.md @@ -0,0 +1,5 @@ +At first install, you'll be prompted for credentials +- Username is `admin` +- Password is the password you have set during the installation + +All data is stored in `__DATA_DIR__/photos/`. Be careful, this data is not backed-up by default when doing a backup diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md new file mode 100644 index 0000000..98ef9a5 --- /dev/null +++ b/doc/POST_INSTALL_fr.md @@ -0,0 +1,5 @@ +Lors de la première installation, il vous sera demandé de fournir des informations d'identification. +- Le nom d'utilisateur est `admin`. +- Le mot de passe est celui que vous avez défini lors de l'installation. + +Les données sont stockées dans `__DATA_DIR__/photos/`. Attention, ces données ne sont pas sauvegardées par défaut lorsqu'une sauvegarde est lancée From 615a162461b686ce77ff52e244e5c8520aa50a49 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 24 Jul 2023 18:42:12 +0200 Subject: [PATCH 48/56] This 'detect_arch' function doesn't seem to be used anywhere --- scripts/_common.sh | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6949207..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,26 +4,6 @@ # COMMON VARIABLES #================================================= -function detect_arch() { - case "$YNH_ARCH" in - "amd64") - PHOTOPRISM_VERSION="sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" - ;; - - "arm64") - PHOTOPRISM_VERSION="sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" - ;; - - "armhf") - PHOTOPRISM_VERSION="sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" - ;; - - *) - ynh_die --message="Your server architecture ($YNH_ARCH) is not supported." - ;; - esac -} - #================================================= # PERSONAL HELPERS #================================================= From 6a1fc503e22c78e7918a32ea36f26473babd33a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 27 Jul 2023 08:33:55 +0100 Subject: [PATCH 49/56] Update manifest.toml Co-authored-by: Alexandre Aubin --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index c66d88e..9d0196e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -84,7 +84,7 @@ ram.runtime = "50M" main.url = "/" sharing.url = "/s" - sharing.allowd = "visitors" + sharing.allowed = "visitors" sharing.show_tile = false sharing.protected = true From c2a790c015c12a928c9d2c82310f02540e13d413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 27 Jul 2023 08:34:02 +0100 Subject: [PATCH 50/56] Update manifest.toml Co-authored-by: Alexandre Aubin --- manifest.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 9d0196e..df86f32 100644 --- a/manifest.toml +++ b/manifest.toml @@ -62,15 +62,12 @@ ram.runtime = "50M" prefetch = false amd64.url = "photoprism/photoprism:220901-bullseye" - amd64.platform = "linux/amd64" amd64.sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4" arm64.url = "photoprism/photoprism:220901-bullseye" - arm64.platform = "linux/arm64" arm64.sha256 = "3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f" armhf.url = "photoprism/photoprism:220901-bullseye" - armhf.platform = "linux/armhf" armhf.sha256 = "a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e" [resources.system_user] From 1add9b72401ab2c7ed82095fd097a6556264d43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 27 Jul 2023 08:34:13 +0100 Subject: [PATCH 51/56] Update scripts/change_url Co-authored-by: Alexandre Aubin --- scripts/change_url | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 63b5a55..1643020 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,7 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # STANDARD MODIFICATIONS From 86a05d80670f1a8766513459af328be8800e585b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 27 Jul 2023 08:34:22 +0100 Subject: [PATCH 52/56] Update scripts/upgrade Co-authored-by: Alexandre Aubin --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0edc771..c4a65c9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,7 +25,7 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Ensuring downward compatibility..." # If language_key doesn't exist, create it -if [ -z "$language_key" ]; then +if [ -z "${language_key:-}" ]; then language_key=$(ynh_app_setting_get --app=$app --key=language) ynh_app_setting_set --app=$app --key=language_key --value=$language_key ynh_app_setting_delete --app=$app --key=language From 7d89034a049f08595714e5eeb49804075ba88100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 27 Jul 2023 08:34:53 +0100 Subject: [PATCH 53/56] Update scripts/upgrade Co-authored-by: Alexandre Aubin --- scripts/upgrade | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index c4a65c9..8b0463d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,7 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # CHECK VERSION From ab33bc18cbf90c48728793884c491c3801819cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 29 Jan 2024 23:17:10 +0100 Subject: [PATCH 54/56] Save up password --- scripts/install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install b/scripts/install index 3f99be2..5eb1c29 100755 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,9 @@ fi ynh_app_setting_set --app=$app --key=language_key --value=$language_key +# Not saved by default +ynh_app_setting_set --app=$app --key=password --value="$password" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From be9d0a84e108a9fb2b78ebeb048abdeb15f6f586 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 29 Jan 2024 22:17:15 +0000 Subject: [PATCH 55/56] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index eb9787c..ccfe74b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -42,7 +42,7 @@ PhotoPrism® est une application de photos alimentée par l'IA pour le Web déce * Documentation officielle utilisateur : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs From 9dd9693831c46429f972247cc5ab7d2394d2c2cb Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 30 Jan 2024 09:18:00 +0000 Subject: [PATCH 56/56] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index ccfe74b..ced9a94 100644 --- a/README_fr.md +++ b/README_fr.md @@ -57,4 +57,4 @@ ou sudo yunohost app upgrade photoprism -u https://github.com/YunoHost-Apps/photoprism_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file