Skip to content

Commit

Permalink
Small fixes to gdev
Browse files Browse the repository at this point in the history
  • Loading branch information
Onni Hakala committed Mar 1, 2016
1 parent 4715e7e commit cd18bf8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
17 changes: 11 additions & 6 deletions bin/gdev
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ HEREDOC

PROXY_UNMODIFIED_TO_COMPOSE=%w{build kill logs ps pull restart rm start stop}
PROXY_MODIFIED=%w{up run}
OTHER_COMMANDS=%w{machine update service}
OTHER_COMMANDS=%w{machine update service status}

def initialize(args)
if PROXY_UNMODIFIED_TO_COMPOSE.include?(args[0])
Expand All @@ -55,7 +55,7 @@ HEREDOC
end

def up(args)
dash(["up"])
service(["up"])
args.insert(1, "-d")
args.unshift("docker-compose")
system(args.join(" "))
Expand All @@ -81,14 +81,19 @@ HEREDOC
if (args[0] == "up")
args.push("-d")
end
box_ip=`dlite ip`
args.unshift("docker-compose", "-f /usr/local/gdev-env/docker/services.yml", "-p gdev")
box_ip=`dlite ip`
if $?.exitstatus != 0
abort "ERROR: dlite doesn't have ip-address..."
end
# Set system variables which we can use in our templates
system({"BOX_IP" => box_ip},args.join(" "))
end

# Support both commands service / services for syntactic sugar
def services(args)
self.service(args)
# Syntactic sugar for: $ gdev ps
# I want this to look like vagrant binary
def status(args)
system("docker-compose ps")
end

# H.T. https://gist.github.com/lpar/1032297
Expand Down
6 changes: 5 additions & 1 deletion docker/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ nginx:
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
# Mount self signed https certificates for testing
- ${HOME}/.gdev/certs:/etc/nginx/certs:ro
restart: always
dnsmasq:
image: andyshinn/dnsmasq
Expand All @@ -15,7 +18,7 @@ dnsmasq:
cap_add:
- NET_ADMIN
# TODO: can't use {BOX_IP} because the variable won't get interpolated
command: "--address=/dev/$BOX_IP"
command: "--address=/test/$BOX_IP"
restart: always
environment:
BOX_IP: "{BOX_IP}"
Expand All @@ -29,3 +32,4 @@ mail:
# Map mailhog into host machine port
# This port is used in production too
- 172.17.0.1:25:1025
restart: always

0 comments on commit cd18bf8

Please sign in to comment.