Skip to content

Commit

Permalink
Merge pull request #19 from bisohns/FEAT/web-dashboard
Browse files Browse the repository at this point in the history
Feat/web dashboard
  • Loading branch information
deven96 authored Jan 6, 2023
2 parents b3908b0 + 47f7483 commit 5d8f15a
Show file tree
Hide file tree
Showing 94 changed files with 42,140 additions and 355 deletions.
55 changes: 0 additions & 55 deletions .air.toml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: goreleaser
on:
push:
branches: [main]
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
if: success() && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.3'
cache: true
- run: make dependencies
- run: make build-frontend
- uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

39 changes: 34 additions & 5 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on:
push:
branches: [ main, develop ]
branches: [ main, develop,feature/test-goreleaser]
pull_request:
branches: [ main ]
branches: [ main]
name: Test-MacOs
jobs:
test:
Expand All @@ -11,11 +11,40 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: '>=1.16'
- name: Checkout code
uses: actions/checkout@v2
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ./web/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./web/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache go modules
id: cache-go-modules
uses: actions/cache@v3
env:
cache-name: cache-go-modules
with:
path: ~/go
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup config script
# using locals for mac-OS because github CI mac platforms don't have docker
run: make prep-ci-local
run: |
make prep-ci-local
make dependencies
make build-frontend
- name: Test
run: go test -v ./...
run: |
go mod tidy
go test -v ./...
43 changes: 38 additions & 5 deletions .github/workflows/test-ssh.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on:
push:
branches: [ main, develop ]
branches: [ main, develop,feature/test-goreleaser]
pull_request:
branches: [ main ]
branches: [ main]
name: Test-Linux
jobs:
test:
Expand All @@ -11,11 +11,44 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: '>=1.16'
- name: Checkout code
uses: actions/checkout@v2

- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ./web/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./web/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache go modules
id: cache-go-modules
uses: actions/cache@v3
env:
cache-name: cache-go-modules
with:
path: ~/go
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup SSH server and config
# run docker ssh container for ssh tests
run: make prep-ci-ssh
run: |
make dependencies
make build-frontend
make prep-ci-ssh
- name: Test
run: go test -v ./...
run: |
go mod tidy
go test -v ./...


39 changes: 34 additions & 5 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on:
push:
branches: [ main, develop ]
branches: [ main, develop,feature/test-goreleaser]
pull_request:
branches: [ main ]
branches: [ main]
name: Test-Windows
jobs:
test:
Expand All @@ -11,15 +11,44 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: '>=1.16'
- name: Checkout code
uses: actions/checkout@v2
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ./web/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./web/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache go modules
id: cache-go-modules
uses: actions/cache@v3
env:
cache-name: cache-go-modules
with:
path: ~/go
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Choco Install make
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install make
- name: Setup config script
# using locals for Windows because github CI Windows platforms don't have docker
run: make prep-ci-local-windows
run: |
make prep-ci-local-windows
make dependencies
make build-frontend
- name: Test
run: go test -v ./...
run: |
go mod tidy
go test -v ./...
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ ssh-key/ci/
config-ci.yaml
config-test.yaml
tmp/
cmd/build/
*-packr.go
.air.toml
41 changes: 41 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
flags:
- -tags=prod
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
#snapshot:
# name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^intergration:'
- '^assets:'
nfpms:
- maintainer: Bisohns Corp.
description: YAML based tool for monitoring metrics across multiple hosts
homepage: https://github.com/bisohns/saido
license: Apache License 2.0
formats:
- deb
- rpm
- apk
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"Uninstantiated"
]
}
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
version=fake
ifeq ($(OS),Windows_NT)
bin=main.exe
build_bin=tmp\main.exe
else
bin=main
build_bin=tmp/main
endif
# Example:
# make
# make prep-ci-ssh
Expand Down Expand Up @@ -31,3 +38,26 @@ else
upgrade:
@echo "Version not set - use syntax \`make upgrade version=0.x.x\`"
endif

dependencies:
ifeq ($(bin),main.exe)
@make prep-ci-local-windows
cd web && yarn add react-scripts@latest
else
@make prep-ci-local
endif
go get .
cd web && yarn install && cd ..

.PHONY: build-frontend
build-frontend:
cd web && export BUILD_PATH=../cmd/build && CI=false yarn build && cd ..

.PHONY: dev-backend
dev-backend:
air --build.cmd "go build -o ./tmp/$(bin) ." --build.bin "$(build_bin)" --build.exclude_dir "assets,docs,tmp,web,scripts,ssh-key,.github,.git" --build.include_ext "go,yaml,html,js" --build.exclude_file "config.example.yaml" --build.args_bin "--config,config-test.yaml,--verbose" --build.stop_on_error true --misc.clean_on_exit true --log.time true

prod-monolith:
go build -tags prod -o ./tmp/$(bin) . && $(build_bin) --config config-test.yaml -b --verbose

app: build-frontend prod-monolith
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,28 @@ For personal usage, install latest from [Github Releases](https://github.com/bis

```bash
# binary is downloaded and named as saido
saido api
saido --config config.yaml --port 3000 --verbose
```


### Development

With Golang installed, run
#### Requirements
- [Golang](https://go.dev/doc/install)
- [Docker](https://docs.docker.com/get-docker/)
- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/)
- [Air](https://github.com/cosmtrek/air)

```bash
git clone https://github.com/bisohns/saido
cd saido
## Update Golang dependencies
go get .
## Update dependencies
make dependencies

## Update yarn dependencies
cd web
yarn install
# Build and serve frontend
make app

# Run websocket server and serve frontend
go run main.go api
# Modify generated `config-test.yaml` file and air would reload server
```

## Deployment
Expand Down
Loading

0 comments on commit 5d8f15a

Please sign in to comment.