cloudcompass / stackbutton

A friendly provisioning tool for DevOps tool chains.
Apache License 2.0
5 stars 4 forks source link

Provide runtime mechanism to inject the webhooks url into stackbutton #7

Open swcurran opened 8 years ago

swcurran commented 8 years ago

The webhook URL for service notifications currently comes from the config/local.js file that is not part of the repo. As a result, auto-generating a docker image from the stackbutton github repo does not have the webhooks URL - the config/local.js is not part of the resulting docker image. On adding a service to stackbutton, a fatal error results from not having the webhooks URL, terminating the service with the following error below.

Add a mechanism that gets the webhooks URL ideally at runtime, or at least injected at server startup - perhaps by an Environment variable.

dev_1 | url: sails.config.url.hooks + "/payload/" + module.project, dev_1 | ^ dev_1 | dev_1 | TypeError: Cannot read property 'hooks' of undefined dev_1 | at /app/api/services/GithubService.js:66:32 dev_1 | at wrapper (/app/node_modules/sails/node_modules/lodash/index.js:3592:19) dev_1 | at applyInOriginalCtx (/app/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:421:80) dev_1 | at wrappedCallback (/app/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:324:18) dev_1 | at callback.success (/app/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/normalize.js:33:31) dev_1 | at _switch (/app/node_modules/sails/node_modules/waterline/node_modules/switchback/lib/factory.js:58:28) dev_1 | at returnResults (/app/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/basic.js:180:9) dev_1 | at /app/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/basic.js:86:16 dev_1 | at /app/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/operations.js:83:7 dev_1 | at /app/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:52:16 dev_1 | at Object.async.forEachOf.async.eachOf (/app/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:236:30) dev_1 | at Object.async.forEach.async.each (/app/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:209:22) dev_1 | at /app/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/operations.js:436:11 dev_1 | at /app/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/operations.js:574:5 dev_1 | at /app/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:52:16 dev_1 | at Object.async.forEachOf.async.eachOf (/app/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:236:30) sbhub_dev_1 exited with code 1

swcurran commented 8 years ago

A workaround for this is to create a simple dockerfile that references the auto-generated docker image (cloudcompass/stackbutton), and adds a local.js file into the config directory:

FROM cloudcompass/stackbutton ADD local.js config/local.js

That also allows configuring the mongo variables as well - which also needs to be injected at some point.