Skip to content

Commit

Permalink
Merge pull request #2038 from w3f/will-worker
Browse files Browse the repository at this point in the history
Add Worker
  • Loading branch information
wpank committed Oct 17, 2022
2 parents 3087e85 + c3aa51a commit 9ecc2de
Show file tree
Hide file tree
Showing 32 changed files with 505 additions and 7,109 deletions.
37 changes: 36 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,18 @@ jobs:
- setup_remote_docker
- run:
command: |
/scripts/build-image.sh web3f/otv-gateway . --build-arg PACKAGE=telemetry
/scripts/build-image.sh web3f/otv-telemetry . --build-arg PACKAGE=telemetry
buildWorkerImage:
docker:
- image: web3f/ci-commons:v3.1.6
resource_class: xlarge
steps:
- checkout
- setup_remote_docker
- run:
command: |
/scripts/build-image.sh web3f/otv-worker . --build-arg PACKAGE=worker
integrationTests:
docker:
Expand Down Expand Up @@ -105,6 +116,16 @@ jobs:
command: |
/scripts/publish-image.sh web3f/otv-telemetry
publishWorkerImage:
docker:
- image: web3f/ci-commons:v3.1.6
steps:
- checkout
- setup_remote_docker
- run:
command: |
/scripts/publish-image.sh web3f/otv-worker
publishChart:
docker:
- image: web3f/ci-commons:v3.1.6
Expand Down Expand Up @@ -160,6 +181,11 @@ workflows:
# context: dockerhub-bot
# filters:
# tags:
# only: /.*/
# - buildWorkerImage:
# context: dockerhub-bot
# filters:
# tags:
# only: /.*/
- integrationTests:
filters:
Expand Down Expand Up @@ -195,6 +221,15 @@ workflows:
# tags:
# only: /v[0-9]+(\.[0-9]+)*/
# requires:
# - integrationTests
# - publishWorkerImage:
# context: dockerhub-bot
# filters:
# branches:
# ignore: /.*/
# tags:
# only: /v[0-9]+(\.[0-9]+)*/
# requires:
# - integrationTests
- publishChart:
context: github-bot
Expand Down
2 changes: 1 addition & 1 deletion charts/otv-backend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: 1K Validators Backend
name: otv-backend
version: v2.6.86
version: v2.6.87
apiVersion: v2
2 changes: 1 addition & 1 deletion charts/otv-backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resources:

image:
repo: web3f/otv-backend
tag: 2.6.86
tag: 2.6.87

certificate:
enabled: true
Expand Down
30 changes: 28 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,22 @@ services:
dockerfile: ./Dockerfile-dev
volumes:
- .:/app
# ports:
# - "3300:3300"
networks:
testing_net:
ipv4_address: 172.28.1.9

1kv-worker:
build:
context: .
args:
PACKAGE: worker
dockerfile: ./Dockerfile-dev
volumes:
- .:/app
networks:
testing_net:
ipv4_address: 172.28.1.16


telemetry-backend-core:
image: parity/substrate-telemetry-backend:latest
Expand Down Expand Up @@ -210,6 +220,22 @@ services:
testing_net:
ipv4_address: 172.28.1.14

redis:
image: redis:alpine
expose:
- "6379"
volumes:
- ./redis:/data
restart: always
command: ["redis-server", "--bind", "redis", "--port", "6379"]
logging:
driver: "json-file"
options:
max-size: "50m"
networks:
default:
testing_net:
ipv4_address: 172.28.1.13



Expand Down
4 changes: 2 additions & 2 deletions helmfile.d/10-otv-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ releases:
namespace: kusama
{{ if eq .Environment.Name "production" }}
chart: w3f/otv-backend
version: v2.6.86
version: v2.6.87
{{ else }}
chart: ../charts/otv-backend
{{ end }}
Expand All @@ -30,7 +30,7 @@ releases:
namespace: polkadot
{{ if eq .Environment.Name "production" }}
chart: w3f/otv-backend
version: v2.6.86
version: v2.6.87
{{ else }}
chart: ../charts/otv-backend
{{ end }}
Expand Down
3 changes: 2 additions & 1 deletion helmfile.d/config/kusama/otv-backend-ci.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ config: |
"networkPrefix": 2,
"test": false,
"retroactive": false,
"historicalNominations": false
"historicalNominations": false,
"apiEndpoints": []
},
"constraints": {
"skipConnectionTime": false,
Expand Down
7 changes: 5 additions & 2 deletions helmfile.d/config/kusama/otv-backend-prod.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ config: |
"networkPrefix": 2,
"test": false,
"retroactive": false,
"historicalNominations": false
"historicalNominations": false,
"apiEndpoints": []
},
"constraints": {
"skipConnectionTime": false,
Expand Down Expand Up @@ -2883,9 +2884,11 @@ config: |
"nominating": true
},
"server": {
"port": 3300
"port": 3300,
"enable": true
},
"telemetry": {
"enable": true,
"chains": [
"0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe"
],
Expand Down
3 changes: 2 additions & 1 deletion helmfile.d/config/polkadot/otv-backend-ci.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ config: |
"networkPrefix": 0,
"test": false,
"retroactive": false,
"historicalNominations": false
"historicalNominations": false,
"apiEndpoints": []
},
"constraints": {
"skipConnectionTime": false,
Expand Down
7 changes: 5 additions & 2 deletions helmfile.d/config/polkadot/otv-backend-prod.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ config: |
"networkPrefix": 0,
"test": false,
"retroactive": false,
"historicalNominations": false
"historicalNominations": false,
"apiEndpoints": []
},
"constraints": {
"skipConnectionTime": false,
Expand Down Expand Up @@ -1266,9 +1267,11 @@ config: |
"nominating": true
},
"server": {
"port": 3300
"port": 3300,
"enable": true
},
"telemetry": {
"enable": true

This comment has been minimized.

Copy link
@ironoa

ironoa Oct 17, 2022

Contributor

probably that's the problem, the missing comma

"chains": [
"0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3"
],
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"packages/common",
"packages/gateway",
"packages/telemetry",
"packages/core"
"packages/core",
"packages/worker"
],
"scripts": {
"create-config:all": "yarn workspaces foreach run create-config",
Expand All @@ -21,7 +22,9 @@
"start:dev:core": "yarn workspace @1kv/core run start:dev",
"start:js:core": "NODE_OPTIONS='--max-old-space-size=6096' node packages/core/build/index.js start",
"start:dev:telemetry": "yarn workspace @1kv/telemetry run start:dev",
"start:js:telemetry": "NODE_OPTIONS='--max-old-space-size=6096' node packages/telemetry/build/index.js start"
"start:js:telemetry": "NODE_OPTIONS='--max-old-space-size=6096' node packages/telemetry/build/index.js start",
"start:dev:worker": "yarn workspace @1kv/worker run start:dev",
"start:js:worker": "NODE_OPTIONS='--max-old-space-size=6096' node packages/worker/build/index.js start"
},
"devDependencies": {
"@types/node": "^18.8.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/common",
"version": "2.6.82",
"version": "2.6.87",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export type ConfigSchema = {
test: boolean;
retroactive: boolean;
historicalNominations: boolean;
apiEndpoints: string[];
};
matrix: {
accessToken: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/core",
"version": "2.6.83",
"version": "2.6.87",
"description": "Services for running the Thousand Validator Program.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { startClearAccumulatedOfflineTimeJob, startMonitorJob } from "./cron";

const isCI = process.env.CI;

const version = "v2.6.83";
const version = "v2.6.87";

const catchAndQuit = async (fn: any) => {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/gateway/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/gateway",
"version": "2.6.82",
"version": "2.6.87",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand All @@ -25,7 +25,7 @@
}
},
"dependencies": {
"@1kv/common": "2.6.82",
"@1kv/common": "workspace:^",
"typescript": "^4.8.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/gateway/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Server from "./server";
import { Command } from "commander";
import { Db, Config, logger } from "@1kv/common";

const version = "v3.0.0";
const version = "v2.6.87";

const catchAndQuit = async (fn: any) => {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/telemetry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/telemetry",
"version": "2.6.82",
"version": "2.6.87",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand All @@ -25,7 +25,7 @@
}
},
"dependencies": {
"@1kv/common": "2.6.82",
"@1kv/common": "workspace:^",
"typescript": "^4.8.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/telemetry/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Config, Db, logger } from "@1kv/common";
import TelemetryClient from "./telemetry";
import { Command } from "commander";

const version = "v3.0.0";
const version = "v2.6.87";

const catchAndQuit = async (fn: any) => {
try {
Expand Down
10 changes: 10 additions & 0 deletions packages/worker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alice
bob
node_modules
scripts
test
zero
*.db
charts
helmfile.d
build
16 changes: 16 additions & 0 deletions packages/worker/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
extends: [
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"plugin:security/recommended",
"prettier", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: "module" // Allows for the use of imports
},
rules: {
"@typescript-eslint/ban-ts-comment": "off"
}
};
7 changes: 7 additions & 0 deletions packages/worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:17-slim
ARG MATRIX_TOKEN
WORKDIR /code
COPY . .
RUN ["npm", "i"]
RUN ["npm", "run", "build"]
CMD ["npm", "run", "js:start"]
8 changes: 8 additions & 0 deletions packages/worker/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:18 AS builder
COPY . /app
WORKDIR /app
RUN yarn set version 3.2.2 && \
yarn install && \
yarn workspace @1kv/common build && \
yarn workspace @1kv/gateway build
CMD yarn start:dev:gateway
Loading

0 comments on commit 9ecc2de

Please sign in to comment.