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

Pass along Env Vars at Narrative startup, fix problematic defaults for docker config #1351

Merged
merged 4 commits into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions docker/docker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,25 @@
local M = {}
local Spore = require('Spore')
local json = require('json')
local os = require("os")
local p = require('pl.pretty')
local narrEnvVars = os.getenv("NARR_ENV_VARS")

-- Define a clientEnv variable that is passed as environment to the containers being
-- started. The granularity of this kind of sucks, but it is only a stopgap until we
-- eliminate this code from KBase.
local clientEnv
if narrEnvVars == nil then
clientEnv = json.util.null
else
clientEnv = json.decode( narrEnvVars)
ngx.log(ngx.INFO,string.format("Setting narrative container environment to: %s", narrEnvVars))
end

-- For creating new containers the config object must contain certain fields
-- Example config contains:
local function config()
local config = { Hostname = "",
User = "nobody",
Memory = 0,
MemorySwap = 0,
AttachStdin = false,
Expand All @@ -26,8 +39,7 @@ local function config()
Tty = false,
OpenStdin = false,
StdinOnce = false,
Env = json.util.null,
Cmd = {'/bin/bash'},
Env = clientEnv,
Dns = json.util.null,
Image = "base",
Volumes = {},
Expand Down
4 changes: 2 additions & 2 deletions src/config.json.templ
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
"ws_browser": "https://narrative.kbase.us/#ws"
},
"dev_mode": true,
"git_commit_hash": "4aa6e0e",
"git_commit_time": "Thu May 31 16:13:12 2018 -0700",
"git_commit_hash": "72d46bb",
"git_commit_time": "Wed Jun 13 11:19:31 2018 -0700",
"loading_gif": "/narrative/static/kbase/images/ajax-loader.gif",
"name": "KBase Narrative",
"next": {
Expand Down