1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/umami_ynh.git synced 2024-10-01 13:34:50 +02:00
This commit is contained in:
Éric Gaspar 2024-09-29 09:13:50 +02:00
parent 70a0bb8774
commit 91cd8d78e4
6 changed files with 13 additions and 52 deletions

View file

@ -17,7 +17,7 @@ admindoc = "https://umami.is/docs/about"
code = "https://github.com/mikecao/umami"
[integration]
yunohost = ">= 11.2.18"
yunohost = ">= 11.2.30"
helpers_version = "2.1"
architectures = "all"
multi_instance = true

View file

@ -1,6 +1,5 @@
#!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -18,10 +17,6 @@ ynh_backup "$install_dir"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service"
#=================================================

View file

@ -16,20 +16,15 @@ ynh_nodejs_install
#=================================================
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/build"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add $app --description="Web Analytics" --log="/var/log/$app/$app.log"
@ -41,8 +36,7 @@ ynh_script_progression "Adding $app's configuration..."
ynh_config_add --template=".env" --destination="$install_dir/build/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 650 "$install_dir/build/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/build/.env"
chmod 650 "$install_dir/build/.env"
ynh_script_progression "Provisioning pgcrypto..."
@ -54,9 +48,8 @@ ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS pgcrypto;"
ynh_script_progression "Configuring the app..."
pushd "$install_dir/build"
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install
ynh_hide_warnings ynh_exec_as_app node_load_PATH NEXT_TELEMETRY_DISABLED=1 yarn build
ynh_hide_warnings ynh_exec_as_app yarn install
ynh_hide_warnings ynh_exec_as_app NEXT_TELEMETRY_DISABLED=1 yarn build
# Actual app is a subset of release assets
# List of deps based on Dockerfile: https://github.com/umami-software/umami/blob/master/Dockerfile
@ -75,7 +68,7 @@ chown -R $app:www-data "$install_dir/release"
mv -f $install_dir/build/.next/standalone/* $install_dir/build/.next/standalone/.[!.]* $install_dir/release
pushd "$install_dir/release"
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn add npm-run-all dotenv prisma
ynh_hide_warnings ynh_exec_as_app yarn add npm-run-all dotenv prisma
popd
ynh_safe_rm "$install_dir/.cache"
@ -87,7 +80,6 @@ ynh_safe_rm "$install_dir/build"
#=================================================
ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemctl --service=$app --action="start"
#=================================================

View file

@ -5,26 +5,17 @@ source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression "Removing system configurations related to $app..."
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status $app >/dev/null
then
ynh_script_progression "Removing $app service integration..."
if ynh_hide_warnings yunohost service status $app >/dev/null; then
yunohost service remove $app
fi
# Remove the dedicated systemd config
ynh_config_remove_systemd
# Remove the app-specific logrotate config
ynh_config_remove_logrotate
# Remove the dedicated NGINX config
ynh_config_remove_nginx
ynh_nodejs_remove

View file

@ -1,6 +1,5 @@
#!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -11,16 +10,11 @@ ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression "Reinstalling dependencies..."
# Install Nodejs
ynh_nodejs_install
#=================================================
@ -30,13 +24,11 @@ ynh_script_progression "Restoring the database..."
ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS pgcrypto;"
ynh_psql_db_shell < "./db.sql""
ynh_psql_db_shell < ./db.sql
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"

View file

@ -8,12 +8,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
# If language doesn't exist, create it
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=language --value="en-US"
if [ -z "${language:-}" ]; then
language="en-US"
ynh_app_setting_set --key=language --value=$language
fi
ynh_app_setting_set_default --key=language --value="en-US"
#=================================================
# STOP SYSTEMD SERVICE
@ -51,7 +46,6 @@ chown -R $app:www-data "$install_dir/build"
#=================================================
ynh_script_progression "Upgrading dependencies..."
# Install Nodejs
ynh_nodejs_install
#=================================================
@ -59,10 +53,8 @@ ynh_nodejs_install
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add $app --description="Web Analytics" --log="/var/log/$app/$app.log"
@ -74,8 +66,7 @@ ynh_script_progression "Adding $app's configuration..."
ynh_config_add --template=".env" --destination="$install_dir/build/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 650 "$install_dir/build/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/build/.env"
chmod 650 "$install_dir/build/.env"
ynh_script_progression "Provisioning pgcrypto..."
@ -84,13 +75,13 @@ ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS pgcrypto;"
#=================================================
# CONFIGURE THE APP
#=================================================
if [[ "$upgrade_type" == "UPGRADE_APP" || $(ynh_app_upgrading_from_version_before_or_equal_to 2.7.0~ynh4) ]]; then
ynh_script_progression "Configuring the app..."
pushd $install_dir/build
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install
ynh_hide_warnings ynh_exec_as_app node_load_PATH NEXT_TELEMETRY_DISABLED=1 yarn build
ynh_hide_warnings ynh_exec_as_app yarn install
ynh_hide_warnings ynh_exec_as_app NEXT_TELEMETRY_DISABLED=1 yarn build
# Actual app is a subset of release assets
# List of deps based on Dockerfile: https://github.com/umami-software/umami/blob/master/Dockerfile
@ -111,7 +102,7 @@ if [[ "$upgrade_type" == "UPGRADE_APP" || $(ynh_app_upgrading_from_version_befor
mv -f $install_dir/build/.next/standalone/* $install_dir/build/.next/standalone/.[!.]* $install_dir/release
pushd "$install_dir/release"
ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn add npm-run-all dotenv prisma
ynh_hide_warnings ynh_exec_as_app yarn add npm-run-all dotenv prisma
popd
fi