tango-controls / TangoSourceDistribution

4 stars 5 forks source link

systemd unit for tango #58

Closed picca closed 2 years ago

picca commented 4 years ago

Hello, it would be nice to have systemd files for tango-db, tango-starter, and tango-accesscontrol.

t-b commented 4 years ago

@sergirubio Has some systemd unit files from the debian packages they are building.

sergirubio commented 4 years ago

Hi,

I forward the answer from Carlos Falcon (cfalcon@cells.es)

    "We use and contribute to the official debian scripts (init.d) I show in the tango doc examples of systemd scripts created by Igors"

On 11/15/19 3:16 PM, Thomas Braun wrote:

@sergirubio https://github.com/sergirubio Has some systemd unit files from the debian packages they are building.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tango-controls/TangoSourceDistribution/issues/58?email_source=notifications&email_token=AEMQVKJVNDZ64ELQ5W35JZLQT2VK7A5CNFSM4JNBW7AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEFRPRQ#issuecomment-554375110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEMQVKORU6SOOITGP66CQBLQT2VK7ANCNFSM4JNBW7AA.

bourtemb commented 4 years ago

Hi @sergirubio and @cmft , any update on this topic?

t-b commented 4 years ago

Now I'm understanding the comment of @cmft.

There is an example in https://tango-controls.readthedocs.io/en/latest/tutorials-and-howtos/how-tos/how-to-integrate-with-systemd.html?highlight=systemd with same bare bones version of systemd files.

@picca Is that a good enough starting point for you? One thing missing from these is parsing /etc/tangorc for TANGO_HOST.

mliszcz commented 4 years ago

@picca Is that a good enough starting point for you? One thing missing from these is parsing /etc/tangorc for TANGO_HOST.

Why do you want to parse the tangorc in the first place? The client does the parsing if environment variable is not set. See: https://github.com/tango-controls/cppTango/blob/81286b2eab1ec27686f9428f3efa03681f5a3164/cppapi/client/dbapi_base.cpp#L69

t-b commented 4 years ago

@mliszcz Because that is what the current init.d starting scripts in debian do. The database server needs to know at what address it should listen.

picca commented 4 years ago

I do not know a lot about systemd, but it is possible to set a bunch of environment variable before starting a process. A nice feature would be also to instrument the code in order to add the systemd notify. this way we will have a more reliable service.

another solution would be to use a wrapper in order to start the process.

Maybe it is now enought to se the right /etc/tangorc and let the Databse Device use this information to start on the right interface and port.

after, I do not know if we should be able to start multiple database server on the same host but listening on different interfaces.

https://www.freedesktop.org/software/systemd/man/sd_notify.html

t-b commented 3 years ago

https://tango-controls.readthedocs.io/en/latest/tutorials-and-howtos/how-tos/how-to-try-tango/tango-db-service.html has an example using EnvironmentFile=, see also https://www.freedesktop.org/software/systemd/man/systemd.exec.html#EnvironmentFile=. This directive is able to read our /etc/tangorc.