Skip to content

Commit

Permalink
Merge pull request #1351 from kbase/dockerize
Browse files Browse the repository at this point in the history
Pass along Env Vars at Narrative startup, fix problematic defaults for docker config
  • Loading branch information
briehl committed Jun 28, 2018
2 parents 7765c6c + 2564b33 commit 38bc1a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
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

0 comments on commit 38bc1a1

Please sign in to comment.