From 87017229373c4e7c5aa30e7c3e9308d697b188aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:04:39 +0100 Subject: [PATCH 01/31] v2 --- conf/systemd.service | 2 +- manifest.toml | 54 +++++++++++++++++++++++++++++ scripts/_common.sh | 2 +- scripts/backup | 16 ++++----- scripts/install | 82 ++++++++++++++++++++++---------------------- scripts/remove | 28 +++++++-------- scripts/restore | 48 +++++++++++++------------- scripts/upgrade | 54 ++++++++++++++--------------- 8 files changed, 170 insertions(+), 116 deletions(-) create mode 100644 manifest.toml diff --git a/conf/systemd.service b/conf/systemd.service index d80f6ae..9bbb4ec 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ +WorkingDirectory=__INSTALL_DIR__/ #Environment=NODE_ENV=production Environment=PORT=__PORT__ Environment="__YNH_NODE_LOAD_PATH__" diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..d2547c1 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,54 @@ +packaging_format = 2 + +id = "umami" +name = "Umami" +description.en = "Simple, fast, privacy-focused alternative to Google Analytics" +description.fr = "Analyse de trafic web simple et respectueux" + +version = "1.40.0~ynh1" + +maintainers = ["eric_G"] + +[upstream] +license = "MIT" +website = "https://umami.is/" +demo = "https://app.umami.is/share/8rmHaheU/umami.is" +admindoc = "https://umami.is/docs/about" +code = "https://github.com/mikecao/umami" +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" +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" + full_domain = true + + [install.init_main_permission] + type = "group" + default = "visitors" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + [[resources.apt.extras]] + repo = "deb https://dl.yarnpkg.com/debian/ stable main" + key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + packages = "yarn" + + [resources.database] + type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 8fddb7d..5b3ec1a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql postgresql-contrib" +#REMOVEME? pkg_dependencies="postgresql postgresql-contrib" nodejs_version=16 diff --git a/scripts/backup b/scripts/backup index f77e44c..e17c922 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 () { ### Remove this function if there's nothing to clean before calling the remove script. 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) +#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) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -41,7 +41,7 @@ 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 NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index db7672d..c72300a 100755 --- a/scripts/install +++ b/scripts/install @@ -13,97 +13,97 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. true } # 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="/" -is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +path="/" +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -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..." --weight=2 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 -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 #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=2 +#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=2 # 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..." --weight=10 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=10 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # 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 DATABASE #================================================= ynh_script_progression --message="Creating a database..." --weight=2 -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_psql_test_if_first_run -ynh_psql_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_psql_test_if_first_run +#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 -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" +ynh_setup_source --dest_dir="$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" #================================================= # NGINX CONFIGURATION @@ -118,17 +118,17 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 650 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 650 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # CONFIGURE THE APP #================================================= ynh_script_progression --message="Configuring the app..." --weight=15 -pushd $final_path +pushd $install_dir ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install #--production ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build @@ -161,24 +161,24 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # 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 -ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" +#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -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 5490de6..a6fb436 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -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) +#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) #================================================= # STANDARD REMOVE @@ -57,15 +57,15 @@ ynh_remove_logrotate ynh_script_progression --message="Removing the database..." --weight=2 # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=3 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=3 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -78,10 +78,10 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies ynh_remove_nodejs #================================================= @@ -89,10 +89,10 @@ ynh_remove_nodejs #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # 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 450d71d..9bcb140 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,70 +14,70 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { #### Remove this function if there's nothing to clean before calling the remove script. true } # 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..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -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=psqlpwd) +#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=psqlpwd) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 -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..." --weight=1 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # 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..." --weight=5 -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" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=10 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=10 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # RESTORE THE NGINX CONFIGURATION @@ -91,8 +91,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Restoring the database..." --weight=6 -ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +#REMOVEME? ynh_psql_test_if_first_run +#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2ca7708..3f44190 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -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) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # CHECK VERSION @@ -30,16 +30,16 @@ 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)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # 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 @@ -55,24 +55,24 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi # Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" +#REMOVEME? if ! ynh_permission_exists --permission="api"; then +#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # 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 @@ -83,25 +83,25 @@ then ynh_script_progression --message="Upgrading source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep=".env" + ynh_setup_source --dest_dir="$install_dir" --keep=".env" 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..." --weight=10 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=10 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # NGINX CONFIGURATION @@ -116,7 +116,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring the app..." --weight=15 -pushd $final_path +pushd $install_dir ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install #--production ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build @@ -148,9 +148,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 7d27cebb163b43e6d02b07832ac991e5047554f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:07:40 +0100 Subject: [PATCH 02/31] Update manifest.toml --- manifest.toml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/manifest.toml b/manifest.toml index d2547c1..840ed32 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,22 +15,19 @@ website = "https://umami.is/" demo = "https://app.umami.is/share/8rmHaheU/umami.is" admindoc = "https://umami.is/docs/about" code = "https://github.com/mikecao/umami" -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" -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.6" +architectures = "all" 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, ... +ldap = "?" +sso = "?" +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true @@ -43,6 +40,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.install_dir] + [resources.ports] + [resources.permissions] main.url = "/" [[resources.apt.extras]] From 9886954c9fb4bb15c708134dc229574b64bb36d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:12:07 +0100 Subject: [PATCH 03/31] Fix --- manifest.json | 44 ------------------- manifest.toml | 12 ++++-- scripts/_common.sh | 3 -- scripts/install | 102 +-------------------------------------------- scripts/remove | 43 +------------------ scripts/restore | 52 +---------------------- scripts/upgrade | 66 +---------------------------- tests.toml | 0 8 files changed, 14 insertions(+), 308 deletions(-) delete mode 100644 manifest.json create mode 100644 tests.toml diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 251d14d..0000000 --- a/manifest.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "Umami", - "id": "umami", - "packaging_format": 1, - "description": { - "en": "Simple, fast, privacy-focused alternative to Google Analytics", - "fr": "Analyse de trafic web simple et respectueux" - }, - "version": "1.40.0~ynh1", - "url": "https://umami.is/", - "upstream": { - "license": "MIT", - "website": "https://umami.is/", - "demo": "https://app.umami.is/share/8rmHaheU/umami.is", - "admindoc": "https://umami.is/docs/about", - "code": "https://github.com/mikecao/umami" - }, - "license": "MIT", - "maintainer": { - "name": "eric_G", - "email": "" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": true, - "services": [ - "nginx", - "postgresql" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 840ed32..8bdf093 100644 --- a/manifest.toml +++ b/manifest.toml @@ -44,10 +44,14 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" - [[resources.apt.extras]] - repo = "deb https://dl.yarnpkg.com/debian/ stable main" - key = "https://dl.yarnpkg.com/debian/pubkey.gpg" - packages = "yarn" + + [resources.apt] + packages = "postgresql" + + [[resources.apt.extras]] + repo = "deb https://dl.yarnpkg.com/debian/ stable main" + key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + packages = "yarn" [resources.database] type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 5b3ec1a..b818f0f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="postgresql postgresql-contrib" - nodejs_version=16 #================================================= diff --git a/scripts/install b/scripts/install index c72300a..30db001 100755 --- a/scripts/install +++ b/scripts/install @@ -9,95 +9,19 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -path="/" -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#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..." --weight=2 - -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=2 - -# 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..." --weight=10 - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_script_progression --message="Installing dependencies..." --weight=10 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -# Install Yarn -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - -#================================================= -# CREATE A DATABASE -#================================================= -ynh_script_progression --message="Creating a database..." --weight=2 - -#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_psql_test_if_first_run -#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 -#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" @@ -130,7 +54,7 @@ ynh_script_progression --message="Configuring the app..." --weight=15 pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install #--production + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn update-db popd @@ -158,28 +82,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# 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 - -#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index a6fb436..bb95289 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,19 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#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) - #================================================= # STANDARD REMOVE #================================================= @@ -51,22 +38,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE THE DATABASE -#================================================= -ynh_script_progression --message="Removing the database..." --weight=2 - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=3 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -78,22 +49,10 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=1 -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies ynh_remove_nodejs -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 9bcb140..ba6e71c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,49 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# 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..." --weight=1 - -#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=psqlpwd) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#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..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -69,16 +26,11 @@ chown -R $app:www-data "$install_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=10 - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -# Install Yarn -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= @@ -91,8 +43,6 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Restoring the database..." --weight=6 -#REMOVEME? ynh_psql_test_if_first_run -#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3f44190..de1ba5e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,38 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#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? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - #================================================= # CHECK 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)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # 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 #================================================= @@ -50,30 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -# Create a permission if needed -#REMOVEME? if ! ynh_permission_exists --permission="api"; then -#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" -fi - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -93,16 +43,11 @@ chown -R $app:www-data "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=10 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies +ynh_script_progression --message="Upgrading dependencies..." --weight=10 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -# Install Yarn -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - #================================================= # NGINX CONFIGURATION #================================================= @@ -118,7 +63,7 @@ ynh_script_progression --message="Configuring the app..." --weight=15 pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install #--production + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build #ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn update-db popd @@ -145,13 +90,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..e69de29 From dcfb3d8204136d4be5a7e7f8958d7a78acc88dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:12:57 +0100 Subject: [PATCH 04/31] Fix --- doc/{DISCLAIMER.md => notifications/POST_INSTALL.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{DISCLAIMER.md => notifications/POST_INSTALL.md} (100%) diff --git a/doc/DISCLAIMER.md b/doc/notifications/POST_INSTALL.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/notifications/POST_INSTALL.md From a3a799fd1f99b555615d3445d9b4b45a867fc703 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 7 Feb 2023 08:13:02 +0000 Subject: [PATCH 05/31] Auto-update README --- README.md | 7 ------- README_fr.md | 7 ------- 2 files changed, 14 deletions(-) diff --git a/README.md b/README.md index cfafe39..8b7d6da 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,6 @@ Umami is a simple, easy to use, self-hosted web analytics solution. The goal is ![Screenshot of Umami](./doc/screenshots/dark.png) -## Disclaimers / important information - -### Login - -Your Umami installation will create a default administrator account with the username `admin` and the password `umami`. - -The first thing you will want to do is log in and change your password. ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 380516c..029af5f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -38,13 +38,6 @@ Umami is a simple, easy to use, self-hosted web analytics solution. The goal is ![Capture d’écran de Umami](./doc/screenshots/dark.png) -## Avertissements / informations importantes - -### Login - -Your Umami installation will create a default administrator account with the username `admin` and the password `umami`. - -The first thing you will want to do is log in and change your password. ## Documentations et ressources * Site officiel de l’app : From d4bea89453ecec207904c5be34a02f6fb729c2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:15:03 +0100 Subject: [PATCH 06/31] Fix --- manifest.toml | 4 ++-- tests.toml | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 8bdf093..6ab736a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,8 +20,8 @@ code = "https://github.com/mikecao/umami" yunohost = ">= 11.1.6" architectures = "all" multi_instance = true -ldap = "?" -sso = "?" +ldap = false +sso = false disk = "50M" ram.build = "50M" ram.runtime = "50M" diff --git a/tests.toml b/tests.toml index e69de29..32c36a4 100644 --- a/tests.toml +++ b/tests.toml @@ -0,0 +1,15 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + + exclude = "install.subdir" + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.4860e2cc.name = "Upgrade from 1.33~ynh2" From 7815b47180fdc887ec0008098bf543a9c21f302c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:49:47 +0100 Subject: [PATCH 07/31] Fix --- conf/.env | 4 ++++ conf/systemd.service | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/.env b/conf/.env index 9d5f6b8..63ece0c 100644 --- a/conf/.env +++ b/conf/.env @@ -1,2 +1,6 @@ DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__ DISABLE_TELEMETRY = 1 +HOSTNAME = __DOMAIN__ +PORT = __PORT__ +BASE_PATH = __PATH__ +REMOVE_TRAILING_SLASH = 1 \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index 9bbb4ec..7551002 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,6 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ #Environment=NODE_ENV=production -Environment=PORT=__PORT__ Environment="__YNH_NODE_LOAD_PATH__" ExecStart=__YNH_NPM__ run start From 5e9187749bf740e334f05cb85435dc3031a46fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Feb 2023 20:55:13 +0100 Subject: [PATCH 08/31] cleaning --- manifest.toml | 2 +- scripts/change_url | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/manifest.toml b/manifest.toml index 6ab736a..06376f1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://umami.is/docs/about" code = "https://github.com/mikecao/umami" [integration] -yunohost = ">= 11.1.6" +yunohost = ">= 11.1.7" architectures = "all" multi_instance = true ldap = false diff --git a/scripts/change_url b/scripts/change_url index 538ca2b..5db1cfe 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,15 +21,6 @@ new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) - #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= From 7676fe9160c1b9f036c29c797e4e94a1553e3517 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 16 Feb 2023 19:55:19 +0000 Subject: [PATCH 09/31] Auto-update README --- README.md | 1 + README_fr.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 8b7d6da..ed170de 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ It shall NOT be edited by hand. # Umami for YunoHost [![Integration level](https://dash.yunohost.org/integration/umami.svg)](https://dash.yunohost.org/appci/app/umami) ![Working status](https://ci-apps.yunohost.org/ci/badges/umami.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/umami.maintain.svg) + [![Install Umami with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=umami) *[Lire ce readme en français.](./README_fr.md)* diff --git a/README_fr.md b/README_fr.md index 029af5f..0afa4b0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -6,6 +6,7 @@ It shall NOT be edited by hand. # Umami pour YunoHost [![Niveau d’intégration](https://dash.yunohost.org/integration/umami.svg)](https://dash.yunohost.org/appci/app/umami) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/umami.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/umami.maintain.svg) + [![Installer Umami avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=umami) *[Read this readme in english.](./README.md)* From f03efc8763b854bd5edcb6876336c356ae96885f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Feb 2023 20:55:30 +0100 Subject: [PATCH 10/31] Update backup --- scripts/backup | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/scripts/backup b/scripts/backup index e17c922..722ff45 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,28 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - 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) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= From 5586802eb2e9c917d1e09fe4ef1203bfa5ebe122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Feb 2023 20:56:45 +0100 Subject: [PATCH 11/31] post install --- doc/POST_INSTALL.md | 0 doc/notifications/POST_INSTALL.md | 5 ----- 2 files changed, 5 deletions(-) create mode 100644 doc/POST_INSTALL.md delete mode 100644 doc/notifications/POST_INSTALL.md diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md new file mode 100644 index 0000000..e69de29 diff --git a/doc/notifications/POST_INSTALL.md b/doc/notifications/POST_INSTALL.md deleted file mode 100644 index f420f53..0000000 --- a/doc/notifications/POST_INSTALL.md +++ /dev/null @@ -1,5 +0,0 @@ -### Login - -Your Umami installation will create a default administrator account with the username `admin` and the password `umami`. - -The first thing you will want to do is log in and change your password. \ No newline at end of file From 12e629d9d4fd834fc1be27cc6a75c84b502eeb96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Feb 2023 20:58:18 +0100 Subject: [PATCH 12/31] add post install --- check_process | 28 ---------------------------- doc/POST_INSTALL.md | 5 +++++ 2 files changed, 5 insertions(+), 28 deletions(-) delete mode 100644 check_process diff --git a/check_process b/check_process deleted file mode 100644 index d56ac04..0000000 --- a/check_process +++ /dev/null @@ -1,28 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - language="fr" - admin="john" - password="1Strong-Password" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 1.33~ynh2 - upgrade=1 from_commit=4860e2cc613c193d98509e22fea8e3e7ed13ce32 - backup_restore=1 - multi_instance=1 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=4860e2cc613c193d98509e22fea8e3e7ed13ce32 - name=# 1.33~ynh2 - manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index e69de29..dd79e89 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -0,0 +1,5 @@ +### Login + +Your Umami installation will create a default administrator account with the username `admin` and the password `umami`. + +The first thing you will want to do is log in and change your password. From 11a8e73b12e4e621bf2aee0509903e3ee0caa158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 16:06:37 +0100 Subject: [PATCH 13/31] Update manifest.toml Co-authored-by: Alexandre Aubin --- manifest.toml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index 06376f1..5aac5cb 100644 --- a/manifest.toml +++ b/manifest.toml @@ -48,10 +48,9 @@ ram.runtime = "50M" [resources.apt] packages = "postgresql" - [[resources.apt.extras]] - repo = "deb https://dl.yarnpkg.com/debian/ stable main" - key = "https://dl.yarnpkg.com/debian/pubkey.gpg" - packages = "yarn" + extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" + extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + extras.yarn.packages = "yarn" [resources.database] type = "postgresql" From 3e82fe098c986ec93e0da648178949a9b9e3a24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 3 Mar 2023 16:13:30 +0100 Subject: [PATCH 14/31] v2 --- manifest.toml | 2 +- scripts/change_url | 75 +--------------------------------------------- scripts/restore | 1 - 3 files changed, 2 insertions(+), 76 deletions(-) diff --git a/manifest.toml b/manifest.toml index 5aac5cb..1986209 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://umami.is/docs/about" code = "https://github.com/mikecao/umami" [integration] -yunohost = ">= 11.1.7" +yunohost = ">= 11.1.12" architectures = "all" multi_instance = true ldap = false diff --git a/scripts/change_url b/scripts/change_url index 5db1cfe..b731bd3 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,50 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # 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" - - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi #================================================= # STANDARD MODIFICATIONS @@ -68,29 +24,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -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" - # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated NGINX config - 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 - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi +ynh_change_url_nginx_config #================================================= # GENERIC FINALISATION @@ -101,13 +35,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index ba6e71c..193583b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -17,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" From fb8b5c4095f2d14476c8d5785fea168692de19b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 3 Mar 2023 16:14:58 +0100 Subject: [PATCH 15/31] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 1986209..08315ba 100644 --- a/manifest.toml +++ b/manifest.toml @@ -51,6 +51,6 @@ ram.runtime = "50M" extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" extras.yarn.packages = "yarn" - + [resources.database] type = "postgresql" From fb9119a17210a8e1a3c5ddc2640200b7390dcf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 3 Mar 2023 16:21:39 +0100 Subject: [PATCH 16/31] remove perm --- scripts/install | 1 - scripts/upgrade | 1 - 2 files changed, 2 deletions(-) diff --git a/scripts/install b/scripts/install index 30db001..37f2f23 100755 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,6 @@ ynh_script_progression --message="Setting up source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" diff --git a/scripts/upgrade b/scripts/upgrade index de1ba5e..4f0494e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,7 +36,6 @@ then ynh_setup_source --dest_dir="$install_dir" --keep=".env" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" From 78083bd4835645255eef6a22b2f57efcc195dfa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 8 Mar 2023 18:50:46 +0100 Subject: [PATCH 17/31] v2 --- manifest.toml | 2 +- scripts/change_url | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 08315ba..b3af6a0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://umami.is/docs/about" code = "https://github.com/mikecao/umami" [integration] -yunohost = ">= 11.1.12" +yunohost = ">= 11.1.13" architectures = "all" multi_instance = true ldap = false diff --git a/scripts/change_url b/scripts/change_url index b731bd3..ae914ad 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,7 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers - #================================================= # STANDARD MODIFICATIONS #================================================= From 430f886c18d0ceae7458637d353b82fb3ada1c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 17 Apr 2023 22:39:07 +0200 Subject: [PATCH 18/31] fix --- .github/workflows/updater.sh | 137 ----------------------------------- conf/app.src | 7 -- manifest.toml | 13 +++- 3 files changed, 11 insertions(+), 146 deletions(-) delete mode 100755 .github/workflows/updater.sh delete mode 100644 conf/app.src 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/conf/app.src b/conf/app.src deleted file mode 100644 index 9bbf4f6..0000000 --- a/conf/app.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/mikecao/umami/archive/refs/tags/v1.40.0.tar.gz -SOURCE_SUM=288b3880bbfce0620b71adeb1feb08e30bc160fb24bdc332d6e078e535a42307 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/manifest.toml b/manifest.toml index b3af6a0..f5aeb3b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Umami" description.en = "Simple, fast, privacy-focused alternative to Google Analytics" description.fr = "Analyse de trafic web simple et respectueux" -version = "1.40.0~ynh1" +version = "2.0.0~ynh1" maintainers = ["eric_G"] @@ -17,7 +17,7 @@ admindoc = "https://umami.is/docs/about" code = "https://github.com/mikecao/umami" [integration] -yunohost = ">= 11.1.13" +yunohost = ">= 11.1.17" architectures = "all" multi_instance = true ldap = false @@ -36,6 +36,15 @@ ram.runtime = "50M" default = "visitors" [resources] + + [resources.sources] + + [resources.sources.main] + + url = "https://github.com/mikecao/umami/archive/refs/tags/v2.0.0.tar.gz" + sha256 = "4489f36fed28b8c6d26f82182124717d5f33d59574137275bb8550d385ccc49e" + autoupdate.strategy = "latest_github_tag" + [resources.system_user] [resources.install_dir] From 0522e4cf7668b78a4060d893f205e0bc5ad9eaa5 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 17 Apr 2023 20:39:12 +0000 Subject: [PATCH 19/31] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ed170de..902ef81 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Umami is a simple, easy to use, self-hosted web analytics solution. The goal is - Privacy-focused -**Shipped version:** 1.40.0~ynh1 +**Shipped version:** 2.0.0~ynh1 **Demo:** https://app.umami.is/share/8rmHaheU/umami.is diff --git a/README_fr.md b/README_fr.md index 0afa4b0..1701f7d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -31,7 +31,7 @@ Umami is a simple, easy to use, self-hosted web analytics solution. The goal is - Privacy-focused -**Version incluse :** 1.40.0~ynh1 +**Version incluse :** 2.0.0~ynh1 **Démo :** https://app.umami.is/share/8rmHaheU/umami.is From e4bf12dae0c59905fe80ac4efc863f4730b81ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 17 Apr 2023 22:41:46 +0200 Subject: [PATCH 20/31] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 37f2f23..14d0c2f 100755 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ pushd $install_dir ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn update-db + #ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn update-db popd #================================================= From 4a6d11df0caa35efa256bb48d8fada44e8da1763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 10:36:16 +0200 Subject: [PATCH 21/31] Update manifest.toml --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index f5aeb3b..725d9df 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://umami.is/docs/about" code = "https://github.com/mikecao/umami" [integration] -yunohost = ">= 11.1.17" +yunohost = ">= 11.1.18" architectures = "all" multi_instance = true ldap = false @@ -41,8 +41,8 @@ ram.runtime = "50M" [resources.sources.main] - url = "https://github.com/mikecao/umami/archive/refs/tags/v2.0.0.tar.gz" - sha256 = "4489f36fed28b8c6d26f82182124717d5f33d59574137275bb8550d385ccc49e" + url = "https://github.com/mikecao/umami/archive/refs/tags/v2.2.0.tar.gz" + sha256 = "5aabb3fc63ef6203185cd3dee837998ca3d2c5e012a0665dfbbc47101c19ffb5" autoupdate.strategy = "latest_github_tag" [resources.system_user] From fad143691ede780cf6024e1007e9c01d8cc3010d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 10:36:28 +0200 Subject: [PATCH 22/31] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 725d9df..6ba41d8 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Umami" description.en = "Simple, fast, privacy-focused alternative to Google Analytics" description.fr = "Analyse de trafic web simple et respectueux" -version = "2.0.0~ynh1" +version = "2.2.0~ynh1" maintainers = ["eric_G"] From 1318bca5d483757ffa026f2c1b5ec097c135c951 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 26 Apr 2023 08:36:33 +0000 Subject: [PATCH 23/31] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 902ef81..61c94f1 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Umami is a simple, easy to use, self-hosted web analytics solution. The goal is - Privacy-focused -**Shipped version:** 2.0.0~ynh1 +**Shipped version:** 2.2.0~ynh1 **Demo:** https://app.umami.is/share/8rmHaheU/umami.is diff --git a/README_fr.md b/README_fr.md index 1701f7d..224f28f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -31,7 +31,7 @@ Umami is a simple, easy to use, self-hosted web analytics solution. The goal is - Privacy-focused -**Version incluse :** 2.0.0~ynh1 +**Version incluse :** 2.2.0~ynh1 **Démo :** https://app.umami.is/share/8rmHaheU/umami.is From 036103b70af93336e18810ac0073ab573c1cf877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 10:49:04 +0200 Subject: [PATCH 24/31] Fix --- conf/.env | 11 ++++++++++- conf/nginx.conf | 3 +++ conf/systemd.service | 2 +- scripts/_common.sh | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/conf/.env b/conf/.env index 63ece0c..d10b7ba 100644 --- a/conf/.env +++ b/conf/.env @@ -1,6 +1,15 @@ +DATABASE_TYPE = postgresql + DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__ + +SKIP_DB_CHECK + DISABLE_TELEMETRY = 1 + HOSTNAME = __DOMAIN__ + PORT = __PORT__ + BASE_PATH = __PATH__ -REMOVE_TRAILING_SLASH = 1 \ No newline at end of file + +REMOVE_TRAILING_SLASH = 1 diff --git a/conf/nginx.conf b/conf/nginx.conf index acbcc51..da798bf 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,4 +5,7 @@ location __PATH__/ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/systemd.service b/conf/systemd.service index 7551002..cb2ee0d 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ #Environment=NODE_ENV=production Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__YNH_NPM__ run start +ExecStart=__YNH_NPM__ run start-env # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/scripts/_common.sh b/scripts/_common.sh index b818f0f..9195d57 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=16 +nodejs_version=18 #================================================= # PERSONAL HELPERS From 7458ed659835a2491fd35d16ecd81897e7e502ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 10:50:20 +0200 Subject: [PATCH 25/31] Update .env --- conf/.env | 2 -- 1 file changed, 2 deletions(-) diff --git a/conf/.env b/conf/.env index d10b7ba..4fe76d6 100644 --- a/conf/.env +++ b/conf/.env @@ -10,6 +10,4 @@ HOSTNAME = __DOMAIN__ PORT = __PORT__ -BASE_PATH = __PATH__ - REMOVE_TRAILING_SLASH = 1 From d94251b7e898582f5309de6c271cbac5d5595520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 10:50:55 +0200 Subject: [PATCH 26/31] Update .env --- conf/.env | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/.env b/conf/.env index 4fe76d6..0c59d10 100644 --- a/conf/.env +++ b/conf/.env @@ -1,13 +1,13 @@ -DATABASE_TYPE = postgresql +DATABASE_TYPE=postgresql DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__ SKIP_DB_CHECK -DISABLE_TELEMETRY = 1 +DISABLE_TELEMETRY=1 -HOSTNAME = __DOMAIN__ +HOSTNAME=__DOMAIN__ -PORT = __PORT__ +PORT=__PORT__ -REMOVE_TRAILING_SLASH = 1 +REMOVE_TRAILING_SLASH=1 From 9e90b133c1dd86624e583809b17d548aea2047e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 11:14:06 +0200 Subject: [PATCH 27/31] Update .env --- conf/.env | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/conf/.env b/conf/.env index 0c59d10..be94136 100644 --- a/conf/.env +++ b/conf/.env @@ -1,13 +1,7 @@ DATABASE_TYPE=postgresql -DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__ - -SKIP_DB_CHECK +DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@127.0.0.1:5432/__DB_NAME__ DISABLE_TELEMETRY=1 -HOSTNAME=__DOMAIN__ - PORT=__PORT__ - -REMOVE_TRAILING_SLASH=1 From c50aade51e64ba81087154eeb0b15ab68031f31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 11:15:26 +0200 Subject: [PATCH 28/31] Update POST_INSTALL.md --- doc/POST_INSTALL.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index dd79e89..4f2834c 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,5 +1,6 @@ -### Login +Umami installation will create a default administrator account: -Your Umami installation will create a default administrator account with the username `admin` and the password `umami`. +username: `admin` +password: `umami` The first thing you will want to do is log in and change your password. From fe56c601c02e3abd4448c8d8e05c920f6863938f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 12:02:52 +0200 Subject: [PATCH 29/31] Update manifest.toml --- manifest.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifest.toml b/manifest.toml index 6ba41d8..2e85c4d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -53,6 +53,11 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" + api.url = "/api" + api.show_tile = false + api.allowed = "visitors" + api.auth_header = false + api.show_tile = false [resources.apt] packages = "postgresql" From 352ef6a8b5a8a910857ed7ff5eddf58a7e2e7048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 12:04:33 +0200 Subject: [PATCH 30/31] Update manifest.toml --- manifest.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 2e85c4d..3a85366 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,7 +57,6 @@ ram.runtime = "50M" api.show_tile = false api.allowed = "visitors" api.auth_header = false - api.show_tile = false [resources.apt] packages = "postgresql" From ccc3418ced8806be7ba8fea74c6edd57f849fb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 26 Apr 2023 12:13:42 +0200 Subject: [PATCH 31/31] Update install --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index 14d0c2f..d4cbfde 100755 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,6 @@ pushd $install_dir ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build - #ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn update-db popd #=================================================