Skip to content

Commit 7da74b2

Browse files
authored
Merge pull request #162 from NodeFactoryIo/Release-0.4.0
Release 0.4.0
2 parents 90c80aa + 5516bed commit 7da74b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2526
-437
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ jobs:
5656
version: ${{ needs.tag.outputs.tag }}
5757
path: ./CHANGELOG.md
5858

59+
- name: Sign Windows Binary
60+
uses: nodefactoryio/windows-codesign-action@master
61+
with:
62+
binaryPath: "build/windows/vedran.exe"
63+
verify: "true"
64+
keystore: ${{ secrets.WINDOWS_CODESIGN_CERT }}
65+
password: ${{ secrets.WINDOWS_CODESIGN_PASS }}
66+
appName: 'Vedran'
67+
domain: 'nodefactory.io'
68+
5969
- name: Create Release
6070
id: create_release
6171
uses: actions/create-release@v1
@@ -99,8 +109,8 @@ jobs:
99109
with:
100110
upload_url: ${{ steps.create_release.outputs.upload_url }}
101111
asset_path: ./build/linux-amd64/vedran-linux-amd64.zip
102-
asset_name: vedran-linux-amd64
103-
asset_content_type: application/x-binary
112+
asset_name: vedran-linux-amd64.zip
113+
asset_content_type: application/zip
104114

105115
- name: Upload Linux Arm
106116
id: vedran-linux-arm
@@ -110,8 +120,8 @@ jobs:
110120
with:
111121
upload_url: ${{ steps.create_release.outputs.upload_url }}
112122
asset_path: ./build/linux-arm/vedran-linux-arm.zip
113-
asset_name: vedran-linux-arm
114-
asset_content_type: application/x-binary
123+
asset_name: vedran-linux-arm.zip
124+
asset_content_type: application/zip
115125

116126
- name: Upload Windows
117127
id: vedran-windows
@@ -121,8 +131,8 @@ jobs:
121131
with:
122132
upload_url: ${{ steps.create_release.outputs.upload_url }}
123133
asset_path: ./build/windows/vedran-windows.zip
124-
asset_name: vedran-windows
125-
asset_content_type: application/x-binary
134+
asset_name: vedran-windows.zip
135+
asset_content_type: application/zip
126136

127137
- name: Upload MacOS
128138
id: vedran-macos
@@ -132,8 +142,8 @@ jobs:
132142
with:
133143
upload_url: ${{ steps.create_release.outputs.upload_url }}
134144
asset_path: ./build/darwin-amd64/vedran-darwin-amd64.zip
135-
asset_name: vedran-macos
136-
asset_content_type: application/x-binary
145+
asset_name: vedran-macos.zip
146+
asset_content_type: application/zip
137147

138148
#in case of failure
139149
- name: Rollback on failure

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=0.3.1
1+
version=0.4.0

CHANGELOG.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
# Changelog
22

33
## [unreleased]((https://github.com/NodeFactoryIo/vedran/tree/HEAD))
4+
[Full Changelog](https://github.com/NodeFactoryIo/vedran/compare/v0.4.0...HEAD)
45

5-
[Full Changelog](https://github.com/NodeFactoryIo/vedran/compare/v0.3.1...HEAD)
6+
### Added
7+
8+
### Fix
9+
10+
### Changed
11+
12+
## [v0.4.0]((https://github.com/NodeFactoryIo/vedran/tree/v0.4.0))
13+
[Full Changelog](https://github.com/NodeFactoryIo/vedran/compare/v0.3.1...v0.4.0)
14+
15+
### Added
16+
- Provide LB fee information [#\158](https://github.com/NodeFactoryIo/vedran/pull/158) ([MakMuftic](https://github.com/MakMuftic))
17+
18+
### Fix
19+
- Metrics endpoint and grafana dashboard example [#\138](https://github.com/NodeFactoryIo/vedran/pull/138) ([mpetrun5](https://github.com/mpetrun5))
20+
- Fix next payout date prometheus value [#\161](https://github.com/NodeFactoryIo/vedran/pull/161) ([mpetrun5](https://github.com/mpetrun5))
21+
22+
### Changed
623

724
## [v0.3.1]((https://github.com/NodeFactoryIo/vedran/tree/v0.3.1))
25+
[Full Changelog](https://github.com/NodeFactoryIo/vedran/compare/v0.3.0...v0.3.1)
826

927
### Added
1028

@@ -13,7 +31,6 @@
1331

1432
### Changed
1533

16-
[Full Changelog](https://github.com/NodeFactoryIo/vedran/compare/v0.3.0...HEAD)
1734
## [v0.3.0]((https://github.com/NodeFactoryIo/vedran/tree/v0.3.0))
1835

1936
[Full Changelog](https://github.com/NodeFactoryIo/vedran/compare/v0.2.0...v0.3.0)
@@ -29,6 +46,7 @@
2946
- Execute payout transactions [\#127](https://github.com/NodeFactoryIo/vedran/pull/127) ([MakMuftic](https://github.com/MakMuftic))
3047
- Sign stats request [\#143](https://github.com/NodeFactoryIo/vedran/pull/143) ([MakMuftic](https://github.com/MakMuftic))
3148
- Send all funds on payout [\#153](https://github.com/NodeFactoryIo/vedran/pull/153) ([MakMuftic](https://github.com/MakMuftic))
49+
- Metrics endpoint and grafana dashboard example [#\138](https://github.com/NodeFactoryIo/vedran/pull/138) ([mpetrun5](https://github.com/mpetrun5))
3250

3351
### Fix
3452
- Fix payout [\#148](https://github.com/NodeFactoryIo/vedran/pull/148) ([MakMuftic](https://github.com/MakMuftic))

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN go mod download
1818
COPY . .
1919

2020
# Build the application
21-
RUN go build -o vedran .
21+
RUN go build -ldflags "-X 'github.com/NodeFactoryIo/vedran/pkg/version.Version=$(sed -n 's/version=//p' .version)'" -o vedran .
2222

2323
# Move to /dist directory as the place for resulting binary folder
2424
WORKDIR /dist
@@ -32,4 +32,4 @@ FROM scratch
3232
COPY --from=builder /dist/vedran /
3333

3434
# Command to run
35-
ENTRYPOINT ["/vedran"]
35+
ENTRYPOINT ["/vedran"]

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ lint:
2222
clean:
2323
rm vedran 2> /dev/null || exit 0
2424

25-
build:
26-
go build
27-
2825
install:
2926
make clean
3027
make build
@@ -35,12 +32,17 @@ PLATFORMS := linux/amd64 windows/amd64 darwin/amd64 linux/arm
3532
temp = $(subst /, ,$@)
3633
os = $(word 1, $(temp))
3734
arch = $(word 2, $(temp))
35+
version = $(shell sed -n 's/version=//p' .version)
36+
version_flag = -ldflags "-X github.com/NodeFactoryIo/vedran/pkg/version.Version=$(version)"
3837

3938
$(PLATFORMS):
4039
@if [ "$(os)" = "windows" ]; then \
41-
GOOS=$(os) GOARCH=$(arch) go build -o 'build/windows/vedran.exe'; \
40+
GOOS=$(os) GOARCH=$(arch) go build ${version_flag} -o 'build/windows/vedran.exe'; \
4241
else \
43-
GOOS=$(os) GOARCH=$(arch) go build -o 'build/${os}-${arch}/vedran'; \
42+
GOOS=$(os) GOARCH=$(arch) go build ${version_flag} -o 'build/${os}-${arch}/vedran'; \
4443
fi
4544

4645
buildAll: $(PLATFORMS)
46+
47+
build:
48+
go build ${version_flag}

README.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
55
### Architecture
66

7-
_Vedran loadbalancer_ is used in conjunction with [Vedran daemon](https://github.com/NodeFactoryIo/vedran-daemon).
8-
Suppose the node owner wants to register to loadbalancer, than it is required to install and run _Vedran daemon_.
9-
Daemon executes the registration process and starts providing all relevant information (ping, metrics) to the _Vedran loadbalancer_.
7+
_Vedran loadbalancer_ is used in conjunction with [Vedran daemon](https://github.com/NodeFactoryIo/vedran-daemon).
8+
Suppose the node owner wants to register to loadbalancer, than it is required to install and run _Vedran daemon_.
9+
Daemon executes the registration process and starts providing all relevant information (ping, metrics) to the _Vedran loadbalancer_.
1010
Please check [Vedran daemon repo](https://github.com/NodeFactoryIo/vedran-daemon) for more details on the daemon itself.
1111

1212
![Image of vedran architecture](./assets/vedran-arch.png)
@@ -22,19 +22,21 @@ _This is dockerized demo of entire setup with loadbalancer, node and daemon_
2222

2323
**Run demo with `docker-compose up`**
2424

25-
_After all components have been started and node has sent first valid metrics report (after 30 seconds),
25+
_After all components have been started and node has sent first valid metrics report (after 30 seconds),
2626
you can invoke RPC methods on `localhost:4000` using HTTP requests or on `localhost:4000/ws` using WebSocket request_
27+
Metrics can be seen on `localhost:3000` hosted grafana under `vedran-dashboard`
2728

2829
You can check available rpc methods with:
2930

3031
```bash
3132
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "rpc_methods"}' http://localhost:4000
3233
```
33-
34-
This demo starts three separate dockerized components:
34+
This demo starts five separate dockerized components:
3535
- _Polkadot node_ ([repository](https://github.com/paritytech/polkadot))
3636
- _Vedran daemon_ ([repository](https://github.com/NodeFactoryIo/vedran-daemon))
37-
- _Vedran loadbalancer_
37+
- _Vedran loadbalancer_ (port: 4000)
38+
- _Prometheus server_ (port: 9090) - scrapes metrics from vedran's `/metrics` endpoint
39+
- _Grafana_ (port: 3000) - Visualizes metrics
3840

3941
### Trigger Manual Payout
4042

@@ -49,11 +51,11 @@ docker run --network vedran_default nodefactory/vedran:v0.3.0 payout --private-k
4951

5052
## Get **vedran** binary releases
5153

52-
Download prebuild binary from [releases](https://github.com/NodeFactoryIo/vedran/releases).
53-
Be careful to chose appropriate binary depending on your OS. For more details on how to run _vedran loadbalancer_ see [Starting loadbalancer](#starting-loadbalancer) part.
54+
Download prebuild binary from [releases](https://github.com/NodeFactoryIo/vedran/releases).
55+
Be careful to chose appropriate binary depending on your OS. For more details on how to run _vedran loadbalancer_ see [Starting loadbalancer](#starting-loadbalancer) part.
5456

5557
## Get **vedran** package
56-
Alternatively, it is possible to get _vedran_ golang package:
58+
Alternatively, it is possible to get _vedran_ golang package:
5759
1. Install [Golang](https://golang.org/doc/install) **1.15 or greater**
5860
2. Run the command below
5961
```
@@ -74,12 +76,12 @@ Load balancer is started by invoking **start** command.
7476

7577
For example `./vedran start --auth-secret=supersecret --private-key=lb-wallet-private-key`.
7678

77-
For more information you can always run vedran with `--help` flag.
79+
For more information you can always run vedran with `--help` flag.
7880
For list of all commands run `vedran --help` or for list of all options for specific command run `vedran start --help`.
7981

8082
**Load balancer will expose Polkadot RPC API on port 80 by default (can be changed using flag `--server-port`)**
8183

82-
Vedran loadbalancer supports both **HTTP** and **Websockets** protocols for Polkadot RPC API.
84+
Vedran loadbalancer supports both **HTTP** and **Websockets** protocols for Polkadot RPC API.
8385

8486
- **HTTP - available on root path** `/`
8587
- **WS - available on separate path** `/ws`
@@ -162,7 +164,7 @@ Additionally, it is possible to change URL on which payout script will connect w
162164
### Get private key
163165
You can use [subkey](https://substrate.dev/docs/en/knowledgebase/integrate/subkey) tool to get private key for your wallet.
164166

165-
After installing subkey tool call `subkey inspect "insert your mnemonic here"`.
167+
After installing subkey tool call `subkey inspect "insert your mnemonic here"`.
166168
You can find private key as _Secreet seed_. See example output of subkey command:
167169

168170
```
@@ -172,6 +174,27 @@ You can find private key as _Secreet seed_. See example output of subkey command
172174
SS58 Address: 5FnAq6wrMzri5V6jLfKgBkbR2rSAMkVAHVYWa3eU7TAV5rv9
173175
```
174176

177+
## Monitoring
178+
179+
Monitoring is done via grafana and prometheus which are expected to be installed.
180+
181+
### Installation
182+
- [Grafana installation](https://grafana.com/docs/grafana/latest/installation/)
183+
- [Prometheus installation](https://prometheus.io/docs/prometheus/latest/installation/)
184+
185+
### Configuration
186+
187+
- ### Grafana
188+
Should be configured to fetch data from prometheus server as data source [Tutorial](https://prometheus.io/docs/visualization/grafana/).
189+
190+
Should have a dashboard that visualizes data scraped from prometheus server. Example configuration can be found [here](./infra/grafana/provisioning/dashboards/vedran-dashboard.json) and can be imported like [this](https://grafana.com/docs/grafana/latest/dashboards/export-import/#importing-a-dashboard).
191+
192+
193+
- ### Prometheus
194+
Prometheus should be configured to scrape metrics from vedran's `/metrics` endpoint
195+
via prometheus .yml configuration. Example of which can be found [here](./infra/prometheus/prometheus.yml)
196+
197+
175198
## Vedran loadbalancer API
176199

177200
`POST api/v1/nodes`

cmd/start.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cmd
33
import (
44
"errors"
55
"fmt"
6-
schedulepayout "github.com/NodeFactoryIo/vedran/internal/schedule/payout"
76
"net/url"
87
"strconv"
98
"strings"
@@ -281,10 +280,10 @@ func startCommand(_ *cobra.Command, _ []string) {
281280
}
282281
log.Debugf("Whitelisting set to: %t", whitelistEnabled)
283282

284-
var payoutConfiguration *schedulepayout.PayoutConfiguration
283+
var payoutConfiguration *configuration.PayoutConfiguration
285284
if !autoPayoutDisabled {
286285
lbUrl, _ := url.Parse("http://" + publicIP + ":" + string(serverPort))
287-
payoutConfiguration = &schedulepayout.PayoutConfiguration{
286+
payoutConfiguration = &configuration.PayoutConfiguration{
288287
PayoutNumberOfDays: int(payoutNumberOfDays),
289288
PayoutTotalReward: payoutTotalRewardAsFloat64,
290289
LbFeeAddress: payoutFeeAddress,
@@ -306,8 +305,8 @@ func startCommand(_ *cobra.Command, _ []string) {
306305
TunnelServerAddress: tunnelServerAddress,
307306
PortPool: pPool,
308307
WhitelistEnabled: whitelistEnabled,
308+
PayoutConfiguration: payoutConfiguration,
309309
},
310-
payoutConfiguration,
311310
payoutPrivateKey,
312311
)
313312
}

docker-compose.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ services:
88
command: |
99
--dev --rpc-external --rpc-methods Unsafe --ws-external --prometheus-external --log error --rpc-cors=all
1010
11+
client:
12+
container_name: "vedran_user_curl"
13+
image: curlimages/curl:latest
14+
command: |
15+
sh -c "while sleep 15; do curl --silent -H Content-Type: application/json -d '{\"id\":1, \"jsonrpc\":\"2.0\", \"method\": \"chain_getBlock\"}' http://vedran:4000; done"
16+
17+
1118
vedran:
1219
command: start --auth-secret=test-secret --log-level debug --public-ip vedran --server-port 4000 --private-key ${VEDRAN_LB_PK:-0xe5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a} --payout-interval 1 --payout-reward ${VEDRAN_LB_REWARD_POOL:-10}
13-
image: nodefactory/vedran:v0.3.1
20+
image: nodefactory/vedran:v0.4.0
1421
ports:
1522
- "4000:4000"
1623
container_name: "vedran"
@@ -20,15 +27,32 @@ services:
2027
depends_on:
2128
- vedran
2229
- polkadot
23-
command: --id test-id --lb http://vedran:4000 --node-rpc http://polkadot:9933 --node-ws http://polkadot:9944 --node-metrics http://polkadot:9615 --payout-address 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty --log-level info
24-
25-
client:
26-
container_name: "vedran_user_curl"
27-
image: curlimages/curl:latest
28-
command: |
29-
sh -c "while sleep 15; do curl --silent -H Content-Type: application/json -d '{\"id\":1, \"jsonrpc\":\"2.0\", \"method\": \"chain_getBlock\"}' http://vedran:4000; done"
30+
command: --id test-id --lb http://vedran:4000 --node-rpc http://polkadot:9933 --node-ws http://polkadot:9944 --node-metrics http://polkadot:9615 --payout-address 1Z4GTfUN2QHkSeHqdBUDawgbEWzqtfRG8ouJZ26z3cm7ePN --log-level info
3031

32+
prometheus:
33+
image: prom/prometheus
34+
volumes:
35+
- ./infra/prometheus/:/etc/prometheus/
36+
command:
37+
- '--config.file=/etc/prometheus/prometheus.yml'
38+
- '--storage.tsdb.path=/prometheus'
39+
- '--storage.tsdb.retention=20d'
40+
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
41+
- '--web.console.templates=/usr/share/prometheus/consoles'
42+
ports:
43+
- 9090:9090
3144

45+
grafana:
46+
image: grafana/grafana
47+
volumes:
48+
- grafana_data:/var/lib/grafana
49+
- ./infra/grafana/provisioning:/etc/grafana/provisioning
50+
environment:
51+
- GF_AUTH_ANONYMOUS_ENABLED=true
52+
ports:
53+
- 3000:3000
54+
user: "104"
3255

3356
volumes:
3457
polkadot-data:
58+
grafana_data:

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ require (
1717
github.com/inconshreveable/go-vhost v0.0.0-20160627193104-06d84117953b
1818
github.com/manifoldco/promptui v0.8.0
1919
github.com/pkg/errors v0.8.1
20+
github.com/prometheus/client_golang v1.7.1
2021
github.com/sirupsen/logrus v1.6.0
22+
github.com/slok/go-http-metrics v0.9.0
2123
github.com/spf13/cobra v1.0.0
2224
github.com/stretchr/testify v1.6.1
2325
golang.org/x/net v0.0.0-20200822124328-c89045814202

0 commit comments

Comments
 (0)