diff --git a/README.md b/README.md index 512c69c..174a830 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 - Open-source -**Shipped version:** 1.32.1~ynh1 +**Shipped version:** 1.33~ynh1 **Demo:** https://app.umami.is/share/8rmHaheU/umami.is diff --git a/README_fr.md b/README_fr.md index 16eb57f..a4eb4e4 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 - Open-source -**Version incluse :** 1.32.1~ynh1 +**Version incluse :** 1.33~ynh1 **Démo :** https://app.umami.is/share/8rmHaheU/umami.is diff --git a/check_process b/check_process index 7439cc4..ec2c3e5 100644 --- a/check_process +++ b/check_process @@ -6,7 +6,6 @@ language="fr" admin="john" password="1Strong-Password" - port="666" ; Checks pkg_linter=1 setup_sub_dir=0 @@ -15,15 +14,15 @@ setup_private=1 setup_public=1 upgrade=1 - #upgrade=1 from_commit=CommitHash + # 1.32.1~ynh1 + #upgrade=1 from_commit=267cb1aced761924cca8a2608be3a1b9bd14605c backup_restore=1 multi_instance=1 - port_already_use=0 change_url=1 ;;; Options Email= Notification=none ;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. + ; commit=267cb1aced761924cca8a2608be3a1b9bd14605c + name=# 1.32.1~ynh1 manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/conf/.env b/conf/.env index b49819b..9d5f6b8 100644 --- a/conf/.env +++ b/conf/.env @@ -1,3 +1,2 @@ DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__ -HASH_SALT=__SALT__ DISABLE_TELEMETRY = 1 diff --git a/conf/app.src b/conf/app.src index 9ab447b..3fd8024 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/mikecao/umami/archive/refs/tags/v1.32.1.tar.gz -SOURCE_SUM=6cad8de19879a3d48844efcfc2f794203ab5ae5ab1900bf58b936147f4491dd3 +SOURCE_URL=https://github.com/mikecao/umami/archive/refs/tags/v1.33.tar.gz +SOURCE_SUM=22d29436d582f26ca913b7a641a03f3c6b82f6263a5e0fc0e4eae5ef7c8116b5 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 8532dc2..d57520f 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Simple, fast, privacy-focused alternative to Google Analytics", "fr": "Analyse de trafic web simple et respectueux" }, - "version": "1.32.1~ynh1", + "version": "1.33~ynh1", "url": "https://umami.is/", "upstream": { "license": "MIT", @@ -26,7 +26,7 @@ "multi_instance": true, "services": [ "nginx", - "mysql" + "postgresql" ], "arguments": { "install": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 7f17471..8fddb7d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql" +pkg_dependencies="postgresql postgresql-contrib" nodejs_version=16 diff --git a/scripts/backup b/scripts/backup index 199209a..f77e44c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -56,9 +56,9 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= -# BACKUP THE POSTGRESQL DATABASE +# BACKUP THE DATABASE #================================================= -ynh_print_info --message="Backing up the PostgreSQL database..." +ynh_print_info --message="Backing up the database..." ynh_psql_dump_db --database="$db_name" > db.sql diff --git a/scripts/install b/scripts/install index 043a1ae..9a6bbe6 100755 --- a/scripts/install +++ b/scripts/install @@ -27,7 +27,6 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC -salt=$(ynh_string_random --length=16) app=$YNH_APP_INSTANCE_NAME @@ -72,6 +71,9 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_use_nodejs +# 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" + #================================================= # CREATE DEDICATED USER #================================================= @@ -81,9 +83,9 @@ ynh_script_progression --message="Configuring system user..." --weight=1 ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= -# CREATE A POSTGRESQL DATABASE +# CREATE A DATABASE #================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 +ynh_script_progression --message="Creating a database..." --weight=2 db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name @@ -119,8 +121,8 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/.env" --destination="$final_path/.env" -#chmod 650 "$final_path/.env" -#chown $app:$app "$final_path/.env" +chmod 650 "$final_path/.env" +chown $app:$app "$final_path/.env" #================================================= # CONFIGURE THE APP @@ -128,12 +130,11 @@ ynh_add_config --template="../conf/.env" --destination="$final_path/.env" ynh_script_progression --message="Configuring the app..." --weight=15 pushd $final_path - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install - ynh_psql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/sql/schema.postgresql.sql - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build + 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 - #================================================= # SETUP SYSTEMD #================================================= diff --git a/scripts/remove b/scripts/remove index b337ab2..5490de6 100755 --- a/scripts/remove +++ b/scripts/remove @@ -52,9 +52,9 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= ynh_remove_logrotate #================================================= -# REMOVE THE POSTGRESQL DATABASE +# REMOVE THE DATABASE #================================================= -ynh_script_progression --message="Removing the PostgreSQL database..." --weight=2 +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 diff --git a/scripts/restore b/scripts/restore index b6834eb..450d71d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -38,7 +38,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " @@ -48,7 +48,7 @@ test ! -d $final_path \ #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +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" @@ -56,7 +56,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=5 ynh_restore_file --origin_path="$final_path" @@ -69,29 +69,27 @@ chown -R $app:www-data "$final_path" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 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" + #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= -# RESTORE THE MYSQL DATABASE +# RESTORE THE DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1 - -#================================================= -# RESTORE THE POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 +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 @@ -100,7 +98,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet @@ -108,14 +106,14 @@ systemctl enable $app.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Web Analytics" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +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" @@ -124,7 +122,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -132,4 +130,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 45ad72a..c1eefc2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,6 @@ 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # CHECK VERSION @@ -81,10 +80,14 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Upgrading dependencies..." --weight=10 ynh_install_app_dependencies $pkg_dependencies + # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_use_nodejs +# 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" + #================================================= # NGINX CONFIGURATION #================================================= @@ -99,8 +102,9 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring the app..." --weight=15 pushd $final_path - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build + 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 #=================================================