conseption

command module
v0.0.0-...-8c8d51e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 16 Imported by: 0

README

conseption

consul inception

This is used to watch a prefix in a consul KV store where the values of keys represent consul api AgentServiceRegistration data. This is useful for services that are not consul-aware but need to be registered as services within consul. The way it works currently, a consul agent as well as this program would be deployed on each machine where registrations need to occur, and it would only register services to the local agent that match the hostname of where we live. This can be overridden by changing the HOSTNAME environment variable. CONSUL_HTTP_ADDR must be set to point to a consul agent, or there must be an agent at localhost, or the config must be specified in a configuration toml file. If it notices health checks registered to another agent, it will deregister first.

Multiple registrations can exist in the same Value block in the consul KV, with the following formats accepted:

Serial representations of AgentServiceRegistration

{
    "id": "cb01.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb01.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}
{
    "id": "cb02.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb02.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}

Comma separated representations of AgentServiceRegistration

{
    "id": "cb01.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb01.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb01.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
},
{
    "id": "cb02.labs.widget.co",
    "name": "couchbase",
    "tags": [
        "cache",
        "cloudstack",
        "rancid",
        "cloudythings"
    ],
    "address": "cb02.labs.widget.co",
    "port": 8091,
    "checks": [
        {
            "http": "http://cb02.labs.widget.co:8091/pools/",
            "interval": "30s"
        }
    ]
}

A list of AgentServiceRegistrations

[
    {
        "id": "cb01.labs.widget.co",
        "name": "couchbase",
        "tags": [
            "cache",
            "cloudstack",
            "rancid",
            "cloudythings"
        ],
        "address": "cb01.labs.widget.co",
        "port": 8091,
        "checks": [
            {
                "http": "http://cb01.labs.widget.co:8091/pools/",
                "interval": "30s"
            }
        ]
    },
    {
        "id": "cb02.labs.widget.co",
        "name": "couchbase",
        "tags": [
            "cache",
            "cloudstack",
            "rancid",
            "cloudythings"
        ],
        "address": "cb02.labs.widget.co",
        "port": 8091,
        "checks": [
            {
                "http": "http://cb02.labs.widget.co:8091/pools/",
                "interval": "30s"
            }
        ]
    }
]

Or a json object that has a top level Services field

{ "Services":
    [
        {
            "id": "cb01.labs.widget.co",
            "name": "couchbase",
            "tags": [
                "cache",
                "cloudstack",
                "rancid",
                "cloudythings"
            ],
            "address": "cb01.labs.widget.co",
            "port": 8091,
            "checks": [
                {
                    "http": "http://cb01.labs.widget.co:8091/pools/",
                    "interval": "30s"
                }
            ]
        },
        {
            "id": "cb02.labs.widget.co",
            "name": "couchbase",
            "tags": [
                "cache",
                "cloudstack",
                "rancid",
                "cloudythings"
            ],
            "address": "cb02.labs.widget.co",
            "port": 8091,
            "checks": [
                {
                    "http": "http://cb02.labs.widget.co:8091/pools/",
                    "interval": "30s"
                }
            ]
        }
    ]
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package putbackreader This wraps an io.Reader, giving you the option to "put back" bytes that were already read once, so that they may be read again.
Package putbackreader This wraps an io.Reader, giving you the option to "put back" bytes that were already read once, so that they may be read again.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL