From 3cd5e703e59a8959a2ac72340d389fb8b9e94f2c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 14:17:45 +0100 Subject: [PATCH 01/71] upgrade to node install --- conf/app.src | 4 +- conf/systemd.service | 16 + scripts/_common.sh | 19 + scripts/backup | 14 + scripts/change_url | 59 +- scripts/install | 95 +- scripts/remove | 81 +- scripts/restore | 54 +- scripts/upgrade | 91 +- sources/empty.html | 12900 ----------------------------------------- 10 files changed, 363 insertions(+), 12970 deletions(-) mode change 100644 => 100755 conf/app.src create mode 100755 conf/systemd.service create mode 100755 scripts/_common.sh mode change 100644 => 100755 scripts/backup mode change 100644 => 100755 scripts/change_url mode change 100644 => 100755 scripts/restore mode change 100644 => 100755 scripts/upgrade delete mode 100644 sources/empty.html diff --git a/conf/app.src b/conf/app.src old mode 100644 new mode 100755 index f95eb29..9aeddf2 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/apankrat/nullboard/archive/d449da9f54677ef9ef5c066106e78c0b16be996a.tar.gz -SOURCE_SUM=1126b02a8626e6685c4b6f1892ea43a6e3aa7a04cc91243bea672d10268435e8 +SOURCE_URL=https://github.com/Jermolene/TiddlyWiki5/archive/v5.1.21.tar.gz +SOURCE_SUM=9f36a082f55334fd4b88f9af82a8711c4ef787b04f5280e52dd97e0df9864616 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/systemd.service b/conf/systemd.service new file mode 100755 index 0000000..668a965 --- /dev/null +++ b/conf/systemd.service @@ -0,0 +1,16 @@ +[Unit] +Description=__APP__ service +After=network.target + +[Service] +Type=simple +User=__APP__ +Group=__APP__ +WorkingDirectory=__FINALPATH__ +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic +Restart=always +Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ +Environment=NODE_ENV=production + +[Install] +WantedBy=multi-user.target diff --git a/scripts/_common.sh b/scripts/_common.sh new file mode 100755 index 0000000..7912aa4 --- /dev/null +++ b/scripts/_common.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +#================================================= +# COMMON VARIABLES +#================================================= + +nodejs_version=14 + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/backup b/scripts/backup old mode 100644 new mode 100755 index 80e4cd6..e3fec32 --- a/scripts/backup +++ b/scripts/backup @@ -6,12 +6,18 @@ # IMPORT GENERIC HELPERS #================================================= +#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 #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -41,6 +47,14 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# SPECIFIC BACKUP +#================================================= +# BACKUP SYSTEMD +#================================================= + +ynh_backup --src_path="/etc/systemd/system/$app.service" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url old mode 100644 new mode 100755 index e912667..a4cec5f --- a/scripts/change_url +++ b/scripts/change_url @@ -6,47 +6,30 @@ # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers -ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS #================================================= +ynh_print_info --message="Retrieve arguments from the manifest" old_domain=$YNH_APP_OLD_DOMAIN old_path=$YNH_APP_OLD_PATH new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +new_path="/" app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_print_info --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up $app before changing its URL (may take a while)..." --weight=2 - -# 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 #================================================= @@ -63,26 +46,35 @@ then change_path=1 fi +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_print_info --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action="stop" + #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 +ynh_print_info --message="Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the NGINX config file +# 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 + # 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 + # Set global variables for nginx helper domain="$old_domain" path_url="$new_path" - # Create a dedicated NGINX config + # Create a dedicated nginx config ynh_add_nginx_config fi -# Change the domain for NGINX +# Change the domain for nginx if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -92,10 +84,19 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# GENERIC FINALISATION +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_print_info --message="Starting a systemd service..." + +ynh_systemd_action --service_name=$app --action="start" + #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 +ynh_print_info --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -103,4 +104,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_print_info --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 4f3cbde..b83dd51 100755 --- a/scripts/install +++ b/scripts/install @@ -6,18 +6,23 @@ # IMPORT GENERIC HELPERS #================================================= +source _common.sh +source ynh_send_readme_to_admin__2 source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -# Retrieve arguments domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH @@ -25,12 +30,14 @@ is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME +# ldap_user="svc_${app}_ldap" +# ldap_password=$(ynh_string_random --length=8) + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +ynh_script_progression --message="Validating installation parameters..." -# Copy files to the right place final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -40,35 +47,73 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 +ynh_script_progression --message="Storing installation settings..." -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=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=is_public --value=$is_public +# ynh_app_setting_set --app=$app --key=ldap_user --value=$ldap_user +# ynh_app_setting_set --app=$app --key=ldap_password --value=$ldap_password + #================================================= # STANDARD MODIFICATIONS +#================================================= +# FIND AND OPEN A PORT +#================================================= +ynh_script_progression --message="Finding an available port..." + +# Find a free port +port=$(ynh_find_port --port=8095) +ynh_app_setting_set --app=$app --key=port --value=$port + +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." + +ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path - # Download, check integrity, uncompress and patch the source from app.src -#ynh_setup_source --dest_dir="$final_path" - -mkdir -p $final_path -cp -a ../sources/empty.html $final_path/empty.html +ynh_setup_source --dest_dir=$final_path #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +ynh_script_progression --message="Configuring NGINX web server..." -# Create a dedicated NGINX config +# Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user ..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir=$final_path + +#================================================= +# SPECIFIC SETUP +#================================================= +ynh_script_progression --message="tiddlywiki..." --weight=2 +pushd $final_path + $nodejs_path/node $final_path/tiddlywiki monwiki --init server +popd + +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." + +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #================================================= @@ -76,7 +121,23 @@ ynh_add_nginx_config #================================================= # Set permissions to app files -chown -R root: $final_path +chown -R $app: $final_path + +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 + +yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_print_info --message="on demarre le service..." + +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Browse to http://localhost" + +sleep 30 #================================================= # SETUP SSOWAT @@ -92,7 +153,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_print_info --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -100,4 +161,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_print_info --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 2123569..5d9c264 100755 --- a/scripts/remove +++ b/scripts/remove @@ -6,24 +6,66 @@ # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_print_info --message="Loading installation settings..." 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) +ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user) + #================================================= # STANDARD REMOVE +#================================================= +# REMOVE SERVICE FROM ADMIN PANEL +#================================================= + +# Remove a service from the admin panel, added by `yunohost service add` +if ynh_exec_warn_less yunohost service status $app >/dev/null +then + ynh_print_info --message="Removing $app service..." + yunohost service remove $app +fi + +#================================================= +# STOP AND REMOVE SERVICE +#================================================= +ynh_print_info --message="Stopping and removing the systemd service..." + +# Remove the dedicated systemd config +ynh_remove_systemd_config + +#================================================= +# REMOVE THE POSTGRESQL DATABASE +#================================================= +ynh_print_info --message="Removing the PostgreSQL database..." + +# Remove a database if it exists, along with the associated user +ynh_psql_remove_db --db_user=$db_user --db_name=$db_name + +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_print_info --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies +ynh_remove_nodejs + #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing $app main directory..." --weight=3 +ynh_print_info --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -31,13 +73,42 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_print_info --message="Removing nginx web server configuration..." -# Remove the dedicated NGINX config +# Remove the dedicated nginx config ynh_remove_nginx_config +#================================================= +# CLOSE A PORT +#================================================= + +if yunohost firewall list | grep -q "\- $port$" +then + ynh_print_info --message="Closing port $port..." + ynh_exec_warn_less yunohost firewall disallow TCP $port +fi + +#================================================= +# SPECIFIC REMOVE +#================================================= +# REMOVE LDAP USER +#================================================= +ynh_print_info --message="Removing ldap user..." + +yunohost user delete $ldap_user --purge + +#================================================= +# GENERIC FINALIZATION +#================================================= +# REMOVE DEDICATED USER +#================================================= +ynh_print_info --message="Removing the dedicated system user..." + +# Delete a system user +ynh_system_user_delete --username=$app + #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_print_info --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore old mode 100644 new mode 100755 index 7680bdd..0f17565 --- a/scripts/restore +++ b/scripts/restore @@ -6,18 +6,24 @@ # IMPORT GENERIC HELPERS #================================================= +#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 #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --weight=1 +ynh_print_info --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -28,7 +34,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +ynh_print_info --message="Validating restoration parameters..." ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -46,31 +52,63 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring $app main directory..." --weight=2 +ynh_print_info --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +ynh_print_info --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # RESTORE USER RIGHTS #================================================= # Restore permissions on app files -chown -R root: $final_path +chown -R $app: $final_path + +#================================================= +# SPECIFIC RESTORATION +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_print_info --message="Reinstalling dependencies..." + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_print_info --message="Restoring the systemd configuration..." + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet + +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + +yunohost service add $app --description="" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_print_info --message="Starting a systemd service..." + +ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="" + #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=3 +ynh_print_info --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -78,4 +116,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_print_info --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade old mode 100644 new mode 100755 index dc4d419..a6d7083 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,12 +6,13 @@ # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -19,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION @@ -29,7 +31,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_print_info --message="Ensuring downward compatibility..." # If final_path doesn't exist, create it if [ -z "$final_path" ]; then @@ -37,27 +39,44 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=3 +ynh_print_info --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { # restore it if the upgrade fails ynh_restore_upgradebackup + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_print_info --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action=stop + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=4 + ynh_print_info --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -66,22 +85,76 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 +ynh_print_info --message="Upgrading NGINX web server configuration..." -# Create a dedicated NGINX config +# Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_print_info --message="Upgrading dependencies..." + +ynh_install_nodejs --nodejs_version=$nodejs_version + +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_print_info --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir=$final_path + +#================================================= +# SPECIFIC UPGRADE +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +config_file="$final_path/config.yml" +ynh_backup_if_checksum_is_different --file=$config_file +cp -f ../conf/config.sample.yml $config_file + +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=$config_file +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file=$config_file +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file=$config_file + +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= + +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum --file=$config_file + +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_print_info --message="Upgrading systemd configuration..." + +ynh_add_systemd_config + +#================================================= +# GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= # Set permissions on app files -chown -R root: $final_path +chown -R $app: $final_path + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_print_info --message="Starting a systemd service..." + +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd + +sleep 30 #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_print_info --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -89,4 +162,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_print_info --message="Upgrade of $app completed" diff --git a/sources/empty.html b/sources/empty.html deleted file mode 100644 index f7486dc..0000000 --- a/sources/empty.html +++ /dev/null @@ -1,12900 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -TiddlyWiki — a non-linear personal web notebook - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - From 28c6c7ec2e9c24920dd1239f45cbd02121ce96b5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 14:30:51 +0100 Subject: [PATCH 02/71] Fix --- conf/app.src | 4 ++-- scripts/backup | 1 - scripts/change_url | 6 +++--- scripts/install | 28 +++++++++++----------------- scripts/remove | 35 +---------------------------------- scripts/restore | 16 ++++++++-------- scripts/upgrade | 45 +++++++++++---------------------------------- 7 files changed, 36 insertions(+), 99 deletions(-) diff --git a/conf/app.src b/conf/app.src index 9aeddf2..646e432 100755 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Jermolene/TiddlyWiki5/archive/v5.1.21.tar.gz -SOURCE_SUM=9f36a082f55334fd4b88f9af82a8711c4ef787b04f5280e52dd97e0df9864616 +SOURCE_URL=https://github.com/Jermolene/TiddlyWiki5/archive/v5.1.23.tar.gz +SOURCE_SUM=a35f8a4cb25f1f75e49ec40dcc9b1cd7ef4fb099322507464272be720fdc28d3 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/scripts/backup b/scripts/backup index e3fec32..d548f15 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -#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 diff --git a/scripts/change_url b/scripts/change_url index a4cec5f..fd0d5b0 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -27,8 +27,8 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_print_info --message="Loading installation settings..." -# 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) #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED @@ -53,7 +53,7 @@ fi #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action=stop #================================================= # MODIFY URL IN NGINX CONF @@ -91,7 +91,7 @@ fi #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action=start #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index b83dd51..32a68c1 100755 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_send_readme_to_admin__2 source /usr/share/yunohost/helpers #================================================= @@ -30,13 +29,10 @@ is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME -# ldap_user="svc_${app}_ldap" -# ldap_password=$(ynh_string_random --length=8) - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +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" @@ -47,21 +43,18 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." --weight=1 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=is_public --value=$is_public -# ynh_app_setting_set --app=$app --key=ldap_user --value=$ldap_user -# ynh_app_setting_set --app=$app --key=ldap_password --value=$ldap_password - #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." +ynh_script_progression --message="Finding an available port..." --weight=1 # Find a free port port=$(ynh_find_port --port=8095) @@ -77,7 +70,7 @@ ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." +ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -86,7 +79,7 @@ ynh_setup_source --dest_dir=$final_path #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -94,7 +87,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user ..." +ynh_script_progression --message="Configuring system user ..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path @@ -103,6 +96,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path # SPECIFIC SETUP #================================================= ynh_script_progression --message="tiddlywiki..." --weight=2 + pushd $final_path $nodejs_path/node $final_path/tiddlywiki monwiki --init server popd @@ -110,7 +104,7 @@ popd #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." +ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_add_systemd_config @@ -135,7 +129,7 @@ yunohost service add $app --description="Collaborative editor" --log="/var/log/$ #================================================= ynh_print_info --message="on demarre le service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Browse to http://localhost" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="" sleep 30 @@ -153,7 +147,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -161,4 +155,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 5d9c264..a082345 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,12 +18,8 @@ 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) -ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user) - #================================================= # STANDARD REMOVE #================================================= @@ -45,21 +41,11 @@ ynh_print_info --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE THE POSTGRESQL DATABASE -#================================================= -ynh_print_info --message="Removing the PostgreSQL database..." - -# Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_user --db_name=$db_name - #================================================= # REMOVE DEPENDENCIES #================================================= ynh_print_info --message="Removing dependencies..." -# Remove metapackage and its dependencies -ynh_remove_app_dependencies ynh_remove_nodejs #================================================= @@ -73,30 +59,11 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration..." +ynh_print_info --message="Removing NGINX web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_print_info --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE LDAP USER -#================================================= -ynh_print_info --message="Removing ldap user..." - -yunohost user delete $ldap_user --purge - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 0f17565..612cf43 100755 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading settings..." +ynh_print_info --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -34,7 +34,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info --message="Validating restoration parameters..." +ynh_print_info --message="Validating restoration parameters..." --weight=1 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -52,14 +52,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info --message="Restoring the app main directory..." +ynh_print_info --message="Restoring the app main directory..." --weight=1 ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info --message="Recreating the dedicated system user..." +ynh_print_info --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 @@ -76,7 +76,7 @@ chown -R $app: $final_path #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Reinstalling dependencies..." +ynh_print_info --message="Reinstalling dependencies..." --weight=1 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version @@ -84,7 +84,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info --message="Restoring the systemd configuration..." +ynh_print_info --message="Restoring the systemd configuration..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet @@ -108,7 +108,7 @@ ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --lin #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading NGINX web server..." +ynh_print_info --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -116,4 +116,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Restoration completed for $app" +ynh_print_info --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index a6d7083..9dd4942 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -31,7 +31,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info --message="Ensuring downward compatibility..." +ynh_print_info --message="Ensuring downward compatibility..." --weight=1 # If final_path doesn't exist, create it if [ -z "$final_path" ]; then @@ -49,7 +49,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before upgrading (may take a while)..." +ynh_print_info --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -66,7 +66,7 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping a systemd service..." +ynh_print_info --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=stop @@ -85,7 +85,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Upgrading NGINX web server configuration..." +ynh_print_info --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -93,43 +93,22 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info --message="Upgrading dependencies..." +ynh_print_info --message="Upgrading dependencies..." --weight=1 ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Making sure dedicated system user exists..." +ynh_print_info --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 -#================================================= -# SPECIFIC UPGRADE -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -config_file="$final_path/config.yml" -ynh_backup_if_checksum_is_different --file=$config_file -cp -f ../conf/config.sample.yml $config_file - -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=$config_file -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file=$config_file -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file=$config_file - -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file=$config_file - #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Upgrading systemd configuration..." +ynh_print_info --message="Upgrading systemd configuration..." --weight=1 ynh_add_systemd_config @@ -145,11 +124,9 @@ chown -R $app: $final_path #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_print_info --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd - -sleep 30 +ynh_systemd_action --service_name=$app --action=start --log_path=systemd #================================================= # RELOAD NGINX @@ -162,4 +139,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Upgrade of $app completed" +ynh_print_info --message="Upgrade of $app completed" --last From a28d549e2dbf62b013fe5327c88b58f2218c4b1b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 14:48:08 +0100 Subject: [PATCH 03/71] Fix --- conf/nginx.conf | 18 +++++++++++++----- conf/systemd.service | 8 ++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b072a55..4390138 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,16 +1,24 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/ ; - - index empty.html; - # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + proxy_pass http://127.0.0.1:__PORT__; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + + proxy_http_version 1.1; + proxy_set_header Connection "upgrade"; + proxy_set_header Upgrade $http_upgrade; + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; + more_clear_input_headers 'Accept-Encoding'; } diff --git a/conf/systemd.service b/conf/systemd.service index 668a965..71b2c4e 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,16 +1,16 @@ [Unit] -Description=__APP__ service +Description=TiddlyWiki: interactive wiki After=network.target [Service] Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic -Restart=always Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ Environment=NODE_ENV=production +WorkingDirectory=__FINALPATH__ +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki mywiki --listen port=__port__ authenticated-user-header=basic +Restart=always [Install] WantedBy=multi-user.target From 220ee96d9214892fd9eb9233b6ef29574936412d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:14:41 +0100 Subject: [PATCH 04/71] Fix --- conf/systemd.service | 6 +++--- scripts/install | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 71b2c4e..6033abb 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,10 +6,10 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ -Environment=NODE_ENV=production WorkingDirectory=__FINALPATH__ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki mywiki --listen port=__port__ authenticated-user-header=basic +Environment="NODE_ENV=production" +Environment="__YNH_NODE_LOAD_PATH__" +ExecStart=__FINALPATH__/ mywiki --listen port=__port__ authenticated-user-header=basic Restart=always [Install] diff --git a/scripts/install b/scripts/install index 32a68c1..6203265 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,8 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="tiddlywiki..." --weight=2 pushd $final_path - $nodejs_path/node $final_path/tiddlywiki monwiki --init server + #$nodejs_path/node $final_path/tiddlywiki mywiki --init server + ynh_exec_as $app env "$ynh_node_load_PATH" $final_path/ mywiki --init server popd #================================================= @@ -106,7 +107,7 @@ popd #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_systemd_config +ynh_add_systemd_config --others_var="ynh_node_load_PATH" #================================================= # GENERIC FINALIZATION From 3efea5700ef3f40ac914315f62dd4ecc4c773659 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:16:05 +0100 Subject: [PATCH 05/71] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 6203265..9ef0498 100755 --- a/scripts/install +++ b/scripts/install @@ -117,6 +117,7 @@ ynh_add_systemd_config --others_var="ynh_node_load_PATH" # Set permissions to app files chown -R $app: $final_path +chmod-R 755 $final_path #================================================= # ADVERTISE SERVICE IN ADMIN PANEL From ced8e5baadb89bd973a4f3ac8f60c205820875df Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:17:53 +0100 Subject: [PATCH 06/71] Fix --- scripts/_common.sh | 13 +++++++++++++ scripts/install | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7912aa4..d7982dd 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -17,3 +17,16 @@ nodejs_version=14 #================================================= # FUTURE OFFICIAL HELPERS #================================================= + +# Execute a command as another user +# usage: ynh_exec_as USER COMMAND [ARG ...] +ynh_exec_as() { + local USER=$1 + shift 1 + + if [[ $USER = $(whoami) ]]; then + eval "$@" + else + sudo -u "$USER" "$@" + fi +} diff --git a/scripts/install b/scripts/install index 9ef0498..6c61460 100755 --- a/scripts/install +++ b/scripts/install @@ -87,7 +87,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user ..." --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path @@ -99,7 +99,7 @@ ynh_script_progression --message="tiddlywiki..." --weight=2 pushd $final_path #$nodejs_path/node $final_path/tiddlywiki mywiki --init server - ynh_exec_as $app env "$ynh_node_load_PATH" $final_path/ mywiki --init server + ynh_exec_as $app env "$ynh_node_load_PATH" $final_path/tiddlywiki mywiki --init server popd #================================================= From eba14310ed405c7ccd213f5337cd002ed956ec14 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:19:24 +0100 Subject: [PATCH 07/71] Update install --- scripts/install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 6c61460..c1791b6 100755 --- a/scripts/install +++ b/scripts/install @@ -97,9 +97,11 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= ynh_script_progression --message="tiddlywiki..." --weight=2 +chown -R $app: $final_path + pushd $final_path #$nodejs_path/node $final_path/tiddlywiki mywiki --init server - ynh_exec_as $app env "$ynh_node_load_PATH" $final_path/tiddlywiki mywiki --init server + env "$ynh_node_load_PATH" $final_path/tiddlywiki mywiki --init server popd #================================================= From bce24f07e009b083c573b764edcaae9e34c664d1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:20:16 +0100 Subject: [PATCH 08/71] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c1791b6..1b508cc 100755 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ chown -R $app: $final_path pushd $final_path #$nodejs_path/node $final_path/tiddlywiki mywiki --init server - env "$ynh_node_load_PATH" $final_path/tiddlywiki mywiki --init server + env "$ynh_node_load_PATH" $final_path mywiki --init server popd #================================================= From 34a154cd0e5e5aa394cac9382f59b8c246fb2294 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:22:15 +0100 Subject: [PATCH 09/71] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 1b508cc..deae712 100755 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ chown -R $app: $final_path pushd $final_path #$nodejs_path/node $final_path/tiddlywiki mywiki --init server - env "$ynh_node_load_PATH" $final_path mywiki --init server + "$ynh_node_load_PATH" $final_path mywiki --init server popd #================================================= From 42396c89d21272279e55c1ff0002823d194cb0e2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:30:37 +0100 Subject: [PATCH 10/71] Update install --- scripts/install | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index deae712..b9f9f61 100755 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ chown -R $app: $final_path pushd $final_path #$nodejs_path/node $final_path/tiddlywiki mywiki --init server - "$ynh_node_load_PATH" $final_path mywiki --init server + $ynh_node_load_PATH $final_path mywiki --init server popd #================================================= @@ -109,7 +109,7 @@ popd #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_systemd_config --others_var="ynh_node_load_PATH" +ynh_add_systemd_config --others_var=ynh_node_load_PATH #================================================= # GENERIC FINALIZATION @@ -135,8 +135,6 @@ ynh_print_info --message="on demarre le service..." ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="" -sleep 30 - #================================================= # SETUP SSOWAT #================================================= From d228128b7ec22046abf5cb1946f1cdeb1d477b8e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:32:41 +0100 Subject: [PATCH 11/71] Update install --- scripts/install | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/install b/scripts/install index b9f9f61..3258c39 100755 --- a/scripts/install +++ b/scripts/install @@ -92,18 +92,6 @@ ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path -#================================================= -# SPECIFIC SETUP -#================================================= -ynh_script_progression --message="tiddlywiki..." --weight=2 - -chown -R $app: $final_path - -pushd $final_path - #$nodejs_path/node $final_path/tiddlywiki mywiki --init server - $ynh_node_load_PATH $final_path mywiki --init server -popd - #================================================= # SETUP SYSTEMD #================================================= From b1299fbf4c18d6909fa3494048aefb6f3a9fe8e3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:33:31 +0100 Subject: [PATCH 12/71] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 3258c39..7b00230 100755 --- a/scripts/install +++ b/scripts/install @@ -107,7 +107,7 @@ ynh_add_systemd_config --others_var=ynh_node_load_PATH # Set permissions to app files chown -R $app: $final_path -chmod-R 755 $final_path +chmod -R 755 $final_path #================================================= # ADVERTISE SERVICE IN ADMIN PANEL From 04fcb6e460d4a39f7c3083e7f4e021af5a20a3d2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:37:57 +0100 Subject: [PATCH 13/71] Fix --- conf/systemd.service | 6 +++--- scripts/install | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 6033abb..cfb9b2b 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,10 +7,10 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -Environment="NODE_ENV=production" -Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__FINALPATH__/ mywiki --listen port=__port__ authenticated-user-header=basic +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic Restart=always +Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ +Environment=NODE_ENV=production [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 7b00230..14ba753 100755 --- a/scripts/install +++ b/scripts/install @@ -92,12 +92,23 @@ ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path +#================================================= +# SPECIFIC SETUP +#================================================= +ynh_script_progression --message="tiddlywiki..." --weight=2 + +pushd $final_path + $nodejs_path/node $final_path/tiddlywiki monwiki --init server +popd + #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_systemd_config --others_var=ynh_node_load_PATH +ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__port__" --replace_string="$port" --target_file="../conf/systemd.service" +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION @@ -107,7 +118,7 @@ ynh_add_systemd_config --others_var=ynh_node_load_PATH # Set permissions to app files chown -R $app: $final_path -chmod -R 755 $final_path +chmod-R 755 $final_path #================================================= # ADVERTISE SERVICE IN ADMIN PANEL From f78ce4ed89a29465611819977a398c166e14495f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:38:48 +0100 Subject: [PATCH 14/71] Update install --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index 14ba753..e2a2259 100755 --- a/scripts/install +++ b/scripts/install @@ -118,7 +118,6 @@ ynh_add_systemd_config # Set permissions to app files chown -R $app: $final_path -chmod-R 755 $final_path #================================================= # ADVERTISE SERVICE IN ADMIN PANEL From 976fb3548bc0edd8c2626553140e765271e46682 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:40:11 +0100 Subject: [PATCH 15/71] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index e2a2259..d57ea80 100755 --- a/scripts/install +++ b/scripts/install @@ -129,7 +129,7 @@ yunohost service add $app --description="Collaborative editor" --log="/var/log/$ #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="on demarre le service..." +ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="" From 00fcc4072701cfc9830d6d184d36d5052fc7a79f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 16:50:51 +0100 Subject: [PATCH 16/71] fix --- conf/systemd.service | 7 ++++--- scripts/install | 6 ++---- scripts/restore | 3 +-- scripts/upgrade | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index cfb9b2b..b7bfb55 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,10 +7,11 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic -Restart=always -Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ +Environment="PATH=__ENV_PATH__" Environment=NODE_ENV=production +ExecStart=__YNH_NPM__ __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic +Restart=always [Install] WantedBy=multi-user.target + diff --git a/scripts/install b/scripts/install index d57ea80..6d0a975 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="tiddlywiki..." --weight=2 pushd $final_path - $nodejs_path/node $final_path/tiddlywiki monwiki --init server + $ynh_node $final_path/tiddlywiki monwiki --init server popd #================================================= @@ -106,8 +106,6 @@ popd #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__port__" --replace_string="$port" --target_file="../conf/systemd.service" ynh_add_systemd_config #================================================= @@ -131,7 +129,7 @@ yunohost service add $app --description="Collaborative editor" --log="/var/log/$ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started TiddlyWiki: interactive wiki." #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 612cf43..0ad1afa 100755 --- a/scripts/restore +++ b/scripts/restore @@ -100,8 +100,7 @@ yunohost service add $app --description="" --log="/var/log/$app/$app.log" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="" - +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started TiddlyWiki: interactive wiki." #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 9dd4942..98322d5 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -126,7 +126,7 @@ chown -R $app: $final_path #================================================= ynh_print_info --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started TiddlyWiki: interactive wiki." #================================================= # RELOAD NGINX From 12bafaff72320c6bc477aa277a96d92f697d371e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 18:47:49 +0100 Subject: [PATCH 17/71] Update systemd.service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index b7bfb55..33d5b0b 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment="PATH=__ENV_PATH__" Environment=NODE_ENV=production -ExecStart=__YNH_NPM__ __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic +ExecStart=__YNH_NODE__ __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic Restart=always [Install] From 23f57ae57f356e551379cedaf1b15a11cfbe37f5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 18:52:03 +0100 Subject: [PATCH 18/71] Fix --- conf/systemd.service | 7 ++++--- manifest.json | 4 ++-- scripts/_common.sh | 13 ------------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 33d5b0b..22c4f63 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,11 +7,12 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -Environment="PATH=__ENV_PATH__" -Environment=NODE_ENV=production -ExecStart=__YNH_NODE__ __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic Restart=always +Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ +Environment=NODE_ENV=production [Install] WantedBy=multi-user.target + diff --git a/manifest.json b/manifest.json index f96f934..0dd0eb9 100644 --- a/manifest.json +++ b/manifest.json @@ -38,8 +38,8 @@ "en": "Choose a path for TiddlyWiki", "fr": "Choisissez un chemin pour TiddlyWiki" }, - "example": "/tiddlywiki", - "default": "/tiddlywiki" + "example": "/", + "default": "/" }, { "name": "is_public", diff --git a/scripts/_common.sh b/scripts/_common.sh index d7982dd..7912aa4 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -17,16 +17,3 @@ nodejs_version=14 #================================================= # FUTURE OFFICIAL HELPERS #================================================= - -# Execute a command as another user -# usage: ynh_exec_as USER COMMAND [ARG ...] -ynh_exec_as() { - local USER=$1 - shift 1 - - if [[ $USER = $(whoami) ]]; then - eval "$@" - else - sudo -u "$USER" "$@" - fi -} From c23b5e00b3eb26ff24367f664ba2f69d90c7642e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 18:56:52 +0100 Subject: [PATCH 19/71] fix --- conf/nginx.conf | 2 +- conf/systemd.service | 2 -- scripts/install | 4 +++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 4390138..0f87f4b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,5 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { +location / { # Force usage of https if ($scheme = http) { diff --git a/conf/systemd.service b/conf/systemd.service index 22c4f63..cfb9b2b 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -14,5 +14,3 @@ Environment=NODE_ENV=production [Install] WantedBy=multi-user.target - - diff --git a/scripts/install b/scripts/install index 6d0a975..e57ca19 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="tiddlywiki..." --weight=2 pushd $final_path - $ynh_node $final_path/tiddlywiki monwiki --init server + $nodejs_path/node $final_path/tiddlywiki monwiki --init server popd #================================================= @@ -106,6 +106,8 @@ popd #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__port__" --replace_string="$port" --target_file="../conf/systemd.service" ynh_add_systemd_config #================================================= From 2425090491c81ab7668ac8b255e73f81cc2e7c2b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 20:00:10 +0100 Subject: [PATCH 20/71] Fix --- conf/systemd.service | 2 +- scripts/install | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index cfb9b2b..1549372 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__port__ authenticated-user-header=basic +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__PORT__ authenticated-user-header=basic Restart=always Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ Environment=NODE_ENV=production diff --git a/scripts/install b/scripts/install index e57ca19..afffd59 100755 --- a/scripts/install +++ b/scripts/install @@ -107,7 +107,6 @@ popd ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__port__" --replace_string="$port" --target_file="../conf/systemd.service" ynh_add_systemd_config #================================================= From a3ac1dabb1213813df5faa251023c8b2a378448a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 20:01:36 +0100 Subject: [PATCH 21/71] Update change_url --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index fd0d5b0..cdeff81 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -58,7 +58,7 @@ ynh_systemd_action --service_name=$app --action=stop #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info --message="Updating nginx web server configuration..." +ynh_print_info --message="Updating NGINX web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf From fffb626c7ffcea3e6609f48e57bf1b89418cac28 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 21:56:01 +0100 Subject: [PATCH 22/71] Fix --- conf/nginx.conf | 1 - manifest.json | 10 ---------- scripts/install | 6 +++--- scripts/remove | 2 +- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0f87f4b..84c3405 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,3 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location / { # Force usage of https diff --git a/manifest.json b/manifest.json index 0dd0eb9..17abe5a 100644 --- a/manifest.json +++ b/manifest.json @@ -31,16 +31,6 @@ }, "example": "domain.org" }, - { - "name": "path", - "type": "path", - "ask": { - "en": "Choose a path for TiddlyWiki", - "fr": "Choisissez un chemin pour TiddlyWiki" - }, - "example": "/", - "default": "/" - }, { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index afffd59..83c3fad 100755 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH +path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -95,10 +95,10 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # SPECIFIC SETUP #================================================= -ynh_script_progression --message="tiddlywiki..." --weight=2 +ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path - $nodejs_path/node $final_path/tiddlywiki monwiki --init server + $nodejs_path/node tiddlywiki monwiki --init server popd #================================================= diff --git a/scripts/remove b/scripts/remove index a082345..306f0a9 100755 --- a/scripts/remove +++ b/scripts/remove @@ -54,7 +54,7 @@ ynh_remove_nodejs ynh_print_info --message="Removing app main directory..." # Remove the app directory securely -ynh_secure_remove --file="$final_path" +ynh_secure_remove --file=$final_path #================================================= # REMOVE NGINX CONFIGURATION From c24e9bf6fc8ef0d60fdca9c528937fee560d677f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 22:22:07 +0100 Subject: [PATCH 23/71] Fix --- conf/nginx.conf | 1 - scripts/install | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 84c3405..f7b7e81 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,5 +19,4 @@ location / { # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; - more_clear_input_headers 'Accept-Encoding'; } diff --git a/scripts/install b/scripts/install index 83c3fad..6d39e43 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path - $nodejs_path/node tiddlywiki monwiki --init server + $nodejs_path/node $final_path/tiddlywiki monwiki --init server popd #================================================= From 647a5c2955e8940f2363b884fd4601f60c171ed2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 16 Feb 2021 22:30:29 +0100 Subject: [PATCH 24/71] fix --- conf/systemd.service | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 1549372..26375b1 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki monwiki --listen port=__PORT__ authenticated-user-header=basic +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki mywiki --listen port=__PORT__ authenticated-user-header=basic Restart=always Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ Environment=NODE_ENV=production diff --git a/scripts/install b/scripts/install index 6d39e43..cc88edc 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path - $nodejs_path/node $final_path/tiddlywiki monwiki --init server + $nodejs_path/node $final_path/tiddlywiki mywiki --init server popd #================================================= From c27dec633acd2eef1abe7f81993fec10aacaf243 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 1 Mar 2021 20:51:09 +0100 Subject: [PATCH 25/71] fix --- conf/systemd.service | 2 +- scripts/install | 2 +- scripts/upgrade | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 26375b1..c36a84f 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki mywiki --listen port=__PORT__ authenticated-user-header=basic +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki mynewwiki --listen port=__PORT__ authenticated-user-header=basic Restart=always Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ Environment=NODE_ENV=production diff --git a/scripts/install b/scripts/install index cc88edc..e6fc56c 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path - $nodejs_path/node $final_path/tiddlywiki mywiki --init server + $nodejs_path/node $final_path/tiddlywiki mynewwiki --init server popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 98322d5..c8fd7c7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,7 +79,11 @@ then ynh_print_info --message="Upgrading source files..." # 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" + + pushd $final_path + npm update -g tiddlywiki + popd fi #================================================= From c7f15bab2064237da02d2ce882935c8cce40190a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 9 Mar 2021 23:13:38 +0100 Subject: [PATCH 26/71] Cleaning up --- scripts/install | 3 +-- scripts/restore | 3 ++- scripts/upgrade | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index e6fc56c..904d17c 100755 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 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=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS @@ -123,7 +122,7 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 -yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/$app.log" +yunohost service add $app --description="A non-linear personal web notebook" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index 0ad1afa..a96c28d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -92,8 +92,9 @@ systemctl enable $app.service --quiet #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 -yunohost service add $app --description="" --log="/var/log/$app/$app.log" +yunohost service add $app --description="A non-linear personal web notebook" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index c8fd7c7..486b47c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) @@ -125,6 +124,13 @@ ynh_add_systemd_config # Set permissions on app files chown -R $app: $final_path +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 + +yunohost service add $app --description="A non-linear personal web notebook" --log="/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #================================================= From 11a51bf6faf1516edd8356da7dc36727d85be186 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 9 Mar 2021 23:28:21 +0100 Subject: [PATCH 27/71] Fix --- conf/systemd.service | 7 ++++--- manifest.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index c36a84f..e3c006a 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,10 +7,11 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki mynewwiki --listen port=__PORT__ authenticated-user-header=basic +Environment="NODE_ENV=production" +Environment="__YNH_NODE_LOAD_PATH__" + +ExecStart=__FINALPATH__/tiddlywiki mynewwiki --listen #port=__PORT__ authenticated-user-header=basic Restart=always -Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ -Environment=NODE_ENV=production [Install] WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index 17abe5a..68f012c 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "" }, "requirements": { - "yunohost": ">= 4.0.0" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ From 18c38dca22570e974447bd6f9a35b8e34b266774 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 9 Mar 2021 23:30:02 +0100 Subject: [PATCH 28/71] Update install --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 904d17c..b7be4fd 100755 --- a/scripts/install +++ b/scripts/install @@ -97,7 +97,8 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path - $nodejs_path/node $final_path/tiddlywiki mynewwiki --init server + ynh_use_nodejs + ynh_exec_as $app env $ynh_node_load_PATH tiddlywiki mynewwiki --init server popd #================================================= @@ -105,8 +106,7 @@ popd #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service" -ynh_add_systemd_config +ynh_add_systemd_config --others_var="ynh_node_load_PATH" #================================================= # GENERIC FINALIZATION From 5834c44af1ae4e07392c4a36ce9930682bc176fc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 9 Mar 2021 23:34:25 +0100 Subject: [PATCH 29/71] Update systemd.service --- conf/systemd.service | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index e3c006a..f9ccdbe 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,8 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment="NODE_ENV=production" Environment="__YNH_NODE_LOAD_PATH__" - -ExecStart=__FINALPATH__/tiddlywiki mynewwiki --listen #port=__PORT__ authenticated-user-header=basic +ExecStart=__YNH_NODE_LOAD_PATH__ __FINALPATH__/tiddlywiki mynewwiki --listen #port=__PORT__ authenticated-user-header=basic Restart=always [Install] From fe3be5428d33151948d444835ca87b8220f0ca4f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 9 Mar 2021 23:46:11 +0100 Subject: [PATCH 30/71] Update systemd.service --- conf/systemd.service | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index f9ccdbe..8de904f 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,10 +7,10 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -Environment="NODE_ENV=production" -Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__YNH_NODE_LOAD_PATH__ __FINALPATH__/tiddlywiki mynewwiki --listen #port=__PORT__ authenticated-user-header=basic +Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ +ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki mynewwiki --listen #port=__PORT__ authenticated-user-header=basic Restart=always +Environment=NODE_ENV=production [Install] WantedBy=multi-user.target From 812bb979330d015c6e9bc4111c3589a538562242 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 12:01:31 +0100 Subject: [PATCH 31/71] Fix --- manifest.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/manifest.json b/manifest.json index 68f012c..b08d0ea 100644 --- a/manifest.json +++ b/manifest.json @@ -25,19 +25,11 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for TiddlyWiki", - "fr": "Choisissez un nom de domaine pour TiddlyWiki" - }, "example": "domain.org" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "help": { "en": "If enabled, TiddlyWiki will be accessible by people who doesn’t have an account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, TiddlyWiki sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." From 6937a47a2b336914ca738ae002cd2d7232bd5052 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 12:15:14 +0100 Subject: [PATCH 32/71] fix --- conf/systemd.service | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 8de904f..bba8e38 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,10 +7,10 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -Environment=PATH=/usr/bin:/usr/local/bin:__NODEJS_PATH__ -ExecStart=__NODEJS_PATH__/node __FINALPATH__/tiddlywiki mynewwiki --listen #port=__PORT__ authenticated-user-header=basic +Environment='NODE_ENV=production' +Environment="__YNH_NODE_LOAD_PATH__" +ExecStart=__YNH_NODE_LOAD_PATH__ __FINALPATH__ __FINALPATH__/mynewwiki --server --listen #port=__PORT__ authenticated-user-header=basic Restart=always -Environment=NODE_ENV=production [Install] WantedBy=multi-user.target From 120982f0db2aa90ec8d01d6243f657f136ec2a76 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 12:19:44 +0100 Subject: [PATCH 33/71] Update install --- scripts/install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b7be4fd..6c0441a 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,9 @@ ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path ynh_use_nodejs - ynh_exec_as $app env $ynh_node_load_PATH tiddlywiki mynewwiki --init server + #ynh_exec_as $app env $ynh_node_load_PATH tiddlywiki mynewwiki --init server + npm install -g tiddlywiki + tiddlywiki mynewwiki --init server popd #================================================= From cb8704a138d45ba91811c488fc887d37f5b51d98 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 12:46:29 +0100 Subject: [PATCH 34/71] Update install --- scripts/install | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 6c0441a..1983be2 100755 --- a/scripts/install +++ b/scripts/install @@ -96,11 +96,14 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 +mkdir /var/www/$app +final_path=/var/www/$app pushd $final_path ynh_use_nodejs + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install -g tiddlywiki #ynh_exec_as $app env $ynh_node_load_PATH tiddlywiki mynewwiki --init server - npm install -g tiddlywiki - tiddlywiki mynewwiki --init server + #npm install -g tiddlywiki + ynh_exec_as $app $ynh_node_load_PATH tiddlywiki mynewwiki --init server popd #================================================= From 7b328d84ed961c59e77fe5e06283cce58eb9e2d6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 12:53:08 +0100 Subject: [PATCH 35/71] Update install --- scripts/install | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 1983be2..bf7ebf7 100755 --- a/scripts/install +++ b/scripts/install @@ -96,15 +96,10 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 -mkdir /var/www/$app -final_path=/var/www/$app pushd $final_path ynh_use_nodejs - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install -g tiddlywiki - #ynh_exec_as $app env $ynh_node_load_PATH tiddlywiki mynewwiki --init server - #npm install -g tiddlywiki - ynh_exec_as $app $ynh_node_load_PATH tiddlywiki mynewwiki --init server -popd + ynh_exec_as $app $ynh_node_load_PATH tiddlywiki mynewwiki --init server + popd #================================================= # SETUP SYSTEMD From 8532a9386f0d36688e12463d496e6ce00118f165 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 13:18:32 +0100 Subject: [PATCH 36/71] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index bf7ebf7..ab199c3 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path ynh_use_nodejs - ynh_exec_as $app $ynh_node_load_PATH tiddlywiki mynewwiki --init server + $ynh_node_load_PATH tiddlywiki mynewwiki --init server popd #================================================= From 34025d7e9d12d0cc25a635fc68a9b18b953e548f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 14:54:36 +0100 Subject: [PATCH 37/71] Fix --- conf/systemd.service | 4 +++- scripts/install | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index bba8e38..52a6375 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,8 +9,10 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment='NODE_ENV=production' Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__YNH_NODE_LOAD_PATH__ __FINALPATH__ __FINALPATH__/mynewwiki --server --listen #port=__PORT__ authenticated-user-header=basic +ExecStart=__YNH_NODE_LOAD_PATH__ __FINALPATH__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic Restart=always [Install] WantedBy=multi-user.target + + diff --git a/scripts/install b/scripts/install index ab199c3..74b7fa3 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,8 @@ ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path ynh_use_nodejs - $ynh_node_load_PATH tiddlywiki mynewwiki --init server + ynh_npm install -g tiddlywiki + tiddlywiki mynewwiki --init server popd #================================================= From e454d22b6d52ce6a584039581ad2da5e98d93e03 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 15:22:24 +0100 Subject: [PATCH 38/71] Fix --- conf/systemd.service | 3 +-- scripts/_common.sh | 13 +++++++++++++ scripts/install | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 52a6375..64633e2 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,8 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment='NODE_ENV=production' -Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__YNH_NODE_LOAD_PATH__ __FINALPATH__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic +ExecStart=__YNH_NODE__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic Restart=always [Install] diff --git a/scripts/_common.sh b/scripts/_common.sh index 7912aa4..d7982dd 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -17,3 +17,16 @@ nodejs_version=14 #================================================= # FUTURE OFFICIAL HELPERS #================================================= + +# Execute a command as another user +# usage: ynh_exec_as USER COMMAND [ARG ...] +ynh_exec_as() { + local USER=$1 + shift 1 + + if [[ $USER = $(whoami) ]]; then + eval "$@" + else + sudo -u "$USER" "$@" + fi +} diff --git a/scripts/install b/scripts/install index 74b7fa3..da77163 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,8 @@ ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path ynh_use_nodejs - ynh_npm install -g tiddlywiki + #ynh_npm install -g tiddlywiki + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install -g tiddlywiki tiddlywiki mynewwiki --init server popd From 5599bc23f370c9a43a7825b908f2bda17eb51552 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 15:26:50 +0100 Subject: [PATCH 39/71] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index da77163..dfaafb3 100755 --- a/scripts/install +++ b/scripts/install @@ -99,7 +99,7 @@ ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path ynh_use_nodejs #ynh_npm install -g tiddlywiki - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install -g tiddlywiki + ynh_npm install -g tiddlywiki tiddlywiki mynewwiki --init server popd From 73c47df3151cfe7b0351e816599efbc90dcc9a97 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 15:32:33 +0100 Subject: [PATCH 40/71] Update systemd.service --- conf/systemd.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 64633e2..9902637 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,8 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -Environment='NODE_ENV=production' +Environment=PATH=__ENV_PATH__ +Environment=NODE_ENV=production ExecStart=__YNH_NODE__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic Restart=always From ad76092caa70899bf15a398d6e0da97121f562d5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 15:37:06 +0100 Subject: [PATCH 41/71] Fix --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 9902637..b7000b3 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=__YNH_NODE__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic +ExecStart=__YNH_NPM__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic Restart=always [Install] From cf434cfddb5a2b7aed325454cb275347df45c63c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 15:42:46 +0100 Subject: [PATCH 42/71] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index dfaafb3..348daa0 100755 --- a/scripts/install +++ b/scripts/install @@ -99,7 +99,7 @@ ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path ynh_use_nodejs #ynh_npm install -g tiddlywiki - ynh_npm install -g tiddlywiki + npm install -g tiddlywiki tiddlywiki mynewwiki --init server popd From 7ce99ae1f6e1e252a7f3bd7d6d4586f9b3063efc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 17:31:55 +0100 Subject: [PATCH 43/71] Update systemd.service --- conf/systemd.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index b7000b3..b76bdd5 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,8 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=__YNH_NPM__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic +ExecStart=mynewwiki --listen port=__PORT__ #authenticated-user-header=basic +#tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ Restart=always [Install] From 1502578da9c276e2a3351bb8486b359b8afc62d4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 17:47:21 +0100 Subject: [PATCH 44/71] Fix --- conf/systemd.service | 2 +- scripts/install | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index b76bdd5..cd1dfb6 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=mynewwiki --listen port=__PORT__ #authenticated-user-header=basic +ExecStart=__YNH_NPM__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic #tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ Restart=always diff --git a/scripts/install b/scripts/install index 348daa0..5ee3979 100755 --- a/scripts/install +++ b/scripts/install @@ -108,7 +108,10 @@ pushd $final_path #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_systemd_config --others_var="ynh_node_load_PATH" +ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" + +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION From 2de1528ad27ac9f7037c0d4c1a8651278bb02ba7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 17:55:03 +0100 Subject: [PATCH 45/71] Update systemd.service --- conf/systemd.service | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index cd1dfb6..edea969 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,8 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=__YNH_NPM__ mynewwiki --listen port=__PORT__ #authenticated-user-header=basic -#tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ +ExecStart=__YNH_NPM__ mynewwiki --listen port=__PORT__ Restart=always [Install] From 3dce3a69a943d5a78bae7d7855223ba14b446cb6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:03:40 +0100 Subject: [PATCH 46/71] Fix --- conf/systemd.service | 2 +- manifest.json | 14 ++++++++++++++ scripts/install | 7 ++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index edea969..8a14a27 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=__YNH_NPM__ mynewwiki --listen port=__PORT__ +ExecStart=__YNH_NPM__ mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ Restart=always [Install] diff --git a/manifest.json b/manifest.json index b08d0ea..131537b 100644 --- a/manifest.json +++ b/manifest.json @@ -27,6 +27,20 @@ "type": "domain", "example": "domain.org" }, + { + "name": "admin", + "type": "user", + "example": "johndoe" + }, + { + "name": "password", + "type": "password", + "help": { + "en": "Use the help field to add an information for the admin about this question.", + "fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." + }, + "example": "Choose a password" + } { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index 5ee3979..891e7f2 100755 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC +password=$YNH_APP_ARG_PASSWORD +admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME @@ -47,6 +49,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 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=admin --value=$admin +ynh_app_setting_set --app=$app --key=password --value=$password #================================================= # STANDARD MODIFICATIONS @@ -110,7 +114,8 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" - +ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/systemd.service" ynh_add_systemd_config #================================================= From f0948a8f06371c573180fbdb7599f470fcc2e138 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:07:36 +0100 Subject: [PATCH 47/71] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f7b7e81..d849083 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,7 +5,7 @@ location / { rewrite ^ https://$server_name$request_uri? permanent; } - proxy_pass http://127.0.0.1:__PORT__; + proxy_pass http://127.0.0.1:__PORT__/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; From 6e5d11b57d74ecafca4523f24facf24c83e46c08 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:08:46 +0100 Subject: [PATCH 48/71] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 131537b..feff6a3 100644 --- a/manifest.json +++ b/manifest.json @@ -40,7 +40,7 @@ "fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." }, "example": "Choose a password" - } + }, { "name": "is_public", "type": "boolean", From 23d5540e84c200a5d8cac79f35c2cb89c3301faa Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:11:55 +0100 Subject: [PATCH 49/71] Fix --- conf/systemd.service | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 8a14a27..07f73ec 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=__YNH_NPM__ mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ +ExecStart=__YNH_NODE__ mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ Restart=always [Install] diff --git a/scripts/install b/scripts/install index 891e7f2..39cde56 100755 --- a/scripts/install +++ b/scripts/install @@ -113,7 +113,7 @@ pushd $final_path ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/systemd.service" ynh_add_systemd_config From 77e7ee26d79dea1fd5f0a9e310733213bd8178e9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:28:27 +0100 Subject: [PATCH 50/71] Fix --- conf/systemd.service | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 07f73ec..00abe76 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=__YNH_NODE__ mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ +ExecStart=__YNH_NODE__ tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ Restart=always [Install] diff --git a/scripts/install b/scripts/install index 39cde56..7193cec 100755 --- a/scripts/install +++ b/scripts/install @@ -125,7 +125,7 @@ ynh_add_systemd_config #================================================= # Set permissions to app files -chown -R $app: $final_path +chown -R $app:$app $final_path #================================================= # ADVERTISE SERVICE IN ADMIN PANEL From bdf6c499b10ff65dbbe243bc12d436e728d8b20e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:37:17 +0100 Subject: [PATCH 51/71] Fix --- conf/systemd.service | 2 -- manifest.json | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 00abe76..61a84f6 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -14,5 +14,3 @@ Restart=always [Install] WantedBy=multi-user.target - - diff --git a/manifest.json b/manifest.json index feff6a3..67688b2 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "fr": "Un carnet Web personnel non linéaire" }, "version": "5.1.23~ynh1", - "url": "https://nullboard.io/preview", + "url": "https://tiddlywiki.com/", "license": "BSD-2-Clause", "maintainer": { "name": "eric_G", @@ -35,10 +35,6 @@ { "name": "password", "type": "password", - "help": { - "en": "Use the help field to add an information for the admin about this question.", - "fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." - }, "example": "Choose a password" }, { From d28a633f1517a48c71ba81425e2a905772af8e43 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:44:32 +0100 Subject: [PATCH 52/71] fix --- scripts/install | 17 ++++++++--------- scripts/upgrade | 17 +++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/install b/scripts/install index 7193cec..9f5b92d 100755 --- a/scripts/install +++ b/scripts/install @@ -70,6 +70,14 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_nodejs --nodejs_version=$nodejs_version +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=1 + +# Create a system user +ynh_system_user_create --username=$app --home_dir=$final_path + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -87,14 +95,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # SPECIFIC SETUP #================================================= @@ -102,7 +102,6 @@ ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2 pushd $final_path ynh_use_nodejs - #ynh_npm install -g tiddlywiki npm install -g tiddlywiki tiddlywiki mynewwiki --init server popd diff --git a/scripts/upgrade b/scripts/upgrade index 486b47c..59a9b41 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -69,6 +69,14 @@ ynh_print_info --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=stop +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_print_info --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 + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -81,6 +89,7 @@ then #ynh_setup_source --dest_dir="$final_path" pushd $final_path + ynh_use_nodejs npm update -g tiddlywiki popd fi @@ -100,14 +109,6 @@ ynh_print_info --message="Upgrading dependencies..." --weight=1 ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_print_info --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 - #================================================= # SETUP SYSTEMD #================================================= From 516a8060e86493877158f6466dc6a596f82412cc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:49:26 +0100 Subject: [PATCH 53/71] Update check_process --- check_process | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index 8d5802c..f953b58 100644 --- a/check_process +++ b/check_process @@ -2,8 +2,11 @@ auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) - is_public="Yes" (PUBLIC|public=Yes|private=No) + path="/" (PATH) + admin="john" (USER) + is_public=1 (PUBLIC|public=1|private=0) + password="pass" + port="666" (PORT) ; Checks pkg_linter=1 setup_sub_dir=1 @@ -14,6 +17,14 @@ upgrade=1 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. + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& + + \ No newline at end of file From 787783a264f3c789d06f8d20879c5b2bfb3b6b36 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 18:57:22 +0100 Subject: [PATCH 54/71] Fix --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 9f5b92d..ad8972f 100755 --- a/scripts/install +++ b/scripts/install @@ -138,7 +138,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started TiddlyWiki: interactive wiki." +ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="Serving on" #================================================= # SETUP SSOWAT diff --git a/scripts/upgrade b/scripts/upgrade index 3225e58..379d14e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -134,7 +134,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_print_info --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started TiddlyWiki: interactive wiki." +ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="Serving on" #================================================= # RELOAD NGINX From 107554912a6dc4dc3ab6229151ef73ca5a9cadb7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 19:07:18 +0100 Subject: [PATCH 55/71] Fix --- check_process | 5 +---- scripts/_common.sh | 13 ------------- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 5 files changed, 4 insertions(+), 20 deletions(-) diff --git a/check_process b/check_process index f953b58..b971b5b 100644 --- a/check_process +++ b/check_process @@ -24,7 +24,4 @@ Notification=none ;;; Upgrade options ; commit=CommitHash name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& - - - \ No newline at end of file + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&password=pass&port=666& diff --git a/scripts/_common.sh b/scripts/_common.sh index d7982dd..7912aa4 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -17,16 +17,3 @@ nodejs_version=14 #================================================= # FUTURE OFFICIAL HELPERS #================================================= - -# Execute a command as another user -# usage: ynh_exec_as USER COMMAND [ARG ...] -ynh_exec_as() { - local USER=$1 - shift 1 - - if [[ $USER = $(whoami) ]]; then - eval "$@" - else - sudo -u "$USER" "$@" - fi -} diff --git a/scripts/install b/scripts/install index ad8972f..47f1711 100755 --- a/scripts/install +++ b/scripts/install @@ -138,7 +138,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="Serving on" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving on" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index a96c28d..91f2fc0 100755 --- a/scripts/restore +++ b/scripts/restore @@ -101,7 +101,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started TiddlyWiki: interactive wiki." +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving on" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 379d14e..3c57dd0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -134,7 +134,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_print_info --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="Serving on" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving on" #================================================= # RELOAD NGINX From 88ae744c0d30ae1df14382560338c1878fb9ce2d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 19:09:03 +0100 Subject: [PATCH 56/71] Update manifest.json --- manifest.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/manifest.json b/manifest.json index 4dcdfe1..67688b2 100644 --- a/manifest.json +++ b/manifest.json @@ -45,16 +45,6 @@ "fr": "Si cette case est cochée, TiddlyWiki sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." }, "default": true - }, - { - "name": "language", - "type": "string", - "ask": { - "en": "Choose the application language", - "fr": "Choisissez la langue de l'application" - }, - "choices": ["fr", "en"], - "default": "fr" } ] } From e2c344d7a1a03659a9c0b70249e8fe91759e6945 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 19:23:46 +0100 Subject: [PATCH 57/71] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index b971b5b..d09dc91 100644 --- a/check_process +++ b/check_process @@ -9,7 +9,7 @@ port="666" (PORT) ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=1 setup_nourl=0 setup_private=1 From 9513db921976e0f5f35fd1928e39fc4b446c4849 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 19:37:07 +0100 Subject: [PATCH 58/71] Delete empty_fr.html --- sources/empty_fr.html | 16811 ---------------------------------------- 1 file changed, 16811 deletions(-) delete mode 100644 sources/empty_fr.html diff --git a/sources/empty_fr.html b/sources/empty_fr.html deleted file mode 100644 index 7d008f3..0000000 --- a/sources/empty_fr.html +++ /dev/null @@ -1,16811 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -TiddlyWiki — un carnet de notes web personnel et non linéaire - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - From cdad609cea1954b297994f65be4a2aab5a6d710a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 19:39:54 +0100 Subject: [PATCH 59/71] Update restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 91f2fc0..9339769 100755 --- a/scripts/restore +++ b/scripts/restore @@ -69,7 +69,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # Restore permissions on app files -chown -R $app: $final_path +chown -R $app:$app $final_path #================================================= # SPECIFIC RESTORATION From 2254fe148df2329692b134b34974fadf60dae1f5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 21:06:39 +0100 Subject: [PATCH 60/71] Fix --- scripts/change_url | 14 +++++++------- scripts/install | 3 ++- scripts/remove | 16 ++++++++-------- scripts/restore | 22 +++++++++++----------- scripts/upgrade | 26 +++++++++++++------------- 5 files changed, 41 insertions(+), 40 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index cdeff81..cb1acef 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS #================================================= -ynh_print_info --message="Retrieve arguments from the manifest" +ynh_script_progression --message="Retrieve arguments from the manifest" old_domain=$YNH_APP_OLD_DOMAIN old_path=$YNH_APP_OLD_PATH @@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) @@ -51,14 +51,14 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action=stop #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info --message="Updating NGINX web server configuration..." +ynh_script_progression --message="Updating NGINX web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -89,14 +89,14 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action=start #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -104,4 +104,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Change of URL completed for $app" +ynh_script_progression --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 47f1711..e7ac8d1 100755 --- a/scripts/install +++ b/scripts/install @@ -115,6 +115,7 @@ ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --targ ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/systemd.service" + ynh_add_systemd_config #================================================= @@ -138,7 +139,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Serving on" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 306f0a9..96d9de7 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -29,14 +29,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Remove a service from the admin panel, added by `yunohost service add` if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_print_info --message="Removing $app service..." + ynh_script_progression --message="Removing $app service..." yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info --message="Stopping and removing the systemd service..." +ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config @@ -44,14 +44,14 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info --message="Removing dependencies..." +ynh_script_progression --message="Removing dependencies..." ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory..." +ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file=$final_path @@ -59,7 +59,7 @@ ynh_secure_remove --file=$final_path #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing NGINX web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config @@ -69,7 +69,7 @@ ynh_remove_nginx_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info --message="Removing the dedicated system user..." +ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app @@ -78,4 +78,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_print_info --message="Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 9339769..4817d3f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -34,7 +34,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info --message="Validating restoration parameters..." --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -52,14 +52,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info --message="Restoring the app main directory..." --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info --message="Recreating the dedicated system user..." --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 @@ -76,15 +76,15 @@ chown -R $app:$app $final_path #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Reinstalling dependencies..." --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info --message="Restoring the systemd configuration..." --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 @@ -99,16 +99,16 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Serving on" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading NGINX web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -116,4 +116,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Restoration completed for $app" --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 3c57dd0..b7c38b3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -30,7 +30,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If final_path doesn't exist, create it if [ -z "$final_path" ]; then @@ -48,7 +48,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before upgrading (may take a while)..." --weight=1 +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 @@ -65,14 +65,14 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping a systemd service..." --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=stop #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Making sure dedicated system user exists..." --weight=1 +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 @@ -83,7 +83,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_print_info --message="Upgrading source files..." + ynh_script_progression --message="Upgrading source files..." pushd $final_path ynh_use_nodejs @@ -94,7 +94,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -102,14 +102,14 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info --message="Upgrading dependencies..." --weight=1 +ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Upgrading systemd configuration..." --weight=1 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_add_systemd_config @@ -132,14 +132,14 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Serving on" #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -147,4 +147,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Upgrade of $app completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last From 94a97ec9916f814c6c3fbd275f693a0b5769d18e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 21:25:29 +0100 Subject: [PATCH 61/71] Update upgrade --- scripts/upgrade | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index b7c38b3..5c9f248 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,8 @@ 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) port=$(ynh_app_setting_get --app=$app --key=port) +admin=$(ynh_app_setting_get --app=$app --key=admin) +password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # CHECK VERSION @@ -111,6 +113,11 @@ ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/systemd.service" + ynh_add_systemd_config #================================================= From 4da16e7c6b870a316af176dd28811d28ace5615a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 21:28:31 +0100 Subject: [PATCH 62/71] Fix --- scripts/install | 4 +--- scripts/upgrade | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index e7ac8d1..3d6d105 100755 --- a/scripts/install +++ b/scripts/install @@ -113,10 +113,8 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/systemd.service" -ynh_add_systemd_config +ynh_add_systemd_config --others_var=$admin $password #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 5c9f248..8a16697 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -115,10 +115,8 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/systemd.service" -ynh_add_systemd_config +ynh_add_systemd_config --others_var=$admin $password #================================================= # GENERIC FINALIZATION From 34d4be55053617eeafe9f66c59a086e42830ba2f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 21:45:48 +0100 Subject: [PATCH 63/71] fix --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 3d6d105..610bf60 100755 --- a/scripts/install +++ b/scripts/install @@ -114,7 +114,7 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" -ynh_add_systemd_config --others_var=$admin $password +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 8a16697..728b6d7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,7 +116,7 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" -ynh_add_systemd_config --others_var=$admin $password +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION From 3294b3a7990b4582793334768d0c06b4e9a5ef4c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 22:00:33 +0100 Subject: [PATCH 64/71] Fix --- conf/systemd.service | 2 ++ scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 61a84f6..cdbf918 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -10,6 +10,8 @@ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production ExecStart=__YNH_NODE__ tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ +StandardOutput=append:/var/log/__APP__/__APP__.log +StandardError=inherit Restart=always [Install] diff --git a/scripts/install b/scripts/install index 610bf60..41a3447 100755 --- a/scripts/install +++ b/scripts/install @@ -137,7 +137,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" --line_match="Serving on" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 4817d3f..2378559 100755 --- a/scripts/restore +++ b/scripts/restore @@ -101,7 +101,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" --line_match="Serving on" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 728b6d7..0acb274 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -139,7 +139,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" --line_match="Serving on" #================================================= # RELOAD NGINX From 4872baaf79048914b6d10ce9ba315fe58cf66801 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 22:01:23 +0100 Subject: [PATCH 65/71] Fix --- check_process | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index d09dc91..de81d99 100644 --- a/check_process +++ b/check_process @@ -16,7 +16,7 @@ setup_public=1 upgrade=1 backup_restore=1 - multi_instance=1 + multi_instance=0 change_url=1 ;;; Options Email= diff --git a/manifest.json b/manifest.json index 67688b2..fe1f224 100644 --- a/manifest.json +++ b/manifest.json @@ -16,7 +16,7 @@ "requirements": { "yunohost": ">= 4.1.7" }, - "multi_instance": true, + "multi_instance": false, "services": [ "nginx" ], From d282681e92f364e1fb54db94e865151a0502f1da Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 22:22:01 +0100 Subject: [PATCH 66/71] Fix --- conf/systemd.service | 2 -- scripts/upgrade | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index cdbf918..61a84f6 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -10,8 +10,6 @@ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production ExecStart=__YNH_NODE__ tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ -StandardOutput=append:/var/log/__APP__/__APP__.log -StandardError=inherit Restart=always [Install] diff --git a/scripts/upgrade b/scripts/upgrade index 0acb274..641a225 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -139,7 +139,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" #--line_match="Serving on" #================================================= # RELOAD NGINX From 28ee3e747144fabccd23d0d25edcf7b9bcf0af6a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 22:34:18 +0100 Subject: [PATCH 67/71] fix --- check_process | 6 +++--- conf/systemd.service | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/check_process b/check_process index de81d99..d716fdb 100644 --- a/check_process +++ b/check_process @@ -5,8 +5,8 @@ path="/" (PATH) admin="john" (USER) is_public=1 (PUBLIC|public=1|private=0) - password="pass" - port="666" (PORT) + password="password" + port="8095" (PORT) ; Checks pkg_linter=1 setup_sub_dir=0 @@ -24,4 +24,4 @@ Notification=none ;;; Upgrade options ; commit=CommitHash name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&password=pass&port=666& + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&password=password&port=8095& diff --git a/conf/systemd.service b/conf/systemd.service index 61a84f6..7aa5475 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=__YNH_NODE__ tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ +ExecStart=tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ Restart=always [Install] From 6f29871f1ee6d57d7cd138f0c897d28fc34bde8f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 22:41:34 +0100 Subject: [PATCH 68/71] Update systemd.service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 7aa5475..61a84f6 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ +ExecStart=__YNH_NODE__ tiddlywiki mynewwiki --listen port=__PORT__ username=__ADMIN__ password=__PASSWORD__ Restart=always [Install] From c3884b8add7f82efb18c44b583e75020fa3efc91 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 23:10:43 +0100 Subject: [PATCH 69/71] Fix --- scripts/install | 7 +++++-- scripts/upgrade | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 41a3447..1abd3db 100755 --- a/scripts/install +++ b/scripts/install @@ -111,8 +111,11 @@ pushd $final_path #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service ynh_add_systemd_config diff --git a/scripts/upgrade b/scripts/upgrade index 641a225..c6df9bd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -113,8 +113,11 @@ ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__YNH_NODE__" --replace_string="$ynh_node" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service ynh_add_systemd_config From 7343b7a6a59531a3bd55029236a759b96f35334e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 23:16:43 +0100 Subject: [PATCH 70/71] Fix --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 1abd3db..43a5f34 100755 --- a/scripts/install +++ b/scripts/install @@ -140,7 +140,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Serving on" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 2378559..7302e83 100755 --- a/scripts/restore +++ b/scripts/restore @@ -101,7 +101,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" --line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Serving on" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index c6df9bd..77b5bb8 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -142,7 +142,7 @@ yunohost service add $app --description="A non-linear personal web notebook" --l #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" #--line_match="Serving on" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Serving on" #================================================= # RELOAD NGINX From ea5b694403b430ad829015ae27d10975e33c4478 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 27 Mar 2021 23:33:42 +0100 Subject: [PATCH 71/71] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index fe1f224..de1b6ce 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A non-linear personal web notebook", "fr": "Un carnet Web personnel non linéaire" }, - "version": "5.1.23~ynh1", + "version": "5.1.23~ynh2", "url": "https://tiddlywiki.com/", "license": "BSD-2-Clause", "maintainer": {