KillingSpark / rustysd

A service manager that is able to run "traditional" systemd services, written in rust
MIT License
495 stars 15 forks source link

socket instead of tcp port and default socket / port? #46

Closed pwFoo closed 1 year ago

pwFoo commented 3 years ago

Hi @KillingSpark , you removed rustysd socket? For local usage socket would be fine or is it overhead for rustysd to implement socket file?

And rsdctl / rustysd should have a working default socket (/run/rustysd/rustysd.sock) / port (127.0.0.1:4444)? A default port shouldn't be used by known services like proxy (3128, 8080), httpd (80,443), mysql (3306), ...

socket / tcp port should than be optional.

KillingSpark commented 3 years ago

As far as I can see (I haven't looked at rustysd in a while I have been distracting myself with a dbus library) the socket should still be opened as <notification_sockets_dir path from config>/control.socket

Is this not the case?

pwFoo commented 3 years ago

Oh, searched in /run or /var/run, but missed notifications and sockets subudirectory in current dir?

ls -lh notifications/* sockets/*
srwxr-xr-x 1 root root 0  3. Jan 14:45 notifications/control.socket
srwxr-xr-x 1 root root 0  3. Jan 14:45 notifications/oneshot.service.notifiy_socket
srwxr-xr-x 1 root root 0  3. Jan 14:45 notifications/test2.service.notifiy_socket
srwxr-xr-x 1 root root 0  3. Jan 14:45 notifications/test.service.notifiy_socket
srwxr-xr-x 1 root root 0  3. Jan 14:45 sockets/servicelog_alt_datagram
srwxr-xr-x 1 root root 0  3. Jan 14:45 sockets/servicelog_alt_sequential
srwxr-xr-x 1 root root 0  3. Jan 14:45 sockets/servicelog_alt_stream
srwxr-xr-x 1 root root 0  3. Jan 14:45 sockets/servicelog_datagram
srwxr-xr-x 1 root root 0  3. Jan 14:45 sockets/servicelog_sequential
srwxr-xr-x 1 root root 0  3. Jan 14:45 sockets/servicelog_stream

So socket works fine like that:

./target/debug/rsdctl /opt/rustysd/notifications/control.socket status

But maybe default socket should placed under /run/rustysd/rustysd.sock and rsdctl should use it as default if missing? So command without socket should use defauolt socket?

./target/debug/rsdctl status
KillingSpark commented 3 years ago

It is currently hardcoded to be in the same dir as the notification sockets. It should be relatively easy to adapt that.

You can control where the notifications dir goes in the rustysd config. If this is not set, rustysd defaults to ./notifications.

The sockets directory presumably is created because the xxxxx.socket file specifies the path as ./sockets/xxxxx.