Feature #27416
openhow to specify alternative configuration
Description
Hi,
i would like to be able to run more then one Foreman Smart Proxy on the same system, for this i need a way to specify an alternative configuration file/path.
is there a way to do this, or is the config path hard coded, which means it is currently not possible to start more then one smart proxy on the same host?
Kind Regards,
Stephan
Updated by Ewoud Kohl van Wijngaarden almost 3 years ago
- Tracker changed from Support to Feature
It looks like that currently isn't possible. The settings path has a hardcoded default (relative to the code in config, packages create a symlink for that):
https://github.com/theforeman/smart-proxy/blob/7b3508a8444c04148f6c99f426a5de5d805f99a6/lib/proxy/settings.rb#L8-L10
As you can see, it can be overridden via a parameter, but the calling code doesn't do that:
https://github.com/theforeman/smart-proxy/blob/7b3508a8444c04148f6c99f426a5de5d805f99a6/lib/smart_proxy_main.rb#L40
This would be a new feature.
The cleanest implementation would be to respect the $CONFIGURATION_DIRECTORY environment variable that systemd sets. From man 5 systemd.exec:
┌────────────────────────┬─────────────────────────────┬───────────────────────────┬──────────────────────────┐ │Directory │ Below path for system units │ Below path for user units │ Environment variable set │ ├────────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────┤ │RuntimeDirectory= │ /run/ │ $XDG_RUNTIME_DIR │ $RUNTIME_DIRECTORY │ ├────────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────┤ │StateDirectory= │ /var/lib/ │ $XDG_CONFIG_HOME │ $STATE_DIRECTORY │ ├────────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────┤ │CacheDirectory= │ /var/cache/ │ $XDG_CACHE_HOME │ $CACHE_DIRECTORY │ ├────────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────┤ │LogsDirectory= │ /var/log/ │ $XDG_CONFIG_HOME/log/ │ $LOGS_DIRECTORY │ ├────────────────────────┼─────────────────────────────┼───────────────────────────┼──────────────────────────┤ │ConfigurationDirectory= │ /etc/ │ $XDG_CONFIG_HOME │ $CONFIGURATION_DIRECTORY │ └────────────────────────┴─────────────────────────────┴───────────────────────────┴──────────────────────────┘
Then you can create multiple systemd units.
Updated by Ewoud Kohl van Wijngaarden almost 3 years ago
Note that that feature is only available in systemd 240 and EL8 ships 239.