Skip to content

Commit

Permalink
deb file build
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Krawczyk committed Dec 10, 2015
1 parent 6c356db commit 2a3a546
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 9 deletions.
13 changes: 13 additions & 0 deletions .goxc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ArtifactsDest": "dist",
"BuildConstraints": "linux darwin,!arm",
"ConfigVersion": "0.9",
"TaskSettings": {
"deb": {
"other-mapped-files": {
"/etc/marathon-consul.d/config.json": "debian/config.json",
"/etc/init/marathon-consul.conf": "debian/marathon-consul.upstart"
}
}
}
}
13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ NAME = $(shell awk -F\" '/^const Name/ { print $$2 }' main.go)
VERSION = $(shell awk -F\" '/^const Version/ { print $$2 }' main.go)
DEPS = $(shell go list -f '{{range .TestImports}}{{.}} {{end}}' ./...)
CURRENT_DIR = $(shell pwd)
SOURCEDIR = CURRENT_DIR
SOURCEDIR = $(CURRENT_DIR)
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')

all: deps build
Expand All @@ -22,16 +22,13 @@ build: deps test
@mkdir -p bin/
go build -o bin/$(NAME)

test: deps $(SOURCES)
test: deps $(SOURCES)
PATH=$(CURRENT_DIR)/bin:$(PATH) go test $(TEST) $(TESTARGS)
go vet $(TEST)

dist:
@rm -rf dist
go get github.com/laher/goxc
@rm -rf dist/
@mkdir -p dist
goxc \
-bc="linux,!arm windows,386 darwin" \
-d=dist -pv=$(VERSION)
goxc -pv=$(VERSION)

.PHONY: all deps updatedeps build test xcompile package
.PHONY: all deps updatedeps build test xcompile package dist
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ make test

Argument | Default | Description
-----------------------|-----------------------|------------------------------------------------------
config-file | | Path to a JSON file to read configuration from. **Note:** Will override options set earlier on the command line
config-file | | Path to a JSON file to read configuration from. **Note:** Will override options set earlier on the command line. See [example](debian/config.json).
consul-auth | `false` | Use Consul with authentication
consul-auth-password | | The basic authentication password
consul-auth-username | | The basic authentication username
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
marathon-consul () unreleased; urgency=low

* Initial import

-- Tomasz Janiszewski <tomasz.janiszewski@allegrogroup.com> Thu, 10 Dec 2015 09:40:43 +0100
35 changes: 35 additions & 0 deletions debian/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"Consul": {
"Auth": {
"Enabled": false,
"Username": "",
"Password": ""
},
"Port": "8500",
"SslEnabled": false,
"SslVerify": true,
"SslCert": "",
"SslCaCert": "",
"Token": ""
},
"Web": {
"Listen": ":4000"
},
"Sync": {
"Interval": 900000000000
},
"Marathon": {
"Location": "localhost:8080",
"Protocol": "http",
"Username": "",
"Password": "",
"VerifySsl": true
},
"Metrics": {
"Target": "",
"Prefix": "default",
"Interval": 30000000000,
"Addr": ""
},
"LogLevel": "info"
}
17 changes: 17 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Source: marathon-consul
Section: misc
Priority: extra
Maintainer: Allegro Group
Build-Depends: debhelper (>= 9.1.0), golang-go
Standards-Version: 3.9.4

Package: marathon-consul
Architecture: any
Description: Marathon-consul service (performs Marathon Tasks registration as Consul Services for service discovery)
Marathon-consul takes information provided by the Marathon event bus and forwards it to Consul agents. It also re-syncs all the information from Marathon to Consul on startup and repeats it with given interval.

Package: marathon-consul-dev
Architecture: all
Description: Marathon-consul service (performs Marathon Tasks registration as Consul Services for service discovery) - development package
Marathon-consul takes information provided by the Marathon event bus and forwards it to Consul agents. It also re-syncs all the information from Marathon to Consul on startup and repeats it with given interval.

3 changes: 3 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Files: *
Copyright: 2015 Allegro Group
License: Apache-2.0
10 changes: 10 additions & 0 deletions debian/marathon-consul.upstart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
description "Marathon-consul service (performs Marathon Tasks registration as Consul Services for service discovery)"

start on runlevel [2345]
stop on runlevel [!2345]

respawn

script
exec marathon-consul --config-file=/etc/marathon-consul.d/config.json
end script
46 changes: 46 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export GOPATH=$(CURDIR)::/usr/share/gocode

PKGDIR=debian/marathon-consul

%:
dh $@

clean:
dh_clean
rm -rf $(CURDIR)/bin/* $(CURDIR)/pkg/*
rm -f $(CURDIR)/goinstall.log

binary-arch: clean
dh_prep
dh_installdirs
cd $(CURDIR)/src && go install ./...

mkdir -p $(PKGDIR)/usr/bin $(CURDIR)/bin/
mkdir -p $(PKGDIR)/usr/share/gopkg/ $(CURDIR)/pkg/

BINFILES=$(wildcard $(CURDIR)/bin/*)

for x in$(BINFILES); do \
cp $$x $(PKGDIR)/usr/bin/; \
done;

PKGFILES=$(wildcard $(CURDIR)/pkg/*.a)
for x in$(PKGFILES); do \
cp $$x $(PKGDIR)/usr/share/gopkg/; \
done;

dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb

binary: binary-arch

0 comments on commit 2a3a546

Please sign in to comment.