Pass along Env Vars at Narrative startup, fix problematic defaults for docker config #1351
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These commits modify the Lua code to look for an environment variable called NARR_ENV_VARS which is then inserted into the default docker client config for environment variables passed to along at narrative container startup.
The value for NARR_ENV_VARS should an array of NAME=VALUE strings. For example, the following docker command will startup the nginx container and set the CONFIG_ENV variable to appdev for all narratives started by the Docker.lua module:
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -e 'NARR_ENV_VARS=["CONFIG_ENV=appdev"]' kbase/nginx:latest
This commit also fixes the default docker configs for CMD and USER so that they don't clobber the settings built into the narrative image. The old defaults set CMD to /bin/bash, which stopped the narrative from starting up, and set the running user to nobody, making it impossible to update the config.json file