Closed GregDritschler closed 4 years ago
Interesting question. I'm more interested in how to do the equivalent in dev mode since that's the direction we're trying to move the stack towards ( in this PR).
@GregDritschler one answer to this would be to change appsody build
so that we're NOT pulling in server.env. This is suggested by the updated https://openliberty.io/guides/getting-started.html guide where the Docker build:
https://github.com/OpenLiberty/guide-getting-started/blob/master/finish/Dockerfile
only copies in the WAR and the source 'config' dir.
That all said, this requires some thought about existing projects so might need to put that out for comment and roll this into a bigger change (like an 0.3 minor version bump).
It can be solved by using docker options.
appsody run --docker-options="--env-file=src/.../server.env"
This works well enough for my case.
The server.env file needs to be included in .gitignore if you don't want the credentials checked in.
Closing the issue.
FYI, @gkwan-ibm.
Summary
The java-microprofile stack runs a Liberty server. It is likely that this server will depend on external resources such as a database, a messaging provider, etc. In a Kubernetes environment it's possible to configure the Liberty server by using environment variables or volumes which are populated from secrets. However when the developer is running the stack locally the user needs some other way to configure the server.
It is possible to configure the Liberty server for
appsody test
by updating the pom to pass additional configuration files specifically for the correct maven phase and plugin goal.However this approach does not work for
appsody run
because it runs the Liberty maven plugin's run goal directly from the command line.Since this goal is run outside the build lifecycle, there is no phase to attach configuration. The only way to do it is to specify a configuration id on the command line, e.g.
The user doesn't have the ability to alter the maven command so this doesn't work.
See https://maven.apache.org/guides/mini/guide-configuring-plugins.html
I would like to know how a user of the java-microprofile stack can configure the liberty server when using
appsody run
, without hardcoding the configuration into the server.