Skip to content

Commit

Permalink
pass private ip from the fleet unit
Browse files Browse the repository at this point in the history
  • Loading branch information
pingles committed Dec 11, 2014
1 parent 70ddfbd commit c4f1b3e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ExecStartPre=-/usr/bin/docker kill consul
ExecStartPre=-/usr/bin/docker rm consul
ExecStartPre=/usr/bin/docker pull quay.io/pingles/consul-coreos:pingles-repo

ExecStart=/bin/bash -c '/usr/bin/docker run --name consul -p 8400 -p 8500:8500 -p 8600:53/udp --rm quay.io/pingles/consul-coreos:pingles-repo %m'
ExecStart=/bin/bash -c '/usr/bin/docker run --name consul -p 8400 -p 8500:8500 -p 8600:53/udp --rm quay.io/pingles/consul-coreos:pingles-repo %m ${COREOS_PRIVATE_IPV4}'
ExecStop=/usr/bin/docker stop consul

ExecStopPost=-/bin/bash -c '/usr/bin/etcdctl rm /consul.io/bootstrap/machines/%m'
Expand Down
12 changes: 2 additions & 10 deletions start-consul-service
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/bin/bash

machine_id="$1"
echo "starting consul on machine $machine_id"
local_ip="$2"

local_addresses=($(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'))
# assume we set a LOCAL_IP env variable for us to register when running locally
local_ip="${local_addresses[0]}"
echo "using local ip: $local_ip"

if [ -n "$COREOS_PRIVATE_IPV4" ]; then
echo "coreos private ip: $COREOS_PRIVATE_IPV4"
local_ip = "$COREOS_PRIVATE_IPV4"
fi
echo "starting consul on machine $machine_id, local ip $local_ip"

docker_host_ip=$(netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}')
echo "docker host ip: $docker_host_ip"
Expand Down

0 comments on commit c4f1b3e

Please sign in to comment.