Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Automatically configure a proper value for opts.host #10

Open
harmw opened this issue Mar 5, 2018 · 0 comments
Open

Automatically configure a proper value for opts.host #10

harmw opened this issue Mar 5, 2018 · 0 comments

Comments

@harmw
Copy link
Contributor

harmw commented Mar 5, 2018

When deploying VAMP to your production cluster, ie. very much not out-of-band, it can get tricky to get successfully routed to VAMP. Given the vamp-gateway-agent would be needed to route services on one's containerplatform, this imposes a chicken/egg problem.

To circumvent this, the vamp-node-client could be tweaked just a tiny bit to have it check with the configured orchestration engine for which endpoint to use.

For example, something like the following:

_(http.get('http://marathon.service.consul:8080/v2/apps/vamp/tasks').then(JSON.parse)).each(function(taskdetails) {
let vampip = taskdetails.tasks[0].host;
let vampport = taskdetails.tasks[0].ports[0];
logger.log('Using VAMP at ' + vampip + ':' + vampport);
let api = new vamp.Api({host: 'http://' + vampip + ":" + vampport});

[..]

Env var VAMP_HOST is currently available to specify a specific endpoint, though this doesn't work when using dynamic (orchestrated) endpoints.

Perhaps something like this:

VAMP_HOST_AUTOCONF_DRIVER: "marathon"
VAMP_HOST_AUTOCONF_URL: "http://marathon.service.consul:8080/v2/apps/vamp/tasks"

Thoughts?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant