1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kresus_ynh.git synced 2024-09-03 19:36:10 +02:00

Merge pull request #123 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
yalh76 2022-06-19 03:05:05 +02:00 committed by GitHub
commit 4693050608
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 60 additions and 56 deletions

View file

@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Kresus is an open-source libre self-hosted personal finance manager. It allows you to safely track your banking history, check your overall balance and know exactly how you are spending money using categories! Kresus is an open-source libre self-hosted personal finance manager. It allows you to safely track your banking history, check your overall balance and know exactly how you are spending money using categories!
**Shipped version:** 0.18.1~ynh1 **Shipped version:** 0.18.1~ynh2
## Screenshots ## Screenshots

View file

@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Kresus est un gestionnaire de finances personnelles gratuit et libre qui tourne sur votre serveur. Il récupère automatiquement et quotidiennement toutes vos nouvelles transactions bancaires et vous permet de les catégoriser, étudier via des graphiques, et établir un budget. Kresus est un gestionnaire de finances personnelles gratuit et libre qui tourne sur votre serveur. Il récupère automatiquement et quotidiennement toutes vos nouvelles transactions bancaires et vous permet de les catégoriser, étudier via des graphiques, et établir un budget.
**Version incluse :** 0.18.1~ynh1 **Version incluse :** 0.18.1~ynh2
## Captures d'écran ## Captures d'écran

View file

@ -19,4 +19,3 @@
;;; Options ;;; Options
Email= Email=
Notification=all Notification=all
;;; Upgrade options

View file

@ -1,27 +1,27 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
alias __FINALPATH__/build/client/; alias __FINALPATH__/build/client/;
try_files $uri $uri/index.html @kresus; try_files $uri $uri/index.html @kresus;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }
location ~ __PATH__/\.(css|js|png|jpe?g|svg|eot|woff2?)$ { location ~ __PATH__/\.(css|js|png|jpe?g|svg|eot|woff2?)$ {
more_set_headers 'Cache-Control: max-age=2592000, must-revalidate, public'; more_set_headers 'Cache-Control: max-age=2592000, must-revalidate, public';
gzip_types text/plain text/css application/javascript text/javascript; gzip_types text/plain text/css application/javascript text/javascript;
try_files $uri $uri/index.html @kresus; try_files $uri $uri/index.html @kresus;
} }
location @kresus { location @kresus {
client_max_body_size 8M; client_max_body_size 8M;
send_timeout 600; send_timeout 600;
proxy_connect_timeout 600; proxy_connect_timeout 600;
proxy_send_timeout 600; proxy_send_timeout 600;
proxy_read_timeout 600; proxy_read_timeout 600;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect off; proxy_redirect off;
} }

View file

@ -6,16 +6,20 @@ After=syslog.target network.target
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__/
Environment="PATH=__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
Environment=NODE_ENV=production Environment=NODE_ENV=production
ExecStart=__FINALPATH__/bin/kresus.js --config __FINALPATH__/config.ini ExecStart=__FINALPATH__/bin/kresus.js --config __FINALPATH__/config.ini
Restart=always Restart=always
NoNewPrivileges=true StandardOutput=syslog
PrivateDevices=true StandardError=syslog
PrivateTmp=true SyslogIdentifier=__APP__
ProtectHome=true
ProtectSystem=strict NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
ProtectHome=yes
ProtectSystem=full
ProtectControlGroups=yes ProtectControlGroups=yes
ProtectKernelModules=yes ProtectKernelModules=yes
# to allow this systemd service to use sendmail. # to allow this systemd service to use sendmail.
@ -26,9 +30,6 @@ ProtectKernelModules=yes
SupplementaryGroups=postdrop SupplementaryGroups=postdrop
ReadWritePaths=__FINALPATH__/config.ini __FINALPATH__/data/ /var/spool/postfix/maildrop/ ReadWritePaths=__FINALPATH__/config.ini __FINALPATH__/data/ /var/spool/postfix/maildrop/
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=__APP__
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -6,7 +6,7 @@
"en": "Personal finance manager", "en": "Personal finance manager",
"fr": "Outil personnel de gestion de finances" "fr": "Outil personnel de gestion de finances"
}, },
"version": "0.18.1~ynh1", "version": "0.18.1~ynh2",
"url": "https://framagit.org/kresusapp/kresus", "url": "https://framagit.org/kresusapp/kresus",
"upstream": { "upstream": {
"license": "free", "license": "free",

View file

@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors

View file

@ -29,6 +29,8 @@ architecture=$YNH_ARCH
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
salt=$(ynh_string_random --length=40)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -53,6 +55,7 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=salt --value=$salt
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -61,12 +64,10 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=9876) port=$(ynh_find_port --port=9876)
ynh_app_setting_set --app=$app --key=port --value=$port ynh_app_setting_set --app=$app --key=port --value=$port
salt=$(ynh_string_random --length=40)
ynh_app_setting_set --app=$app --key=salt --value=$salt
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
@ -104,7 +105,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
mkdir "$final_path/data" mkdir -p "$final_path/data"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
@ -134,6 +135,7 @@ virtualenv --python=python3 --system-site-packages "${final_path}/venv"
pip install --upgrade pip pip install --upgrade pip
pip install woob html2text simplejson BeautifulSoup4 PyExecJS typing-extensions pdfminer.six --ignore-installed pip install woob html2text simplejson BeautifulSoup4 PyExecJS typing-extensions pdfminer.six --ignore-installed
) )
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# INTSALL KRESUS WITH NPM # INTSALL KRESUS WITH NPM
@ -143,10 +145,9 @@ ynh_script_progression --message="Installing app..."
ynh_use_nodejs ynh_use_nodejs
( (
cd "$final_path" cd "$final_path"
chown -R "$app": "$final_path"
ynh_exec_warn_less $ynh_npm install --production --unsafe-perm ynh_exec_warn_less $ynh_npm install --production --unsafe-perm
) )
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION

View file

@ -81,8 +81,8 @@ ynh_remove_nginx_config
ynh_script_progression --message="Removing dependencies..." ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies
ynh_remove_nodejs ynh_remove_nodejs
ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE

View file

@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -29,7 +32,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
salt=$(ynh_app_setting_get --app=$app --key=salt) salt=$(ynh_app_setting_get --app=$app --key=salt)
#================================================= #=================================================
@ -49,13 +51,6 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # 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 # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -89,15 +84,21 @@ ynh_script_progression --message="Reinstalling dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# 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 THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." ynh_script_progression --message="Restoring the PostgreSQL database..."
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_print_OFF db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_print_ON
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#================================================= #=================================================

View file

@ -40,6 +40,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
@ -117,14 +118,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
@ -142,6 +135,14 @@ then
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
fi fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -159,6 +160,7 @@ virtualenv --python=python3 --system-site-packages "${final_path}/venv"
pip install --upgrade pip pip install --upgrade pip
pip install woob html2text simplejson BeautifulSoup4 PyExecJS typing-extensions pdfminer.six --ignore-installed pip install woob html2text simplejson BeautifulSoup4 PyExecJS typing-extensions pdfminer.six --ignore-installed
) )
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# INSTALL KRESUS WITH NPM # INSTALL KRESUS WITH NPM
@ -168,7 +170,6 @@ ynh_script_progression --message="Installing app..."
ynh_use_nodejs ynh_use_nodejs
( (
cd "$final_path" cd "$final_path"
chown -R $app: "$final_path"
# In case of nodejs upgrade, remove the current node_modules to make sure there are no errors # In case of nodejs upgrade, remove the current node_modules to make sure there are no errors
# linked to modules compiled for the previous version. # linked to modules compiled for the previous version.
@ -176,6 +177,7 @@ ynh_use_nodejs
ynh_exec_warn_less $ynh_npm install --production --unsafe-perm ynh_exec_warn_less $ynh_npm install --production --unsafe-perm
) )
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE