jhuckaby / performa

A multi-server monitoring system with a web based UI.
Other
431 stars 22 forks source link

[Linux] Automatically Start on Startup #27

Closed Ruok2bu closed 1 month ago

Ruok2bu commented 2 months ago

I dont want to fork the project so i'm just submitting my suggestion here.

In: /lib/systemd/system

Create File: performa.service.

In that file add:

[Unit] Description=Performa After=syslog.target network.target remote-fs.target nss-lookup.target

[Service] Type=forking ExecStart=/opt/performa/bin/control.sh start ExecReload=/opt/performa/bin/control.sh restart ExecStop=/opt/performa/bin/control.sh stop PrivateTmp=true

[Install] WantedBy=multi-user.target

Then the following commands need to be run:

systemctl daemon-reload

systemctl enable performa.service

/opt/performa/bin/control.sh stop

service performa start

*I added in the stop command in case the user ran it manually.

jhuckaby commented 2 months ago

Performa already supports this.

Docs: https://github.com/jhuckaby/performa#server-startup

Here are the instructions for making Performa automatically start on server boot (Linux only). Type these commands as root:

cd /opt/performa
npm run boot
Ruok2bu commented 2 months ago

ah oops, my mistake

Ruok2bu commented 1 month ago

Not sure whats happening, but your cd /opt/performa and npm run boot don't work anymore. When server reboots, performa doesnt automatically start.

The performa startup script in /etc/init.d/performa does exist but its not working.

Looking in the service log, i see: control.sh[661]: /opt/performa/bin/control.sh: 67: node: not found

And looking at some other issues posted by others, its not finding nodejs even though its installed. I installed nodejs with nvm. Is there a preferred method for installation of nodejs for performa? If so, what is it?

Ruok2bu commented 1 month ago

I managed to fix it myself. Both the nvm and fnm version of nodejs install nodejs to the user's home directory. I learned about nodesource offering a PPA for up to date nodejs versions (the debian repo tends to be out of date), i installed it with instructions at https://github.com/nodesource and it fixed my problem!