diff --git a/check_process b/check_process index 9c6e306..47a5527 100644 --- a/check_process +++ b/check_process @@ -1,14 +1,9 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" path="/path" - admin="john" is_public=1 + admin="john" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -32,18 +27,5 @@ port_already_use=0 change_url=1 ;;; Options -Email=yalh@yahoo.com -Notification=all -;;; Upgrade options - ; commit=d5e1fa7d327c55d8e5ae4c24e7c6aaac006256db - name=Bitwarden 1.20.0~ynh4 - ; commit=3f7d7d2740a1cb3f16a290b64c89e84422d06ede - name=1.21.0~ynh1 - ; commit=703d5a9cb86d127c7723bb380d7c392a8eb9e703 - name=1.21.0~ynh2 - ; commit=c233d94d76cae449630c59ce228b7a3c72f8fa12 - name=1.22.2~ynh1 - ; commit=2808a3a8e985bb5431f6d8f2353b07201355afe4 - name=1.23.0~ynh1 - ; commit=7492e0d21c795696f4ff44912edc199437d4bb71 - name=1.23.0~ynh3 +Email= +Notification=none diff --git a/conf/nginx.conf b/conf/nginx.conf index aade80d..1b65fd3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file client_max_body_size 100M; diff --git a/manifest.json b/manifest.json index 2fb3450..636c550 100644 --- a/manifest.json +++ b/manifest.json @@ -38,14 +38,14 @@ "example": "/vaultwarden", "default": "/vaultwarden" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", "default": true + }, + { + "name": "admin", + "type": "user" } ] } diff --git a/scripts/backup b/scripts/backup index 2215093..b6833b3 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -63,6 +63,12 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" #================================================= # SPECIFIC BACKUP +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/install b/scripts/install index 67096dc..0676523 100644 --- a/scripts/install +++ b/scripts/install @@ -26,8 +26,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME @@ -83,7 +83,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -91,7 +91,6 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path - # Download, check integrity, uncompress the source of vaultwarden from app.src to his build directory ynh_setup_source --dest_dir="$final_path/build/" --source_id="app" @@ -174,6 +173,16 @@ ynh_add_systemd_config #================================================= # GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." + +# Use logrotate to manage application logfile(s) +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" +ynh_use_logrotate + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/restore b/scripts/restore index dfeb2ba..3f612c6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -42,13 +42,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -105,6 +98,13 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # RESTORE SYSTEMD #================================================= @@ -113,6 +113,15 @@ ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." + +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4651851..8aaa4f1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,8 +89,6 @@ then fi fi -ynh_remove_logrotate - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -113,21 +111,9 @@ if ! ynh_permission_exists --permission="api"; then ynh_permission_create --permission="api" --url="/api" --additional_urls="/identity/connect/token" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" fi -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Making sure data directory exists..." - # If datadir doesn't exist, create it if [ -z $datadir ]; then + ynh_script_progression --message="Making sure data directory exists..." datadir=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=datadir --value=$datadir mkdir -p $datadir @@ -138,6 +124,14 @@ if [ -z $datadir ]; then chown -R $app:$app "$datadir" fi +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -160,6 +154,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # NGINX CONFIGURATION #================================================= @@ -168,13 +169,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE #================================================= @@ -237,6 +231,16 @@ ynh_add_systemd_config #================================================= # GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." + +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================