From c4863eb582b2eef98b6aa58e369b7e5663173e64 Mon Sep 17 00:00:00 2001 From: frju365 Date: Wed, 2 Oct 2019 19:59:12 +0200 Subject: [PATCH 1/3] Testing (#38) * version 3.2.0 * fix nodejs_version variable in upgrade script (#31) (#32) * correct a sile config --- scripts/install | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/install b/scripts/install index df77f99..0b7a9e5 100644 --- a/scripts/install +++ b/scripts/install @@ -125,9 +125,11 @@ chown admin: -R $install_log # Copy default configuration file mv "../conf/config.js" "$final_path/config/config.js" +ynh_replace_string "_domain = 'http://localhost:3000/'" "_domain = 'https://$domain$path_url'" "$final_path/config/config.js" # Set service port ynh_replace_string "__PORT__" "$port" "$final_path/config/config.js" ynh_replace_string "__PORTI__" "$porti" "$final_path/config/config.js" + # Tune CSP to allow for YunoHost tile #ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config.js" # Remove donate button @@ -148,6 +150,17 @@ npm install -g bower --allow-root bower install --allow-root popd +#================================================= +# INSTALL CRYPTPAD +#================================================= + +script_dir="$PWD" +pushd "$final_path" +npm install --allow-root +npm install -g bower --allow-root +bower install --allow-root +popd + #================================================= # Set some permissions #================================================= From 24c98ce447cff7d7ff0cf8f3fab191fd4577643c Mon Sep 17 00:00:00 2001 From: frju365 Date: Wed, 2 Oct 2019 20:00:08 +0200 Subject: [PATCH 2/3] Try something to see if it works better \o/ :D --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 4596ffc..d45c4ec 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment=NODE_ENV=production -ExecStart=__NODE__/node server | tee /var/log/__APP__/cryptpad.log +ExecStart=__NODE__/node server.js | tee /var/log/__APP__/cryptpad.log Restart=always [Install] From ed7ac956ff52769f320ed12db044a6445a34553a Mon Sep 17 00:00:00 2001 From: shine <4771718+shinenelson@users.noreply.github.com> Date: Thu, 3 Oct 2019 14:38:31 +0530 Subject: [PATCH 3/3] Fix install upgrade inconsistencies (#39) * [scripts][install] remove duplicate installation script * [scripts][upgrade] make server.js configuration consistent with install * [scripts][upgrade] move cryptpad installation after configuration to maintain consistency with install script * [scripts] use consistent paths for configuration --- scripts/install | 13 +------------ scripts/upgrade | 45 +++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/scripts/install b/scripts/install index 0b7a9e5..47ccb7d 100644 --- a/scripts/install +++ b/scripts/install @@ -131,7 +131,7 @@ ynh_replace_string "__PORT__" "$port" "$final_path/config/config.js" ynh_replace_string "__PORTI__" "$porti" "$final_path/config/config.js" # Tune CSP to allow for YunoHost tile -#ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config.js" +#ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config/config.js" # Remove donate button ynh_replace_string "removeDonateButton: false" "removeDonateButton: true" "$final_path/config/config.js" # Disable analytics unsolicited communications @@ -150,17 +150,6 @@ npm install -g bower --allow-root bower install --allow-root popd -#================================================= -# INSTALL CRYPTPAD -#================================================= - -script_dir="$PWD" -pushd "$final_path" -npm install --allow-root -npm install -g bower --allow-root -bower install --allow-root -popd - #================================================= # Set some permissions #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 20a1c90..6165a06 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -91,6 +91,29 @@ ynh_replace_string "__NODEJS__" "$nodejs_version" "../conf/systemd.service" ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service" ynh_add_systemd_config +#================================================= +# CONFIGURE SERVER.JS +#================================================= + +# Backup configuration file if changed +ynh_backup_if_checksum_is_different "$final_path/config.js" +ynh_backup_if_checksum_is_different "$final_path/config/config.js" + +# Copy default configuration file +mv "../conf/config.js" "$final_path/config/config.js" + +# Set service port +ynh_replace_string "__PORT__" "$port" "$final_path/config/config.js" +ynh_replace_string "__PORTI__" "$porti" "$final_path/config/config.js" +# Tune CSP to allow for YunoHost tile +ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config/config.js" +# Remove donate button +ynh_replace_string "removeDonateButton: false" "removeDonateButton: true" "$final_path/config/config.js" +# Disable analytics unsolicited communications +ynh_replace_string "__ADMIN_EMAIL_" "$admin_email" "$final_path/config/config.js" + +# Store file checksum to detected user modifications on upgrade +ynh_store_file_checksum "$final_path/config/config.js" #================================================= # INSTALL CRYPTPAD @@ -104,28 +127,6 @@ npm install -g bower exec_login_as $app cd $final_path && env PATH=$PATH bower install popd -#================================================= -# CONFIGURE SERVER.JS -#================================================= - -# Backup configuration file if changed -ynh_backup_if_checksum_is_different "$final_path/config.js" - -# Copy default configuration file -sudo mv "$final_path/config.example.js" "$final_path/config.js" - -# Set service port -ynh_replace_string "httpPort: 3000" "httpPort: $port" "$final_path/config.js" -# Tune CSP to allow for YunoHost tile -ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config.js" -# Remove donate button -ynh_replace_string "removeDonateButton: false" "removeDonateButton: true" "$final_path/config.js" -# Disable analytics unsolicited communications -ynh_replace_string "adminEmail: 'i.did.not.read.my.config@cryptpad.fr'" "adminEmail: false" "$final_path/config.js" - -# Store file checksum to detected user modifications on upgrade -ynh_store_file_checksum "$final_path/config.js" - #================================================= # SET FILES OWNERSHIP #=================================================