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

JAVA_OPTS support for ash-template #738

Closed
fakraemer opened this issue Feb 8, 2016 · 4 comments
Closed

JAVA_OPTS support for ash-template #738

fakraemer opened this issue Feb 8, 2016 · 4 comments

Comments

@fakraemer
Copy link

We are using the Docker Plugin, and noticed that AshScriptPlugin using the ash-template ignores JAVA_OPTS, as opposed to the bash-template which is used by default.

We are running in a PaaS environment which currently does not allow us to pass arguments through to the docker command, and instead only allows us to set additional environment variables. Given that template, the only thing I can do atm is to modify the Docker image being used to include an additional file with the additional JVM arguments ($script_conf_file). It would be much more convenient to have support for JAVA_OPTS.

@muuki88
Copy link
Contributor

muuki88 commented Feb 8, 2016

Thanks for your feature request. What can I do to help you make a pull request for t his :)

@fakraemer
Copy link
Author

Apologies for the late reply. Unfortunately I had to abandon using Alpine Linux/Ash for now because of other issues (related to the images I'm using) encountered during the evaluation. In order to workaround the issue, I've copied src/main/resources/com/typesafe/sbt/packager/archetypes/ash-template to templates/ash-template in my module and added JAVA_OPTS.

So it would just be something like:

--- a/src/main/resources/com/typesafe/sbt/packager/archetypes/ash-template
+++ b/src/main/resources/com/typesafe/sbt/packager/archetypes/ash-template
@@ -42,6 +42,6 @@ ${{template_declares}}
 # if configuration files exist, prepend their contents to $@ so it can be processed by this runner
 [ -f "$script_conf_file" ] && set -- $(loadConfigFile "$script_conf_file") "$@"

-java -classpath $app_classpath "$@" $app_mainclass
+java -classpath $app_classpath ${JAVA_OPTS} "$@" $app_mainclass

I'm not sure if this is sufficient for the general use case though :/

@muuki88
Copy link
Contributor

muuki88 commented Feb 14, 2016

Thanks @fakraemer for sharing. I'm not familiar with ash so I can't say if just putting in the ${JAVA_OPTS} env variable is sufficient enough.

Unfortunately the original author seems to have deleted his account. @pawelkaczor did the last addition.

The bash script has this extra check

# Now we check to see if there are any java opts on the environment. These get listed first, with the script able to override them.
  if [[ "$JAVA_OPTS" != "" ]]; then
    java_opts="${JAVA_OPTS}"
  fi

# uses array access style
${java_opts[@]}

I'm not completely sure why we use array access here.

@muuki88
Copy link
Contributor

muuki88 commented Sep 7, 2016

I guess this is closed with #866

@muuki88 muuki88 closed this as completed Sep 7, 2016
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