From f8f7609c6e8e22ef71a94168e476bdd50f8b2408 Mon Sep 17 00:00:00 2001 From: Yalh Date: Mon, 28 Jan 2019 23:37:13 +0100 Subject: [PATCH] fix Services --- conf/nginx.conf | 3 +++ conf/systemd.service | 2 +- scripts/install | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b6df1b0..6fd7dbf 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,6 +8,9 @@ location __PATH__/ { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + proxy_pass http://127.0.0.1:__PORT__/; + proxy_set_header Host $host; + proxy_buffering off; ### Example PHP configuration (remove it if not used) index index.php; diff --git a/conf/systemd.service b/conf/systemd.service index f03b4d5..5d0a555 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ Environment="PATH=__ENV_PATH__" WorkingDirectory=__FINALPATH__/ -ExecStart=/bin/bash -c 'ts-node --project __FINALPATH__/tsconfig.json __FINALPATH__/bin/server.ts >> /var/log/__APP__/__APP__.log 2>&1' +ExecStart=/bin/bash -c '__FINALPATH__/node_modules/.bin/ts-node --project __FINALPATH__/tsconfig.json __FINALPATH__/bin/server.ts >> /var/log/__APP__/__APP__.log 2>&1' [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 2c03302..1efd29d 100644 --- a/scripts/install +++ b/scripts/install @@ -244,8 +244,8 @@ ynh_add_systemd_config ### `ynh_replace_string` is used to replace a string in a file. ### (It's compatible with sed regular expressions syntax) - -#ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE" +cp ../conf/package.json "$final_path/package.json" +ynh_replace_string "__PORT__" "$port" "$final_path/package.json" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -256,7 +256,7 @@ ynh_add_systemd_config ### you can make a backup of this file before modifying it again if the admin had modified it. # Calculate and store the config file checksum into the app settings -#ynh_store_file_checksum "$final_path/CONFIG_FILE" +ynh_store_file_checksum "$final_path/package.json" #================================================= # GENERIC FINALIZATION @@ -318,3 +318,4 @@ fi #================================================= systemctl reload nginx +systemctl reload $app