diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a26756c --- /dev/null +++ b/Makefile @@ -0,0 +1,90 @@ + +# +# Ecix Birdseye Makefile +# + +PROG=birdwatcher +ARCH=amd64 + +APP_VERSION=$(shell cat VERSION) +VERSION=$(APP_VERSION)_$(shell git rev-parse --short HEAD) + +BUILD_SERVER="" + +DIST=DIST/ +REMOTE_DIST=$(PROG)-$(DIST) + +RPM=$(PROG)-$(VERSION)-1.x86_64.rpm + +LOCAL_RPMS=RPMS + +# OS Detection +UNAME=$(shell uname) +ifeq ($(UNAME), Darwin) + TARGET=osx +else + TARGET=linux +endif + +all: $(TARGET) + @echo "Built $(VERSION) @ $(TARGET)" + +osx: + GOARCH=$(ARCH) GOOS=darwin go build -o $(PROG)-osx-$(ARCH) + +linux: + GOARCH=$(ARCH) GOOS=linux go build -o $(PROG)-linux-$(ARCH) + + +dist: clean linux + + mkdir -p $(DIST)opt/ecix/birdwatcher/bin + mkdir -p $(DIST)etc/init + + # Copy config and startup script + cp etc/init/* DIST/etc/init/. + + # Copy bin + cp $(PROG)-linux-$(ARCH) DIST/opt/ecix/birdwatcher/bin/. + + +rpm: dist + + # Clear tmp failed build (if any) + rm -f $(RPM) + rm -fr $(LOCAL_RPMS) + mkdir $(LOCAL_RPMS) + + # Create RPM from dist + fpm -s dir -t rpm -n $(PROG) -v $(VERSION) -C $(DIST) \ + opt/ etc/ + + mv $(RPM) $(LOCAL_RPMS) + + +remote_rpm: dist + # Copy distribution to build server + ssh $(BUILD_SERVER) -- rm -rf $(REMOTE_DIST) + scp -r $(DIST) $(BUILD_SERVER):$(REMOTE_DIST) + ssh $(BUILD_SERVER) -- fpm -s dir -t rpm -n $(PROG) -v $(VERSION) -C $(REMOTE_DIST) \ + opt/ etc/ + + # Get rpm from server + scp $(BUILD_SERVER):$(RPM) $(LOCAL_RPMS)/. + + +staging: linux + scp $(PROG)-linux-$(ARCH) snmp0.ber.ecix.net:. + + +clean: + rm -f $(PROG)-osx-$(ARCH) + rm -f $(PROG)-linux-$(ARCH) + rm -rf $(DIST) + + +build_server: +ifeq ($(BUILD_SERVER), '') + $(error BUILD_SERVER not configured) +endif + diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 diff --git a/etc/init/bird4watcher.conf b/etc/init/bird4watcher.conf new file mode 100644 index 0000000..0293fff --- /dev/null +++ b/etc/init/bird4watcher.conf @@ -0,0 +1,14 @@ + +# ECIX birdwatcher + +description "birdwatcher ipv4" +author "Matthias Hannig " + +respawn +respawn limit 20 10 + +start on starting birdwatcher +stop on stopping birdwatcher + +exec /opt/ecix/birdwatcher/bin/birdwatcher-linux-amd64 -birdc bird -port 29184 2>&1 | logger -i -t 'BIRD4 WATCHER' + diff --git a/etc/init/bird6watcher.conf b/etc/init/bird6watcher.conf new file mode 100644 index 0000000..642c095 --- /dev/null +++ b/etc/init/bird6watcher.conf @@ -0,0 +1,14 @@ + +# ECIX birdwatcher + +description "birdwatcher ipv6" +author "Matthias Hannig " + +respawn +respawn limit 20 10 + +start on starting birdwatcher +stop on stopping birdwatcher + +exec /opt/ecix/birdwatcher/bin/birdwatcher-linux-amd64 -birdc bird6 -port 29185 2>&1 | logger -i -t 'BIRD6 WATCHER' + diff --git a/etc/init/birdwatcher.conf b/etc/init/birdwatcher.conf new file mode 100644 index 0000000..43b0766 --- /dev/null +++ b/etc/init/birdwatcher.conf @@ -0,0 +1,13 @@ + +# +# Birdwatcher Startup +# + +description "birdwatcher" +author "Matthias Hannig " + + +start on runlevel [2345] +stop on runlevel [!2345] + +