divinity666 / ruby-grafana-reporter

Reporting Service for Grafana
MIT License
66 stars 5 forks source link

Add systemd service file #50

Open bolausson opened 1 month ago

bolausson commented 1 month ago

Hej,

you might want to add a systemd service file to your repo.

Something like that: /etc/systemd/system/ruby-grafana-reporter.service

[Unit]
Description=Ruby Grafana reporter
After=network-online.target multi-user.target
Wants=network-online.target
# StartLimitIntervalSec > StartLimitBurst*RestartSec
StartLimitInterval=600s
StartLimitBurst=20

[Service]
Type=simple
User=bolausson
Group=bolausson
WorkingDirectory=/home/bolausson/tools/ruby-grafana-reporter
ExecStart=/home/bolausson/.local/share/gem/ruby/3.0.0/bin/ruby-grafana-reporter --config /home/bolausson/tools/ruby-grafana-reporter/grafana_reporter.config
KillMode=control-group
Restart=always
RestartSec=20s
SyslogIdentifier=ruby-grafana-reporter
MemoryMax=100M

[Install]
WantedBy=multi-user.target
divinity666 commented 4 weeks ago

How can I add such a file to a gem? I guess, I would need some kind of an installer for including something like that, right?

If not, please give me a hint, on how this could be done. Looks interesting!

bolausson commented 4 weeks ago

I have no clue about ruby and gem. I would simply add it to your GitHub repo. If people need it, they can grab it from your repo and put it in place.

If you want to include in a gem - maybe this helps: https://stackoverflow.com/questions/10625267/approach-for-installing-system-service-implemented-as-ruby-gem