From d7811bcb5032bb4e0c5bbef38dda6eb813e2eb25 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 27 Dec 2020 13:17:13 +0100 Subject: [PATCH] Fix --- conf/systemd.service | 4 ++-- scripts/install | 5 ++--- scripts/upgrade | 11 ++++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 9792eac..af77f91 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,9 +7,9 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -ExecStartPre=__NODEJS__ Environment="PATH=__ENV_PATH__" -ExecStart=__NODE__/node server.js --port __PORT__ +Environment="NODE_ENV=production" +ExecStart=__YNH_NPM__ server.js --port __PORT__ Restart=always [Install] diff --git a/scripts/install b/scripts/install index 44e6cd3..fcde6f9 100644 --- a/scripts/install +++ b/scripts/install @@ -116,9 +116,8 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string "__NODEJS__" "$nodejs_use_version" "/etc/systemd/system/$app.service" -ynh_replace_string "__ENV_PATH__" "$PATH" "/etc/systemd/system/$app.service" -ynh_replace_string "__NODE__" "$nodejs_path" "/etc/systemd/system/$app.service" +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 diff --git a/scripts/upgrade b/scripts/upgrade index 4843942..24f8e29 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,6 +47,7 @@ fi #================================================= # INSTALL NODEJS #================================================= + ynh_install_nodejs 6.2.0 #================================================= @@ -98,23 +99,23 @@ ynh_systemd_config script_dir="$PWD" pushd "$final_path" -sudo chown -R $app: $final_path -sudo_path npm install --production >> $install_log 2>&1 +chown -R $app: $final_path +npm install --production >> $install_log 2>&1 popd -sudo service redis-server start +service redis-server start #================================================= # ENABLE SERVICE IN ADMIN PANEL #================================================= # Ajoute le service au monitoring de Yunohost. -sudo yunohost service add $app --log "/var/log/$app/$app.log" +yunohost service add $app --log "/var/log/$app/$app.log" #================================================= # START OSJS IN BACKGROUND #================================================= -sudo systemctl start $app +systemctl start $app #================================================= # SETUP SSOWAT