Skip to content

Commit

Permalink
Adjusted how we handle obtaining running VM ip address. Working on da…
Browse files Browse the repository at this point in the history
…emonizing the daod process.
  • Loading branch information
Jonmichael Chambers committed Mar 12, 2015
1 parent 25e534b commit 1662035
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions bin/daod
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)

require 'dao'

Process.daemon
Dao::Base.new.run
10 changes: 9 additions & 1 deletion lib/dao.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def run

loop do
begin
ip = `docker-machine ip dao-dev`.strip # gross.
ip = get_ip_from_vm('dao-dev') || exit!
old_ports = servers.map(&:port)
mappings = Dao::PortMapper.create(ip, containers.matching)

Expand All @@ -46,5 +46,13 @@ def run
end
end
end

def get_ip_from_vm(name)
ip = `docker-machine ip #{name}`.strip

if ip =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/
ip
end
end
end
end
2 changes: 2 additions & 0 deletions scripts/dao
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ case "$1" in
docker-machine ssh dao-dev sudo "sed -r \"s/EXTRA_ARGS='(.*?)'/EXTRA_ARGS='\1 --bip 10.100.200.1\/24'/\" /var/lib/boot2docker/profile > tmp && sudo mv tmp /var/lib/boot2docker/profile"
docker-machine stop dao-dev
docker-machine start dao-dev
pgrep -f 'daod' || daod
;;

start)
docker-machine start dao-dev
pgrep -f 'daod' || daod
;;

stop)
Expand Down

0 comments on commit 1662035

Please sign in to comment.