3 Home
wjimenez5271 edited this page 10 years ago

Welcome to the consul wiki!

Deploying Consul

The consul agent is a self contained, statically linked binary. This makes the deployment process pretty simple as this is the only code artifact you'll need to push out to your hosts. Here are some ideas/examples to get you going!:

Deploying with system packages

If you are comfortable using system packages, you can create a consul package in the format of your choice. fpm is a package building tool that is easy to use for this purpose:

fpm --verbose -s dir -t rpm -n consul -v 0.4 --url=http://consul.io --vendor=HashiCorp  --description "A distributed service discovery tool" ./consul_/consul=/usr/local/bin/consul

Configuration

The consul agent can be configured using either command line arguments or through a config file. For large deployments with the potential for variation in how consul will be configured, the file based config is easy to tie into deployment tools like Chef, Puppet, Ansible, etc.

File Based

If you are using the ERB template engine in Chef, you can automatically generate the config:

{
  "datacenter": "<%= node['datacenter'] %>",
  "bind_addr": "<%= node['ipaddress'] %>", 
  "data_dir": "/opt/consul",
  "log_level": "INFO",
  "node_name": "<%= node['name'] %>",
  "server": true
}

Service Management

Supervisord

supervisord is a python based process control system. Just add a program entry for your consul agent:

command=/usr/local/bin/consul agent -server -config-dir=/opt/consul/config
redirect_stderr=true
stdout_logfile=/var/log/consul.log

Init Script