An open API service indexing awesome lists of open source software.

https://github.com/qubistlabs/consul


https://github.com/qubistlabs/consul

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# Consul server
consul server docker image

KV structure proposal
---
```
<< app_name >>/<< environment >>/<< service >>/<< key >>
```
For example

`jsearch/stage/postgres/max_client_conn`

KV put example
---
`curl -L -X PUT -d '100' localhost:8500/v1/kv/jsearch/stage/postgres/max_client_conn`

```
curl -L -X PUT -d '100' localhost:8500/v1/kv/jsearch/stage/postgres/max_client_conn
curl -L -X PUT -d 'session' localhost:8500/v1/kv/jsearch/stage/postgres/pool_mode
curl -L -X PUT -d 'db-main' localhost:8500/v1/kv/jsearch/stage/postgres/master_host
curl -L -X PUT -d 'db-slave' localhost:8500/v1/kv/jsearch/stage/postgres/slave_host
```

or using consul client

```
consul kv put jsearch/stage/postgres/max_client_conn 100
consul kv put jsearch/stage/postgres/pool_mode session
```

## Important
You should use `init: true` in docker-compose.

### Configuration

* `STACK` — stack name i.e jsearch
* `ENV` - environment i.e stage
* `CONSUL_DC` — consul datacenter to connect

To persist data use:
```
volumes:
- db-data:/var/lib/postgresql/
```

Example service configuration:
```
services:
consul-server-bootstrap:
<<: [ *consul-common ]
command: "agent -bootstrap -node=bootstrap -config-dir=/consul/config"
ports:
- "8500:8500"
consul-server-node:
<<: [ *consul-common ]
command: "agent -retry-join consul-server-bootstrap -config-dir=/consul/config"
deploy:
replicas: 2
```