diff --git a/conf/systemd.service b/conf/systemd.service index 76cdf64..35c2d16 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Small description of the service +Description=__APP__ service After=network.target [Service] @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1 +ExecStart=__NODEJS_PATH__/node __FINALPATH__/server >> /var/log/__APP__/__APP__.log 2>&1 [Install] WantedBy=multi-user.target diff --git a/scripts/backup b/scripts/backup index 23fb154..0fe1c51 100644 --- a/scripts/backup +++ b/scripts/backup @@ -68,7 +68,7 @@ ynh_backup "/etc/logrotate.d/$app" # BACKUP SYSTEMD #================================================= -#ynh_backup "/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service" #================================================= # BACKUP A CRON FILE diff --git a/scripts/install b/scripts/install index f3d7648..c58fab5 100644 --- a/scripts/install +++ b/scripts/install @@ -173,6 +173,14 @@ ynh_system_user_create $app #================================================= pushd $final_path +ynh_use_nodejs +npm install graphql@^0.13.1 +npm install acorn@^6.0.0 +npm install babel-core@>=6.0.20 +npm install eslint@>=5.0.0 +npm install +npm audit fix +npm run build popd @@ -192,7 +200,8 @@ popd ### - And the section "SETUP SYSTEMD" in the upgrade script # Create a dedicated systemd config -#ynh_add_systemd_config +ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "../conf/systemd.service" +ynh_add_systemd_config #================================================= # SETUP APPLICATION WITH CURL diff --git a/scripts/remove b/scripts/remove index cf5ae3c..c3ff164 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,7 +39,7 @@ fi #================================================= # Remove the dedicated systemd config -#ynh_remove_systemd_config +ynh_remove_systemd_config #================================================= # REMOVE THE POSTGRESQL DATABASE diff --git a/scripts/restore b/scripts/restore index 53a54bd..0d2a8f0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -98,8 +98,8 @@ ynh_install_nodejs 10 # RESTORE SYSTEMD #================================================= -#ynh_restore_file "/etc/systemd/system/$app.service" -#systemctl enable $app.service +ynh_restore_file "/etc/systemd/system/$app.service" +systemctl enable $app.service #================================================= # ADVERTISE SERVICE IN ADMIN PANEL diff --git a/scripts/upgrade b/scripts/upgrade index 3519355..ce635bf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -131,7 +131,8 @@ ynh_use_logrotate --non-append #================================================= # Create a dedicated systemd config -#ynh_add_systemd_config +ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "../conf/systemd.service" +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION