-
Notifications
You must be signed in to change notification settings - Fork 443
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
[fix #472] /etc/default/<package-name> should be shell script setting envars #473
Conversation
note : this would break current config used |
And this doesn't allow to change |
ping ? |
# if configuration files exist, source it and use JAVA_OPTS to prepend their contents to $@ | ||
[[ -f /etc/default/${{app_name}} ]] && . /etc/default/${{app_name}} | ||
# $JAVA_OPTS used in $RUN_CMD wrapper | ||
export JAVA_OPTS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this overwrite preexisting JAVA_OPTS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it depends how JAVA_OPTS is set in /etc/default/${{app_name}} (if set)
JAVA_OPTS='toto' will overwrite,
JAVA_OPTS="toto $JAVA_OPTS" wouldn't
BTW, JAVA_OPTS seams not set before /etc/default
then I force export because I know JAVA_OPTS is required in wrapper subprocess created by start-stop-daemon (for any other envars required by java process, exporting it in /etc/default/ would be mandatory); if not, JAVA_OPTS would be limited to init.d script process only and not propagated to subprocess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable. So the user has to make sure that preexisting JAVA_OPTS
are taken into account.
Sorry for letting you wait. I won't have time until next week to test this. |
What has the |
It works fine except that old /etc/default isn't valid. We should mention this in our docs before releasing this. |
Nice. So we need updated docs. Can you update these @dhardy92 ? |
352ccb3
to
3659743
Compare
[fix #472] /etc/default/<package-name> should be shell script setting envars
Thanks @dhardy92 for your work :) |
The problem with docker is that it doesn't use an init script, and I guess that would also be causing the same problem for windows or any other system not using init.d. |
Okay. I think I got the point of this or and your request. Sorry for taking me that long :(
|
Thank you so much! I really welcomed this change when I saw it in the changelog. |
I'm still curious about your use-case? Do you provide your own exec script? I'm not sure if relying on the start template exporting |
My use case is that I'm using https://github.com/gilt/sbt-newrelic and I don't want to pack the API key in the package I'm making. The problem is that the only way I can specify the key to the agent, except that writing a whole new config file, is to provide an environment variable. |
I need to use an environment variable, not a Java property. |
Exactly this is You can use export JAVA_OPTS=-Dnewrelic.api.key=123abc
./bin/your-app |
I'm using the server archetype so I'm counting on init.d to launch the application so I can't add environment variables from the shell. bashScriptExtraDefines <++= (bashScriptConfigLocation in Universal) map { _.map { config =>
val envConfig = config + "_env"
"[[ -f '" + envConfig +"' ]] && source " + envConfig
}.toSeq /etc/default/my_app_env export NEW_RELIC_LICENSE_KEY=123abc |
This is great! First thing, this small piece of SBT code would be the way this additional feature should be integrated. I wasn't really happy about breaking the old configuration format as it provides a more convenient way to specify Java and application arguments. However sourcing a configuration file that is not included in the package before configure/running the app is a good thing to have. Implementation SuggestionI would favor a new setting like In the app archetype this would look like bashScriptExtraDefines <++= (bashScriptEnvConfigLocation in Universal) map { _.map { config =>
"[[ -f '" + config +"' ]] && source " + config
}.toSeq WDYT? |
Actually this file is suppose to be /etc/default/ in debian ( or /etc/sysconfig/ in rpm ) in standard way and this should be confusing. The current file should be renamed as "/etc//init.conf" where you can do what you want (or other proper filename) with non standard way to handle params used properly by wrappers |
+1 |
I made the PR anyway. You can modify it further as you see fit. |
PR looks good. We should swap the names of the conf files in a second pr according to @dhardy92 suggestions. @kardapoltsev do you have time for this? |
@muuki88 I have time but can't access my machine today. I could only look throw code. |
@kardapoltsev No problem ;) I gave it a bit more thought and maybe I add this change to #510 as I have to rebase it anyway. My suggestion would be
|
Simply use wildly used JAVA_OPTS envars to set exec parameters.
I don't know how to tests this :/
BTW tests passes on unversal and debian