Skip to content

Commit

Permalink
prepare release 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gbolo committed Dec 4, 2018
1 parent edb9591 commit ae39690
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ COPY . ${GOPATH}/src/github.com/gbolo/go-util/aws-power-toggle
RUN set -xe; \
SRC_DIR=${GOPATH}/src/github.com/gbolo/go-util/aws-power-toggle; \
cd ${SRC_DIR}; \
mkdir -p /tmp/build && \
mkdir -p /tmp/build && npm -v; \
make all && \
cd frontend; npm install && npm run build && cd ..; \
cp -rp frontend/dist /tmp/build/frontend; \
cp -rp testdata/sampleconfig/power-toggle-config.yaml bin/aws-power-toggle /tmp/build/

Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ COMMIT_SHA ?= $(shell git rev-parse --short HEAD)
PKGS = $(or $(PKG),$(shell $(GO) list ./...))
TESTPKGS = $(shell $(GO) list -f '{{ if or .TestGoFiles .XTestGoFiles }}{{ .ImportPath }}{{ end }}' $(PKGS))
BIN = $(CURDIR)/bin
FRONTEND = $(CURDIR)/frontend

GO = go
TIMEOUT = 15
Expand All @@ -14,7 +15,7 @@ Q = $(if $(filter 1,$V),,@)
M = $(shell printf "\033[34;1m▶\033[0m")

.PHONY: all
all: fmt dep $(BIN) ; $(info $(M) building executable...) @ ## Build program binary
all: fmt dep $(BIN) frontend ; $(info $(M) building executable...) @ ## Build program binary
$Q $(GO) build \
-ldflags '-X main.Version=$(VERSION) -X main.BuildDate=$(DATE) -X main.CommitSHA=$(COMMIT_SHA)' \
-o $(BIN)/$(PACKAGE)
Expand All @@ -23,6 +24,10 @@ all: fmt dep $(BIN) ; $(info $(M) building executable...) @ ## Build program bin
docker: clean ; $(info $(M) building docker image...) @ ## Build docker imaage
$Q docker build -t gbolo/$(PACKAGE):$(VERSION) .

.PHONY: frontend
frontend: ; $(info $(M) building web frontend ui...) @ ## Build frontend
$Q npm install --prefix $(FRONTEND) && npm run build --prefix $(FRONTEND)

# Tools

$(BIN):
Expand Down Expand Up @@ -52,7 +57,7 @@ test: ; $(info $(M) running go test...) @ ## Run go test

.PHONY: clean
clean: ; $(info $(M) cleaning...) @ ## Cleanup everything
@rm -rf $(BIN)
@rm -rf $(BIN) $(CURDIR)/vendor $(FRONTEND)/dist $(FRONTEND)/node_modules

.PHONY: help
help:
Expand Down
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ aws-power-toggle [![Build Status](https://travis-ci.org/gbolo/aws-power-toggle.s

web UI and API for quickly starting and stopping AWS environments

<img src="https://raw.githubusercontent.com/gbolo/aws-power-toggle/master/testdata/screenshots/v1-0-poc_mobile.png" width="432" />
<img src="https://raw.githubusercontent.com/gbolo/aws-power-toggle/master/testdata/screenshots/v3-0_mobile.png" width="432" />

## Getting Started
aws-power-toggle groups your instances by environments (via instance tag [described below](#Required-Tags)), then allows you power toggle
Expand Down Expand Up @@ -33,13 +33,20 @@ docker run -d --name "aws-power-toggle" \
-p 8080:8080 \
-e "AWS_ACCESS_KEY_ID=<your_key_id>" \
-e "AWS_SECRET_ACCESS_KEY=<your_secret_key>" \
gbolo/aws-power-toggle:2.0
gbolo/aws-power-toggle:3.0
```

Then open your browser to: [http://127.0.0.1:8080](http://127.0.0.1:8080)

## Developer Guide
ensure you have go and make installed (with `GOPATH` set) then follow these steps:

**Requirements:**
- `go` v1.8+ (with `GOPATH` set)
- `npm` v3.5+
- `make`
- `docker` (optional)

follow these steps:
```
# clone source
mkdir -p ${GOPATH}/src/github.com/gbolo/aws-power-toggle
Expand All @@ -50,25 +57,22 @@ cd ${GOPATH}/src/github.com/gbolo/aws-power-toggle
export AWS_ACCESS_KEY_ID=<your_key_id>
export AWS_SECRET_ACCESS_KEY=<your_secret_key>
# build it
# build it (builds both frontend and backend)
make all
# run it
./bin/aws-power-toggle -config testdata/sampleconfig/power-toggle-config.yaml
# do a test API call
curl -v 127.0.0.1:8080/api/env/summary
curl -v 127.0.0.1:8080/api/v1/env/summary
```

**TODO add the frontend stuff to Makefile**
```bash
cd frontend
npm install
npm run build
cd ..
./testdata/scripts/dev-start.sh
```
**Optional**

If you prefer to use `docker` for building (which I recommend), you can build the docker image with:
```
make docker
```

### API Documentation
For further details on an API endpoint (including example responses), click on the endpoint's name.
Expand Down Expand Up @@ -116,4 +120,4 @@ make all
```

if you would like to add/remove/change any of the fake inventory, then modify this file:
`testdata/mock_env_cachedTable.json`
`testdata/mock/mock_env_cachedTable.json`
Binary file added testdata/screenshots/v3-0_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ae39690

Please sign in to comment.