Skip to content

Commit

Permalink
Fix Makefile copy command. Add docker support - run a depcon docker i…
Browse files Browse the repository at this point in the history
…mage
  • Loading branch information
gondor committed Mar 28, 2016
1 parent 34a55bb commit 8fa9f0c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 0.8.1
VERSION = 0.8.2

GO_FMT = gofmt -s -w -l .
GO_XC = goxc -os="linux darwin windows" -tasks-="rmbin"
Expand All @@ -20,7 +20,7 @@ goxc:
$(shell echo ' "include": "*.zip,*.tar.gz,*.deb,depcon_$(VERSION)_linux_amd64-bin"' >> $(GOXC_FILE))
$(shell echo ' }\n } \n}' >> $(GOXC_FILE))
$(GO_XC)
cp build/$(VERSION)/linux_amd64/depcon build/$(VERSION)/depcon_0.8.1_linux_amd64-bin
cp build/$(VERSION)/linux_amd64/depcon build/$(VERSION)/depcon_$(VERSION)_linux_amd64-bin

deps:
go get
Expand All @@ -33,3 +33,12 @@ bintray:

github:
$(GO_XC) publish-github

docker-build:
cp build/$(VERSION)/linux_amd64/depcon docker-release/depcon
docker build -t pacesys/depcon docker-release/
docker tag pacesys/depcon pacesys/depcon:$(VERSION)

docker-push:
docker push pacesys/depcon
docker push pacesys/depcon:$(VERSION)
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ To update Depcon's dependencies, use `go get` with the `-u` option.

go get -u -v github.com/gondor/depcon

### Running Depcon in Docker

With each release we publish a very small docker image containing depcon. For instructions in testing depcon within docker (useful for CI systems) see the docker hub repository at: https://hub.docker.com/r/pacesys/depcon/


## Global options in Depcon

#### Output Options
Expand Down
11 changes: 8 additions & 3 deletions cliconfig/create_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/gondor/depcon/utils"
"net/url"
"regexp"
"os"
)

const (
Expand Down Expand Up @@ -50,7 +51,11 @@ func getPasswordWithVerify() string {
}

// Asks the user for the remote URI of the Marathon service
func getMarathonURL() string {
func getMarathonURL(count int) string {
if count > 5 {
fmt.Printf("Too many retries obtaining Marathon URL. If depcon is running within docker please insure 'docker run -it' is set.\n")
os.Exit(1)
}
var response string
fmt.Print("Marathon URL (eg. http://hostname:8080) : ")
fmt.Scanf("%s", &response)
Expand All @@ -61,13 +66,13 @@ func getMarathonURL() string {
}

fmt.Printf("\nERROR: '%s' must be a valid URL\n", response)
return getMarathonURL()
return getMarathonURL(count+1)
}

func createEnvironment() *ServiceConfig {
service := ServiceConfig{}
service.Name = getAlpaNumDash("Environment Name (eg. test, stage, prod) ")
service.HostUrl = getMarathonURL()
service.HostUrl = getMarathonURL(0)

if getBoolAnswer("Authentication Required", false) {
service.Username = getAlpaNumDash("Username")
Expand Down
1 change: 1 addition & 0 deletions docker-release/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
depcon
10 changes: 10 additions & 0 deletions docker-release/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine

ADD depcon /usr/bin

ENV DEPCON_MODE="" \
MARATHON_HOST="http://localhost:8080" \
MARATHON_USER="" \
MARATHON_PASS=""

ENTRYPOINT ["/usr/bin/depcon"]
6 changes: 6 additions & 0 deletions docker-release/env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DEPCON_MODE=marathon
MARATHON_HOST=http://hostname:8080

# Uncomment below if authentication is enabled within Marathon
#MARATHON_USER=someuser
#MARATHON_PASS=somepass

0 comments on commit 8fa9f0c

Please sign in to comment.