From a28c27e3c46ba308470b60a658cd29102c6826c2 Mon Sep 17 00:00:00 2001 From: Antoine Lima Date: Sun, 10 Mar 2024 22:56:08 +0100 Subject: [PATCH] Small nodejs quality of life improvements --- conf/nodejs-watcher.service | 1 + conf/nodejs.service | 1 + scripts/restore | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/conf/nodejs-watcher.service b/conf/nodejs-watcher.service index 1f2d480..7492d53 100644 --- a/conf/nodejs-watcher.service +++ b/conf/nodejs-watcher.service @@ -7,6 +7,7 @@ StartLimitBurst=5 [Service] Type=oneshot ExecStart=/usr/bin/systemctl restart __APP__-nodejs.service +Restart=on-failure [Install] WantedBy=multi-user.target diff --git a/conf/nodejs.service b/conf/nodejs.service index 2af7859..20a6b08 100644 --- a/conf/nodejs.service +++ b/conf/nodejs.service @@ -11,6 +11,7 @@ StandardOutput=append:/var/log/__APP__-nodejs.log StandardError=inherit Environment=__YNH_NODE_LOAD_PATH__ Environment=PORT=__PORT__ +Environment=NODE_ENV=production ExecStartPre=__YNH_NPM__ install ExecStartPre=__YNH_NPM__ run build ExecStart=__YNH_NPM__ run start diff --git a/scripts/restore b/scripts/restore index 401e36e..4e79a5f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -99,13 +99,18 @@ fi #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." +ynh_script_progression --message="Reloading NGINX and the server..." if [ $phpversion != "none" ] then ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload fi +if [ $nodeversion != "none" ] +then + ynh_systemd_action --service_name=$app-nodejs --action=reload +fi + ynh_systemd_action --service_name=nginx --action=reload #=================================================