Skip to content

Commit

Permalink
Merge pull request #190 from ubclaunchpad/#140-client-rework
Browse files Browse the repository at this point in the history
Client package rework
  • Loading branch information
bobheadxi authored May 17, 2018
2 parents b49df9d + a5232e9 commit 53ab8c4
Show file tree
Hide file tree
Showing 25 changed files with 922 additions and 842 deletions.
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.PHONY: ls inertia inertia-tagged clean test test-v test-all test-integration test-integration-fast testenv testdaemon daemon bootstrap web-deps web-run web-build

TAG = `git describe --tags`
SSH_PORT = 22
VPS_VERSION = latest
Expand All @@ -9,60 +7,75 @@ RELEASE = canary
all: deps bootstrap inertia

# List all commands
.PHONY: ls
ls:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs

# Sets up all dependencies
.PHONY: deps
deps:
go get -u github.com/jteeuwen/go-bindata/...
dep ensure
make web-deps
bash test/deps.sh

# Install Inertia with release version
.PHONY: inertia
inertia:
go install -ldflags "-X main.Version=$(RELEASE)"

# Install Inertia with git tag as release version
.PHONY: inertia-tagged
inertia-tagged:
go install -ldflags "-X main.Version=$(TAG)"

# Remove Inertia binaries
.PHONY: clean
clean:
rm -f ./inertia
find . -type f -name inertia.\* -exec rm {} \;

.PHONY: lint
lint:
PATH=$(PATH):./bin bash -c './bin/gometalinter --vendor --deadline=60s ./...'

# Run unit test suite
.PHONY: test
test:
go test ./... -short -ldflags "-X main.Version=test" --cover

# Run unit test suite verbosely
.PHONY: test-v
test-v:
go test ./... -short -ldflags "-X main.Version=test" -v --cover

# Run unit and integration tests - creates fresh test VPS and test daemon beforehand
# Also attempts to run linter
.PHONY: test-all
test-all:
make lint
make testenv VPS_OS=$(VPS_OS) VPS_VERSION=$(VPS_VERSION)
make testdaemon
go clean -testcache
go test ./... -ldflags "-X main.Version=test" --cover

# Run integration tests verbosely - creates fresh test VPS and test daemon beforehand
.PHONY: test-integration
test-integration:
go clean -testcache
make testenv VPS_OS=$(VPS_OS) VPS_VERSION=$(VPS_VERSION)
make testdaemon
go test ./... -v -run 'Integration' -ldflags "-X main.Version=test" --cover

# Run integration tests verbosely without recreating test VPS
.PHONY: test-integration-fast
test-integration-fast:
go clean -testcache
make testdaemon
go test ./... -v -run 'Integration' -ldflags "-X main.Version=test" --cover

# Create test VPS
.PHONY: testenv
testenv:
docker stop testvps || true && docker rm testvps || true
docker build -f ./test/vps/Dockerfile.$(VPS_OS) \
Expand All @@ -73,6 +86,7 @@ testenv:

# Create test daemon and scp the image to the test VPS for use.
# Requires Inertia version to be "test"
.PHONY: testdaemon
testdaemon:
rm -f ./inertia-daemon-image
docker build --build-arg INERTIA_VERSION=$(TAG) \
Expand All @@ -90,24 +104,29 @@ testdaemon:

# Creates a daemon release and pushes it to Docker Hub repository.
# Requires access to the UBC Launch Pad Docker Hub.
.PHONY: daemon
daemon:
docker build --build-arg INERTIA_VERSION=$(RELEASE) \
-t ubclaunchpad/inertia:$(RELEASE) .
docker push ubclaunchpad/inertia:$(RELEASE)

# Recompiles assets. Use whenever a script in client/bootstrap is
# modified.
.PHONY: bootstrap
bootstrap:
go-bindata -o client/bootstrap.go -pkg client client/bootstrap/...

# Install Inertia Web dependencies. Use PACKAGE to install something.
.PHONY: web-deps
web-deps:
(cd ./daemon/web; npm install $(PACKAGE))

# Run local development instance of Inertia Web.
.PHONY: web-run
web-run:
(cd ./daemon/web; npm start)

# Build and minify Inertia Web.
.PHONY: web-build
web-build:
(cd ./daemon/web; npm install --production; npm run build)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

----------------

Inertia is a simple cross-platform command line application that enables effortless setup and management of continuous, automated deployment all sorts of projects on any virtual private server. It is built and maintained with :heart: by [UBC Launch Pad](https://www.ubclaunchpad.com/).
Inertia is a simple cross-platform command line application that enables quick and easy setup and management of continuous, automated deployment of a variety of project types on any virtual private server. It is used, built, and maintained with :heart: by [UBC Launch Pad](https://www.ubclaunchpad.com/).

<p align="center">
<img src="/.static/inertia-init.png" width="45%" />
Expand Down Expand Up @@ -63,13 +63,13 @@ Inertia is a simple cross-platform command line application that enables effortl

All you need to get started is a [compatible project](https://github.com/ubclaunchpad/inertia/wiki/Project-Compatibility), the Inertia CLI, and access to a virtual private server.

**MacOS** - the CLI can be installed using [Homebrew](https://brew.sh):
MacOS users can install the CLI using [Homebrew](https://brew.sh):

```bash
$> brew install ubclaunchpad/tap/inertia
```

**Windows** - the CLI can be installed using [Scoop](http://scoop.sh):
Windows users can install the CLI using [Scoop](http://scoop.sh):

```bash
$> scoop bucket add ubclaunchpad https://github.com/ubclaunchpad/scoop-bucket
Expand Down
24 changes: 23 additions & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,27 @@

[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/ubclaunchpad/inertia/client)

This package contains Inertia's clientside configuration and interface to remote Inertia daemons.
This package contains Inertia's clientside configuration and interface to remote Inertia daemons. It can be imported for use if you don't like the CLI - for example:

```go
package main

import "github.com/ubclaunchpad/inertia/client"

func main() {
// Set up Inertia
config := client.NewConfig(
"0.3.0", "inertia-deploy-test", "docker-compose",
)

// Add your remote
config.AddRemote(&client.RemoteVPS{
Name: "gcloud", // ...params
})

// Set up client, remote, and deploy your project
cli, _ := client.NewClient("gcloud", config)
cli.BootstrapRemote()
cli.Up("[email protected]:ubclaunchpad/inertia.git", "", false)
}
```
Loading

0 comments on commit 53ab8c4

Please sign in to comment.