Skip to content

Commit

Permalink
Merge pull request #298 from SkycoinProject/develop
Browse files Browse the repository at this point in the history
Merge v0.1.0
  • Loading branch information
jdknives authored Apr 2, 2020
2 parents 10ec772 + 82397d5 commit 1611f01
Show file tree
Hide file tree
Showing 319 changed files with 18,853 additions and 94,370 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.test
*.out
.DS_Store
*.pem

.idea/

Expand All @@ -18,6 +19,7 @@ pkg/visor/apps/
pkg/visor/bar/
pkg/visor/foo/

/bin
/node
/users.db
/hypervisor
Expand Down
24 changes: 20 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,24 @@ builds:
- CGO_ENABLED=0
main: ./cmd/skywire-cli/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
- id: hypervisor
binary: hypervisor
goos:
- linux
- darwin
goarch:
- amd64
- 386
- arm64
- arm
goarm:
- 7
env:
- CGO_ENABLED=0
main: ./cmd/hypervisor/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
- id: skychat
binary: skychat
binary: apps/skychat
goos:
- linux
- darwin
Expand All @@ -53,7 +69,7 @@ builds:
main: ./cmd/apps/skychat/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
- id: skysocks
binary: skysocks
binary: apps/skysocks
goos:
- linux
- darwin
Expand All @@ -69,7 +85,7 @@ builds:
main: ./cmd/apps/skysocks/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
- id: skysocks-client
binary: skysocks-client
binary: apps/skysocks-client
goos:
- linux
- darwin
Expand All @@ -87,7 +103,7 @@ builds:
archives:
- format: tar.gz
wrap_in_directory: false
name_template: 'skywire-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
name_template: 'skywire-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ matrix:
if: type != pull_request
osx_image: xcode8

before_install:
- nvm install 10.16

install:
- go get -u github.com/FiloSottile/vendorcheck
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.22.2
Expand All @@ -24,3 +27,6 @@ script:
# - make lint TODO(evanlinjin): Temporary due to https://github.com/golangci/golangci-lint/issues/827
- make test
- make test-no-ci
- make install-deps-ui
- make lint-ui
- make build-ui
22 changes: 14 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COMMIT := $(shell git rev-list -1 HEAD)

PROJECT_BASE := github.com/SkycoinProject/skywire-mainnet
OPTS?=GO111MODULE=on
MANAGER_UI_DIR = static/skywire-manager-src
DOCKER_IMAGE?=skywire-runner # docker image to use for running skywire-visor.`golang`, `buildpack-deps:stretch-scm` is OK too
DOCKER_NETWORK?=SKYNET
DOCKER_NODE?=SKY01
Expand All @@ -29,14 +30,6 @@ ifneq (,$(findstring 64,$(GOARCH)))
TEST_OPTS_BASE:=$(TEST_OPTS_BASE) $(RACE_FLAG)
endif

# TODO: Remove after https://github.com/etcd-io/bbolt/pull/201 is closed.
DISABLE_CHECKPTR_FLAG:=-gcflags=all=-d=checkptr=0
GO_VERSION:=$(shell go version)

ifneq (,$(findstring go1.14,$(GO_VERSION)))
TEST_OPTS_BASE:=$(TEST_OPTS_BASE) $(DISABLE_CHECKPTR_FLAG)
endif

TEST_OPTS_NOCI:=-$(TEST_OPTS_BASE) -v
TEST_OPTS:=$(TEST_OPTS_BASE) -tags no_ci

Expand Down Expand Up @@ -143,6 +136,19 @@ release: ## Build `skywire-visor`, `skywire-cli`, `hypervisor` and apps without
github-release: ## Create a GitHub release
goreleaser --rm-dist

# Manager UI
install-deps-ui: ## Install the UI dependencies
cd $(MANAGER_UI_DIR) && npm ci

lint-ui: ## Lint the UI code
cd $(MANAGER_UI_DIR) && npm run lint

build-ui: ## Builds the UI
cd $(MANAGER_UI_DIR) && npm run build
mkdir -p ${PWD}/bin
${OPTS} GOBIN=${PWD}/bin go get github.com/rakyll/statik
${PWD}/bin/statik -src=$(MANAGER_UI_DIR)/dist -dest ./cmd/hypervisor -f

# Dockerized skywire-visor
docker-image: ## Build docker image `skywire-runner`
docker image build --tag=skywire-runner --rm - < skywire-runner.Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Then you can start a hypervisor with:
$ hypervisor
```

You can open up the hypervisor UI on `localhost:8080`.
You can open up the hypervisor UI on `localhost:8000`.

### Apps

Expand Down
4 changes: 2 additions & 2 deletions cmd/apps/skychat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Create 2 visor config files:
"version": "1.0",
"auto_start": true,
"port": 1,
"args": ["-addr", ":8001"]
"args": ["-addr", ":8002"]
}
]
}
Expand All @@ -49,4 +49,4 @@ $ ./skywire-visor skywire1.json
$ ./skywire-visor skywire2.json
```

Chat interface will be available on ports `8000` and `8001`.
Chat interface will be available on ports `8001` and `8002`.
2 changes: 1 addition & 1 deletion cmd/apps/skychat/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
port = routing.Port(1)
)

var addr = flag.String("addr", ":8000", "address to bind")
var addr = flag.String("addr", ":8001", "address to bind")
var r = netutil.NewRetrier(50*time.Millisecond, 5, 2)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/apps/skysocks-client/skysocks-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
"github.com/SkycoinProject/skycoin/src/util/logging"

"github.com/SkycoinProject/skywire-mainnet/internal/netutil"
"github.com/SkycoinProject/skywire-mainnet/internal/skyenv"
"github.com/SkycoinProject/skywire-mainnet/internal/skysocks"
"github.com/SkycoinProject/skywire-mainnet/pkg/app"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appnet"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/skyenv"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo"
)

Expand Down Expand Up @@ -75,7 +75,8 @@ func main() {
}()

if *serverPK == "" {
log.Fatal("Invalid server PubKey")
log.Warn("Empty server PubKey. Exiting")
return
}

pk := cipher.PubKey{}
Expand Down
2 changes: 1 addition & 1 deletion cmd/apps/skysocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ $ ./skywire-visor skywire2.json
You should be able to connect to a secondary visor via `curl`:

```sh
$ curl -v -x socks5://123456:@localhost:1080 https://api.ipify.org
$ curl -v -x socks5://123456:@localhost:9443 https://api.ipify.org
```
6 changes: 5 additions & 1 deletion cmd/hypervisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ $ hypervisor gen-config
$ hypervisor --mock
```

By default, the RESTful API is served on `:8080`.
By default, the RESTful API is served on `:8000`.

## Endpoints Documentation

Endpoints are documented in the provided [Postman](https://www.getpostman.com/) file: `hypervisor.postman_collection.json`.

## Web UI

UI is served on the same port as the API (`:8000` by default). Directory to search for the build frontend is passed in the `web_dir` field of the hypervisor's config.

### Authentication information

- When the authentication cookie is invalid, the hypervisor will return code `401`.
Expand Down
9 changes: 8 additions & 1 deletion cmd/hypervisor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import (
"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/disc"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/rakyll/statik/fs"
"github.com/spf13/cobra"

_ "github.com/SkycoinProject/skywire-mainnet/cmd/hypervisor/statik" // embedded static files
"github.com/SkycoinProject/skywire-mainnet/pkg/hypervisor"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/pathutil"
Expand Down Expand Up @@ -50,8 +52,13 @@ var rootCmd = &cobra.Command{

conf := prepareConfig(args)

assets, err := fs.New()
if err != nil {
log.Fatalf("Failed to obtain embedded static files: %v", err)
}

// Prepare hypervisor.
hv, err := hypervisor.New(conf)
hv, err := hypervisor.New(assets, conf)
if err != nil {
log.Fatalln("Failed to start hypervisor:", err)
}
Expand Down
Loading

0 comments on commit 1611f01

Please sign in to comment.