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

systemd service customization (open files) #728

Closed
francisdb opened this issue Jan 18, 2016 · 3 comments
Closed

systemd service customization (open files) #728

francisdb opened this issue Jan 18, 2016 · 3 comments

Comments

@francisdb
Copy link
Contributor

Would be nice to have a way to customise the systemd service file the same way as we can do with the bat/bash files. More specifically we would need to add the open files limit option:

http://www.freedesktop.org/software/systemd/man/systemd.exec.html

Eg:
When using systemd you might need to set LimitNOFILE=10500 in the service file.
Manual way to do this:

sudo pico /usr/lib/systemd/system/myapp.service
# in the service section add:
# LimitNOFILE=10500
sudo systemctl daemon-reload
sudo systemctl restart myapp.service

For the bash file this can be done like this (when not using systemd)

bashScriptExtraDefines += """ulimit -n 10500"""

Might even be interesting to have a unified way to set up open file limits...

In case you want to see the applied limits to your service

cat /proc/$(cat /var/run/myapp/play.pid)/limits
@francisdb francisdb changed the title systemd customization systemd service customization Jan 18, 2016
@muuki88
Copy link
Contributor

muuki88 commented Jan 19, 2016

At the moment you have the following options

Override the complete script

This is documented here. You have to configure everything your self.

We should add that to the archetype cheatsheet

Hack it into predefined settings

There are currently four settings

  • startRunlevels
  • stopRunlevels
  • requiredStartFacilities
  • requiredStopFacilities

which are essentially strings. You could add your settings in there, but this is rather bad.

Solution

I like the idea of a generic data structure where you can append things which will be added to the start script. Most of the heavy lifting is done in JavaServerBashScript, which reads the templates and substitutes the placeholders.

However the system-loaders are so different, it's hard to provide a generic setting that fits for all. For SystemD and Upstart the scripts are actually that simple, you can copy n paste them and mark your adjustments there.

@francisdb if you have a good idea how to make things work for all systemloaders in an easy way?

@francisdb
Copy link
Contributor Author

Overriding the script is always a solution but not preferable as you might forget to update your copy when the source is updated (bug fixes, refactorings, ...)

Even appending might not fit all as some systems. I fear it will be quite hard to come up with a solution for all loaders/supported packagings.

I guess this will have to be a case-by-case solution or the override solution

@francisdb francisdb changed the title systemd service customization systemd service customization (open files) Mar 24, 2016
@muuki88
Copy link
Contributor

muuki88 commented Nov 1, 2017

Now that Systemloaders are separate AutoPlugins (SystemdPlugin we can tackle this issue. There is another issue were some ideas have been discussed. Closing this in favor of #937

@muuki88 muuki88 closed this as completed Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants