1.0.6 • Published 7 years ago

@eoko/docker-kong-autoregister v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

Autoregister to Kong

Simple utility to autoregister an API to Kong in a containerized environment.

It is useful ?

In fact, this little CLI utility can be mimic using a simple Curl request. The main goal of this library is to prepare the next steps :

  • Being adapter based (not only dedicated to an API exposed through Kong)
  • Replace containerpilot with a full JS implementation
  • Being tight coupled with pm2

Usage

This utility works well with containerpilot but can be used also with registrator (any other container utility dedicated to manage services inside container should be compatible).

The following commands are available :

# register config
node autoregister register

# unregister config
node autoregister unregister

# reload config
node autoregister reload

# with args
autoregister register --file /usr/src/app/service.json --kong-url http://kong:8001 --hostname node

This is a demo configuration that we can use with containerpilot :

{
  "consul": "consul:8500",
  // add prestart here!
  "services": [
    {
      "name": "organizations",
      "port": 3000,
      "health": "/usr/bin/curl -o /dev/null -s http://localhost:3000/health",
      "poll": 3,
      "ttl": 10
    }
  ],

  "backends": [
    {
      "name": "kong-8001",
      "poll": 4,
      "onChange": "node /usr/src/app/src/autoregister.js register --file /usr/src/app/service.json --kongurl 'kong-8001:8001' --hostname node"
    }
  ]
}
1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago