https://github.com/qubistlabs/consul
https://github.com/qubistlabs/consul
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/qubistlabs/consul
- Owner: qubistlabs
- Created: 2019-10-02T15:07:35.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-27T22:22:55.000Z (over 5 years ago)
- Last Synced: 2025-08-04T15:33:50.045Z (3 months ago)
- Language: Dockerfile
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```