From 195d57e8c335d3089ef5b724b2e7a53d24bbe065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sat, 25 Mar 2017 17:51:10 -0700 Subject: [PATCH 1/3] Add a note about installing via go install With assets compiled into the binary unsee is now go installable, add this to the docs --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ff6789fc4..5a3b19883 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,14 @@ to alert data, therefore safe to be accessed by wider audience. ## Building and running +### Installing using the go command + +unsee is go installable, so the easiest way is to run: + + go install github.com/cloudflare/unsee + +The `unsee` binary will be installed into `$GOPATH/bin` directory. + ### Building from source To clone git repo and build the binary yourself run: @@ -19,7 +27,7 @@ To clone git repo and build the binary yourself run: `unsee` binary will be compiled in project directory. -### Running +## Running `unsee` is configured via environment variables or command line flags. Environment variable `ALERTMANAGER_URI` or cli flag `-alertmanager.uri` is the @@ -39,7 +47,9 @@ variables. Example: make PORT=5000 ALERTMANAGER_URI=https://alertmanager.example.com run -### Build a Docker image +## Docker + +### Building a Docker image make docker-image @@ -54,7 +64,7 @@ apply as with `make run`. Example: make PORT=5000 ALERTMANAGER_URI=https://alertmanager.example.com run-docker -### Environment variables +## Environment variables #### ALERTMANAGER_TIMEOUT From 57ae5299a31f391f66529147e8888117cacf8328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sat, 25 Mar 2017 23:17:21 -0700 Subject: [PATCH 2/3] Add make targets for handling vendor dir via manul This will install manul and run allow to run all commands needed to maintain all vendor deps --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Makefile b/Makefile index e8a96b61b..35b65d114 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,20 @@ lint: .build/deps.ok test: lint bindata_assetfs.go @go test -cover `go list ./... | grep -v /vendor/` +.build/vendor.ok: + go get github.com/kovetskiy/manul + mkdir -p .build + touch $@ + +.PHONY: vendor +vendor: .build/vendor.ok + manul -Crt + manul -Irt + +.PHONY: vendor-update +vendor-update: .build/vendor.ok + manul -Urt + #======================== asset helper targets ================================= ASSETS_DIR := $(CURDIR)/assets/static/managed From 9322b8ab0b741181e88c0e43ecf3e6f00e5b8b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sun, 26 Mar 2017 18:53:48 -0700 Subject: [PATCH 3/3] Add CONTRIBUTING.md file This file explains how to get started with unsee development --- CONTRIBUTING.md | 42 ++++++++++++++++++++++++++++++++++++++++++ Makefile | 7 ++++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..3fad14291 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Contributing to unsee + +## Getting Started + +To get started follow `Building from source` section of the `README.md` file. + +## Testing changes + +To run included tests and check code style with `golint` run: + + make test + +## Vendoring dependencies + +If you use any new dependency or remove any existing one, please run: + + make vendor + +This will install and run [manul](https://github.com/kovetskiy/manul), which +will detect all used package and add/remove git submodule pointers in the +vendor directory. + +To update all vendor package run: + + make vendor-update + +To update specific vendor package run manul manually: + + manul -Urt + +## Running + +To build and start `unsee` from local branch see `Running` section of the +`README.md` file. + +When working with assets (templates, stylesheets and javascript files) `DEBUG` +flag for make can be set, which will recompile binary assets in debug mode, +meaning that files from disk will be read instead of compiled in assets. +See [go-bindata docs](https://github.com/jteeuwen/go-bindata#debug-vs-release-builds) +for details. Example: + + make DEBUG=true run diff --git a/Makefile b/Makefile index 35b65d114..8a14a3946 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ endif git submodule update --init --recursive go get -u github.com/jteeuwen/go-bindata/... go get -u github.com/elazarl/go-bindata-assetfs/... + go get -u github.com/golang/lint/golint mkdir -p .build touch $@ @@ -35,9 +36,13 @@ bindata_assetfs.go: .build/deps.ok .build/bindata_assetfs.$(GO_BINDATA_MODE) $(A $(NAME): .build/deps.ok bindata_assetfs.go $(SOURCES) go build -ldflags "-X main.version=$(VERSION)" +.PHONY: clean +clean: + rm -fr .build $(NAME) + .PHONY: run run: $(NAME) - DEBUG=true ALERTMANAGER_URI=$(ALERTMANAGER_URI) PORT=$(PORT) ./unsee + DEBUG=true ALERTMANAGER_URI=$(ALERTMANAGER_URI) PORT=$(PORT) ./$(NAME) .PHONY: docker-image docker-image: bindata_assetfs.go