genvid.toolbox.ConsulService

class genvid.toolbox.ConsulService(**kwargs)

Bases: genvid.toolbox.service.ServiceTool

Base class for configuring the Consul service.

NAME = 'service-consul'
SERVICE_NAME = 'consul'
get_config(name, mode, datacenter, bind, wan, bootstrap, replace_dns, servers, ec2_tag, ec2_value, **ignored)

Return a dictionary acceptable as a JSON object representing the configuration.

The default configuration could be change by overriding the result of this method.

Args:

name: The name of the node.

mode: The mode to run the service with (dev, server or client).

datacenter: The datacenter to associate with consul.

bind: The advertise lan ip address. Consul actually bind to “0.0.0.0” but we need to advertise a single address.

wan: The advertise WAN ip address. Activate the WAN translation if present.

bootstrap: For server mode only: the number of bootstrap servers to expect. Set to -1 to use the number of servers listed.

replace_dns: Run consul on port 53 and add consul to the list of nameservers (Linux only for now).

servers: The list of servers to retry on bootup.

ec2_tag: Tag on EC2 instance for servers. Must be an AWS instance.

ec2_value: Value on tag to check for servers. Must be an AWS instance.

get_service_args(configdir, datadir, mode)

Return the based arguments depending on the consul mode (dev or not).

class service.ConsulService

Implementation of genvid.toolbox.ConsulService