From f3582c9169cfd8f5ca8dba9826429e2455619333 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 17:54:57 +0100 Subject: [PATCH 1/9] fix service start --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 453358f..776135c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -102,7 +102,7 @@ ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env" ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/.env" ynh_replace_string "__DOMAIN_URI__" "$new_domain$new_path" "$final_path/.env" ynh_replace_string "__PORT__" "$port" "$final_path/.env" -ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Finishing add-custom-html-before-body-end migration" +ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" sleep 10 #================================================= From 10b14700d871a7ad087ad08e5a904f57960e254b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 17:59:51 +0100 Subject: [PATCH 2/9] Fix service startup --- scripts/install | 2 +- scripts/restore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index d08fd8f..771a341 100755 --- a/scripts/install +++ b/scripts/install @@ -269,7 +269,7 @@ systemctl reload nginx # START SERVICE #================================================= -ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Finishing add-custom-html-before-body-end migration" +ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" sleep 10 #================================================= diff --git a/scripts/restore b/scripts/restore index eeba563..52f8756 100644 --- a/scripts/restore +++ b/scripts/restore @@ -128,7 +128,7 @@ systemctl reload nginx # START SERVICE #================================================= -ynh_systemd_action --action=start --service_name=$app --log_path="systemd" +ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" sleep 10 #================================================= From dccac47828db059ca6e206a3dd06abc8bc68a10a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 18:05:44 +0100 Subject: [PATCH 3/9] Fix upgrade --- scripts/change_url | 5 ++++- scripts/install | 1 + scripts/restore | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 776135c..30d2896 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -20,6 +20,9 @@ old_path=$YNH_APP_OLD_PATH new_domain=$YNH_APP_NEW_DOMAIN new_path=$YNH_APP_NEW_PATH +db_name=$(ynh_app_setting_get $app db_name) +port=$(ynh_app_setting_get $app port) + app=$YNH_APP_INSTANCE_NAME #================================================= @@ -98,12 +101,12 @@ fi ynh_print_info "Updating .env configuration..." ynh_systemd_action --action=stop --service_name=$app --log_path="systemd" +ynh_use_nodejs ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env" ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/.env" ynh_replace_string "__DOMAIN_URI__" "$new_domain$new_path" "$final_path/.env" ynh_replace_string "__PORT__" "$port" "$final_path/.env" ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" -sleep 10 #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 771a341..32199e9 100755 --- a/scripts/install +++ b/scripts/install @@ -101,6 +101,7 @@ ynh_print_info "Installing dependencies..." ynh_print_info "Installing nodejs ..." ynh_install_nodejs 8.15.1 +ynh_use_nodejs ynh_print_info "Installing mongodb dependencies ..." ynh_install_app_dependencies "mongodb mongodb-server" diff --git a/scripts/restore b/scripts/restore index 52f8756..67f0303 100644 --- a/scripts/restore +++ b/scripts/restore @@ -86,6 +86,7 @@ ynh_print_info "Reinstalling dependencies..." # Define and install dependencies ynh_install_nodejs 8.15.1 +ynh_use_nodejs # Install mongodb ynh_install_app_dependencies "mongodb mongodb-server" From 60fc6d9993298514ee30d04106b226bb90155233 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 18:23:00 +0100 Subject: [PATCH 4/9] Fix path --- conf/nginx.conf | 2 +- scripts/change_url | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index d8cfae8..dd7559e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -22,7 +22,7 @@ location __PATH__ # on every applicaiton update the name of CSS and JS file is different, # so they can be cache infinitely (here: 30 days) # the root path MUST NOT be cached - if ($uri != '/wekan') + if ($uri != '/__PATH__') { expires 30d; } diff --git a/scripts/change_url b/scripts/change_url index 30d2896..f0e667b 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -80,7 +80,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config - ynh_add_nginx_config + ynh_add_nginx_config port fi # Change the domain for nginx From c23ea33bd3f8314d99187ac42daa5b79dbaebd35 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 18:30:47 +0100 Subject: [PATCH 5/9] fix nginx --- scripts/change_url | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index f0e667b..f8b9da0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -20,9 +20,6 @@ old_path=$YNH_APP_OLD_PATH new_domain=$YNH_APP_NEW_DOMAIN new_path=$YNH_APP_NEW_PATH -db_name=$(ynh_app_setting_get $app db_name) -port=$(ynh_app_setting_get $app port) - app=$YNH_APP_INSTANCE_NAME #================================================= @@ -36,6 +33,8 @@ final_path=$(ynh_app_setting_get $app final_path) # Add settings here as needed by your application #db_name=$(ynh_app_setting_get "$app" db_name) #db_pwd=$(ynh_app_setting_get $app db_pwd) +db_name=$(ynh_app_setting_get $app db_name) +port=$(ynh_app_setting_get $app port) #================================================= # CHECK THE SYNTAX OF THE PATHS @@ -80,7 +79,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config - ynh_add_nginx_config port + ynh_add_nginx_config fi # Change the domain for nginx From fd4bf2330a0a70f2f856e0959b8cc69700c9a140 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 18:35:30 +0100 Subject: [PATCH 6/9] fix nginx port --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index f8b9da0..4ac44f9 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -79,7 +79,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config - ynh_add_nginx_config + ynh_add_nginx_config port fi # Change the domain for nginx From c21f2dba105366d93eaa72673ec1e71dd4631a4e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 18:36:41 +0100 Subject: [PATCH 7/9] Fix change_url --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 4ac44f9..f8b9da0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -79,7 +79,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config - ynh_add_nginx_config port + ynh_add_nginx_config fi # Change the domain for nginx From 1944b69fd3b59e9c47cf7a26bb72d609c00d151b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 18:43:06 +0100 Subject: [PATCH 8/9] Fix Path --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index dd7559e..f89a679 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -22,7 +22,7 @@ location __PATH__ # on every applicaiton update the name of CSS and JS file is different, # so they can be cache infinitely (here: 30 days) # the root path MUST NOT be cached - if ($uri != '/__PATH__') + if ($uri != '__PATH__') { expires 30d; } From 24bccaab754c84c08540710fb5d0f995056bd722 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 18:52:06 +0100 Subject: [PATCH 9/9] Fix change url --- scripts/change_url | 6 +----- scripts/install | 1 - scripts/restore | 1 - scripts/upgrade | 3 +-- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index f8b9da0..80fa5af 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -100,11 +100,7 @@ fi ynh_print_info "Updating .env configuration..." ynh_systemd_action --action=stop --service_name=$app --log_path="systemd" -ynh_use_nodejs -ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env" -ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/.env" -ynh_replace_string "__DOMAIN_URI__" "$new_domain$new_path" "$final_path/.env" -ynh_replace_string "__PORT__" "$port" "$final_path/.env" +ynh_replace_string "$old_domain$old_path" "$new_domain$new_path" "$final_path/.env" ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" #================================================= diff --git a/scripts/install b/scripts/install index 32199e9..28e424c 100755 --- a/scripts/install +++ b/scripts/install @@ -271,7 +271,6 @@ systemctl reload nginx #================================================= ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" -sleep 10 #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 67f0303..3a728d6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -130,7 +130,6 @@ systemctl reload nginx #================================================= ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" -sleep 10 #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 067e9b3..a72141a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -162,8 +162,7 @@ systemctl reload nginx # START SERVICE #================================================= -ynh_systemd_action --action=restart --service_name=$app --log_path="systemd" -sleep 10 +ynh_systemd_action --action=restart --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" #================================================= # END OF SCRIPT