Live data from Hacker News

Show HN: Servicer, pm2 alternative built on Rust and systemd

servicer.dev

11–20 of 41 posts

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#11

You might like systemd's run command, it's a hidden little gem that basically does what your tool does--it turns some CLI params into a transient service file: https://www.freedesktop.org/software/systemd/man/systemd-run... I dunno if this was a more recent addition to systemd, but it's pretty slick in my limited use. I use it for exactly the scenarios you mention, like quickly spinning up some local user services du…

Great tip. I would also couple it with the —-user flag so the service runs as your user. Stuff like this shouldn’t have root permissions anyway.

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#12

I don't understand this. Why not just... use systemd ? Is there something I'm missing here?

I think it's more about ease of use and developer experience. I agree that in the current state servicer is a proxy to systemd, anything you can do here you can do on systemd. Later down the line I will try to support process managers on Mac and Windows.

I'm happy see this question "Why not use systemd" finally being asked. Apparently the people on NPM (2 million weekly downloads for pm2) ~~disagree~~ don't care. `pm2 start` just works, not everybody is a system admin. There are a bunch of threads around asking for a pm2 for Rust or golang. This tool tries to address this segment.

You can be a linux veteran still benefit with some commands like `ser status` which will only show the services you created, not the wall of text shown by `systemctl list-units`. CPU and Ram usage is thrown in as a bonus so you don't need to run a separate command. It's a neat trick that uses no database. The services end with `.ser.service`, this way we only see the units that servicer created. Run `ser which` and you'll get the unit and service file destination.

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#13

> Systemd on the other hand has most of the things I need, but I found it cumbersome to use Could you please expand on this? From what I understand, to use systemd to deploy a microservice is basically one file: # /etc/systemd/system/myservice.service [Unit] Description=My Microservice After=network.target [Service] ExecStart=/path/to/myservice Restart=always User=myuser Group=mygroup Environment=VARIABLE=value Worki…

The file's pretty cumbersome, honestly, since I usually don't remember the format or the best practices for it.

Plus, sometimes there is no place to put them that isn't conflicting with the package manager, so "best practice" ends up being to make your own package containing the unit file, and ...

I'm not a big fan of "best practices" in general, but it'll turn into a whole rabbithole if you let it. At least with a piece of software like this, you just run a few commands and it remembers, and you get tons of sane defaults.

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#14

> Systemd on the other hand has most of the things I need, but I found it cumbersome to use Could you please expand on this? From what I understand, to use systemd to deploy a microservice is basically one file: # /etc/systemd/system/myservice.service [Unit] Description=My Microservice After=network.target [Service] ExecStart=/path/to/myservice Restart=always User=myuser Group=mygroup Environment=VARIABLE=value Worki…

The file's pretty cumbersome, honestly, since I usually don't remember the format or the best practices for it. Plus, sometimes there is no place to put them that isn't conflicting with the package manager, so "best practice" ends up being to make your own package containing the unit file, and ... I'm not a big fan of "best practices" in general, but it'll turn into a whole rabbithole if you let it. At least with a p…

FWIW, you can override unit files that are installed by a package manager: https://hsm.tunnel53.net/article/systemd/

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#15
post #14

Earlier quoted context omitted.

The file's pretty cumbersome, honestly, since I usually don't remember the format or the best practices for it. Plus, sometimes there is no place to put them that isn't conflicting with the package manager, so "best practice" ends up being to make your own package containing the unit file, and ... I'm not a big fan of "best practices" in general, but it'll turn into a whole rabbithole if you let it. At least with a p…

FWIW, you can override unit files that are installed by a package manager: https://hsm.tunnel53.net/article/systemd/

You can even do this with 'systemctl edit ' and it'll create a file in the right place for the override and show you the original contents for reference

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#16

> Systemd on the other hand has most of the things I need, but I found it cumbersome to use Could you please expand on this? From what I understand, to use systemd to deploy a microservice is basically one file: # /etc/systemd/system/myservice.service [Unit] Description=My Microservice After=network.target [Service] ExecStart=/path/to/myservice Restart=always User=myuser Group=mygroup Environment=VARIABLE=value Worki…

I built the tool simply to improve developer experience. Run `systemctl list-units` and the console is flooded with a wall of services, most of them are not mine. Run `ser status` and I only see the ones that I created. The activity state, CPU and memory usage is displayed so I don't need to run a separate command. hp@hp:~$ ser status +-----+-------------+----------+----------------+-------+--------+ | pid | name | a…

To do formatting on a message (multilines of code, equivalent to ``` in Markdown), indent everything with 4 spaces

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#18

You might like systemd's run command, it's a hidden little gem that basically does what your tool does--it turns some CLI params into a transient service file: https://www.freedesktop.org/software/systemd/man/systemd-run... I dunno if this was a more recent addition to systemd, but it's pretty slick in my limited use. I use it for exactly the scenarios you mention, like quickly spinning up some local user services du…

Great tip. I would also couple it with the —-user flag so the service runs as your user. Stuff like this shouldn’t have root permissions anyway.

That's a good thought. `sudo` is needed for writing to `/usr/`. The service being set up does not have root access. The value of `User=` is $SUDO_USER (hp- my regular non privileged user who initiatiated sudo) instead of $USER (root).

https://github.com/servicer-labs/servicer/blob/762801e3c07b1...

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#19

Earlier quoted context omitted.

I built the tool simply to improve developer experience. Run `systemctl list-units` and the console is flooded with a wall of services, most of them are not mine. Run `ser status` and I only see the ones that I created. The activity state, CPU and memory usage is displayed so I don't need to run a separate command. hp@hp:~$ ser status +-----+-------------+----------+----------------+-------+--------+ | pid | name | a…

To do formatting on a message (multilines of code, equivalent to ``` in Markdown), indent everything with 4 spaces

Fixed, thanks for the heads up!

Re: Show HN: Servicer, pm2 alternative built on Rust and systemd

#20

> Systemd on the other hand has most of the things I need, but I found it cumbersome to use Could you please expand on this? From what I understand, to use systemd to deploy a microservice is basically one file: # /etc/systemd/system/myservice.service [Unit] Description=My Microservice After=network.target [Service] ExecStart=/path/to/myservice Restart=always User=myuser Group=mygroup Environment=VARIABLE=value Worki…

I built the tool simply to improve developer experience. Run `systemctl list-units` and the console is flooded with a wall of services, most of them are not mine. Run `ser status` and I only see the ones that I created. The activity state, CPU and memory usage is displayed so I don't need to run a separate command. hp@hp:~$ ser status +-----+-------------+----------+----------------+-------+--------+ | pid | name | a…

> The activity state, CPU and memory usage is displayed so I don't need to run a separate command.

https://github.com/crazy-canux/awesome-monitoring

Check out Netadata + Nagios

https://news.ycombinator.com/item?id=36944388

Check out this as well

    systemctl list-units | grep my-service
Post reply on HN