Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62878e0

Browse files
authored
Fix Consul --retry-join failure (autopilotpattern#73)
* Never leave LOG_LEVEL unset in Compose file * single-node Consul server should not use ContainerPilot * Don't include port in --retry-join field when we rewrite CP config
1 parent a8fa551 commit 62878e0

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

bin/manager/containerpilot.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,15 @@ def load(self, envs=os.environ):
3636
cfg = cfg.replace('}{{ end }}', '}')
3737
config = json.loads(cfg)
3838

39-
consul = env('CONSUL', 'consul', envs, fn='{}:8500'.format)
40-
4139
if env('CONSUL_AGENT', False, envs, to_flag):
4240
config['consul'] = 'localhost:8500'
4341
cmd = config['coprocesses'][0]['command']
4442
host_cfg_idx = cmd.index('-retry-join') + 1
45-
cmd[host_cfg_idx] = consul
43+
cmd[host_cfg_idx] = env('CONSUL', 'consul', envs)
4644
config['coprocesses'][0]['command'] = cmd
4745
else:
48-
config['consul'] = consul
46+
config['consul'] = env('CONSUL', 'consul', envs,
47+
fn='{}:8500'.format)
4948
config['coprocesses'] = []
5049

5150
self.config = config

docker-compose.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@ mysql:
1212
environment:
1313
- CONTAINERPILOT=file:///etc/containerpilot.json
1414
- CONSUL_AGENT=1
15-
- LOG_LEVEL
15+
- LOG_LEVEL=INFO
1616

1717
consul:
18-
image: autopilotpattern/consul:0.7r0.7
19-
command: >-
20-
/usr/local/bin/containerpilot
21-
/bin/consul agent -server
22-
-bootstrap-expect 1
23-
-config-dir=/etc/consul
24-
-ui-dir /ui
18+
image: consul:0.7.1
19+
command: >
20+
agent -server -client=0.0.0.0 -bootstrap -ui
2521
restart: always
2622
mem_limit: 128m
2723
ports:

0 commit comments

Comments
 (0)