Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a systemd.socket is started by the according systemd.service #12

Merged
merged 6 commits into from
Oct 25, 2023

Conversation

tuxmea
Copy link
Member

@tuxmea tuxmea commented Oct 5, 2023

No description provided.

@@ -2,4 +2,4 @@
tang::package_name:
- 'tang'

tang::service_name: 'tang.socket'
tang::service_name: 'tang.service'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check if this works?
It looks like the package only provide a multiinstance unit: https://centos.pkgs.org/8-stream/centos-appstream-x86_64/tang-7-8.el8.x86_64.rpm.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work: /usr/lib/systemd/system/tangd@.service

Copy link
Member

@jhoblitt jhoblitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to move switch from socket activation?

@tuxmea
Copy link
Member Author

tuxmea commented Oct 5, 2023

Is there a reason to move switch from socket activation?

Yes: https://www.freedesktop.org/software/systemd/man/systemd.socket.html

For each socket unit, a matching service unit must exist, describing the service to start on incoming traffic on the socket (see systemd.service(5) for more information about .service units).

@jhoblitt
Copy link
Member

jhoblitt commented Oct 5, 2023

@tuxmea Generally, when using systemd socket activation the service unit itself is disabled.

@tuxmea
Copy link
Member Author

tuxmea commented Oct 6, 2023

@tuxmea Generally, when using systemd socket activation the service unit itself is disabled.

changed back to socket.

@tuxmea tuxmea requested a review from jhoblitt October 6, 2023 07:35
Copy link
Member

@bastelfreak bastelfreak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verified that this works:

[root@rocky-8gb-fsn1-1 ~]# systemctl status tangd.socket
● tangd.socket - Tang Server socket
     Loaded: loaded (/usr/lib/systemd/system/tangd.socket; disabled; preset: disabled)
    Drop-In: /etc/systemd/system/tangd.socket.d
             └─override.conf
     Active: active (listening) since Wed 2023-10-25 16:14:27 UTC; 4min 24s ago
      Until: Wed 2023-10-25 16:14:27 UTC; 4min 24s ago
     Listen: [::]:7500 (Stream)
   Accepted: 0; Connected: 0;
      Tasks: 0 (limit: 49300)
     Memory: 8.0K
        CPU: 818us
     CGroup: /system.slice/tangd.socket

Oct 25 16:14:27 rocky-8gb-fsn1-1 systemd[1]: Listening on Tang Server socket.
[root@rocky-8gb-fsn1-1 ~]# systemctl cat tangd@.service
# /usr/lib/systemd/system/tangd@.service
[Unit]
Description=Tang Server

[Service]
StandardInput=socket
StandardOutput=socket
StandardError=journal
ExecStart=/usr/libexec/tangd /var/db/tang
User=tang
User=tang
[root@rocky-8gb-fsn1-1 ~]# systemctl cat tangd.socket
# /usr/lib/systemd/system/tangd.socket
[Unit]
Description=Tang Server socket

[Socket]
ListenStream=80
Accept=true

[Install]
WantedBy=sockets.target

# /etc/systemd/system/tangd.socket.d/override.conf
[Socket]
ListenStream=
ListenStream=7500
[root@rocky-8gb-fsn1-1 ~]# curl http://127.0.0.1:7500/adv
{"payload": "eyJrZXlzIjogW3siYWxnIjogIkVTNTEyIiwgImt0eSI6ICJFQyIsICJjcnYiOiAiUC01MjEiLCAieCI6ICJBWmZVNVNXRHUyc3I4UEdCbFZ0dGlyaS16a3h5ZnE5aS1od3RqNVBwWUhDX2ZRVThRWGxQdUhBUDlEQXM3VFBid200anFPcGFvekZqTTN1N3NDMThXMko4IiwgInkiOiAiQVhtdEtyX0JEVThERXV3N2ppTzBuZEZkMk9NX3BZZlJucV9Mb0wyOVJicWFtZ2hINkRrTFd0WkZ6Q29IX0NVbkpDMV9hMENmam41OWV0NUJrVk1wbHlNaiIsICJrZXlfb3BzIjogWyJ2ZXJpZnkiXX0sIHsiYWxnIjogIkVDTVIiLCAia3R5IjogIkVDIiwgImNydiI6ICJQLTUyMSIsICJ4IjogIkFQNDVkU0g1cUtiYXUwU3ZXRzV3aVdrTkRhc0pYUDNVSlNSanJhZUt0YnVSVDdNMHFncEN2aE1rVHdBMDRFNGh6WGdCZVAwZTdaTWlVUWlfaHJuM3Z1TjAiLCAieSI6ICJBUnF6NmI1VGtlTTZ3N3hvdEtmQW9WdmxOTExINFd3a3RYa0VMRWlzdGp3XzZfaVYzbmdBeU82UmR5blRDZnFLSk9qNHQzLS1aSHJldjNTb2lHbW1DdFJOIiwgImtleV9vcHMiOiBbImRlcml2ZUtleSJdfV19", "protected": "eyJhbGciOiJFUzUxMiIsImN0eSI6Imp3ay1zZXQranNvbiJ9", "signature": "AOth4yxhO34NIlo4xocAKuPsKhOE_WKhQToFPsU-Eg7JhsDQehYwIkJJQKqmSVRDv1kwrmhWoR9it0cfjUyrlA9mAaZgVWW1HUDyJUp6cawKw-BjektGmzneWYztfRgKNP_VO8YIeekWS3hdaKL0gXcgUWhDLCAZcjbRgm7JPhg0Z2t_"}[root@rocky-8gb-fsn1-1 ~]#

@bastelfreak bastelfreak merged commit 63e2704 into master Oct 25, 2023
4 checks passed
@bastelfreak bastelfreak deleted the systemd_socket branch October 25, 2023 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants