Skip to content

Commit

Permalink
Merge pull request #2044 from w3f/will-worker-additions
Browse files Browse the repository at this point in the history
Refactoring to Accomodate Worker Jobs
  • Loading branch information
wpank committed Oct 22, 2022
2 parents 50053cf + 35102e8 commit 49082b0
Show file tree
Hide file tree
Showing 118 changed files with 26,753 additions and 5,411 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package-lock.json
config/main.json
config/secret.json
*.db
*.log
combined.log
scripts/test
config.json*
Expand All @@ -23,3 +24,5 @@ build
*.tsbuildinfo
**/config/main.json
**/config/secret.json

redis/
2 changes: 1 addition & 1 deletion Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ RUN echo "building ${PACKAGE}... "; \
echo "yarn install done. Building...." ; \
yarn workspaces foreach run build ; \
echo "building ${PACKAGE} done."
CMD pwd && ls && yarn run start:dev:${PACKAGE}
CMD yarn run start:dev:${PACKAGE}
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.87
version: v2.6.88
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.87
tag: 2.6.88

certificate:
enabled: true
Expand Down
8 changes: 6 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@ services:
dockerfile: ./Dockerfile-dev
volumes:
- .:/app
deploy:
mode: replicated
replicas: 2
restart: unless-stopped
networks:
testing_net:
ipv4_address: 172.28.1.16
# ipv4_address: 172.28.1.16


telemetry-backend-core:
Expand Down Expand Up @@ -227,7 +231,7 @@ services:
volumes:
- ./redis:/data
restart: always
command: ["redis-server", "--bind", "redis", "--port", "6379"]
command: ["redis-server", "--bind", "172.28.1.13", "--port", "6379"]
logging:
driver: "json-file"
options:
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.87
version: v2.6.88
{{ 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.87
version: v2.6.88
{{ else }}
chart: ../charts/otv-backend
{{ end }}
Expand Down
5 changes: 4 additions & 1 deletion helmfile.d/config/kusama/otv-backend-ci.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ config: |
"skipStakedDestination": true,
"skipClientUpgrade": false,
"skipUnclaimed": false,
"forceClientVersion": "v0.9.16"
"forceClientVersion": "v0.9.30",
"minSelfStake": 10000000000000000000,
"commission": 150000000,
"unclaimedEraThreshold": 4
},
"cron": {
"monitor": "0 */15 * * * *"
Expand Down
5 changes: 4 additions & 1 deletion helmfile.d/config/kusama/otv-backend-local.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ config: |
"skipStakedDestination": true,
"skipClientUpgrade": false,
"skipUnclaimed": false,
"forceClientVersion": "v0.9.16"
"forceClientVersion": "v0.9.30",
"minSelfStake": 10000000000000000000,
"commission": 150000000,
"unclaimedEraThreshold": 4
},
"cron": {
"monitor": "0 */15 * * * *"
Expand Down
10 changes: 8 additions & 2 deletions helmfile.d/config/kusama/otv-backend-prod.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ config: |
"test": false,
"retroactive": false,
"historicalNominations": false,
"apiEndpoints": []
"apiEndpoints": [
"wss://kusama-rpc.polkadot.io",
"wss://kusama.api.onfinality.io/public-ws"
]
},
"constraints": {
"skipConnectionTime": false,
"skipIdentity": false,
"skipStakedDestination": true,
"skipClientUpgrade": false,
"skipUnclaimed": true,
"forceClientVersion": "v0.9.29"
"forceClientVersion": "v0.9.30",
"minSelfStake": 10000000000000000000,
"commission": 150000000,
"unclaimedEraThreshold": 4
},
"cron": {
"monitor": "0 */15 * * * *"
Expand Down
5 changes: 4 additions & 1 deletion helmfile.d/config/polkadot/otv-backend-ci.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ config: |
"skipStakedDestination": false,
"skipClientUpgrade": false,
"skipUnclaimed": false,
"forceClientVersion": "v0.9.16"
"forceClientVersion": "v0.9.30",
"minSelfStake": 50000000000000,
"commission": 50000000,
"unclaimedEraThreshold": 1
},
"cron": {
"monitor": "0 */15 * * * *"
Expand Down
5 changes: 4 additions & 1 deletion helmfile.d/config/polkadot/otv-backend-local.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ config: |
"skipStakedDestination": false,
"skipClientUpgrade": false,
"skipUnclaimed": false,
"forceClientVersion": "v0.9.16"
"forceClientVersion": "v0.9.30",
"minSelfStake": 50000000000000,
"commission": 50000000,
"unclaimedEraThreshold": 1
},
"cron": {
"monitor": "0 */15 * * * *"
Expand Down
10 changes: 8 additions & 2 deletions helmfile.d/config/polkadot/otv-backend-prod.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ config: |
"test": false,
"retroactive": false,
"historicalNominations": false,
"apiEndpoints": []
"apiEndpoints": [
"wss://rpc.polkadot.io",
"wss://polkadot.api.onfinality.io/public-ws"
]
},
"constraints": {
"skipConnectionTime": false,
"skipIdentity": false,
"skipStakedDestination": false,
"skipClientUpgrade": false,
"skipUnclaimed": true,
"forceClientVersion": "v0.9.29"
"forceClientVersion": "v0.9.30",
"minSelfStake": 50000000000000,
"commission": 50000000,
"unclaimedEraThreshold": 1
},
"cron": {
"monitor": "0 */15 * * * *"
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
"private": true,
"workspaces": [
"packages/common",
"packages/worker",
"packages/gateway",
"packages/telemetry",
"packages/core",
"packages/worker"
"packages/core"
],
"scripts": {
"create-config:all": "yarn workspaces foreach run create-config",
"create-kusama-config:all": "yarn workspaces foreach run create-kusama-config",
"docker:start": "yarn build:clean && docker-compose up -d --build",
"lint": "yarn workspaces foreach run lint",
"lint:fix": "yarn workspaces foreach run lint:fix",
"clean": "yarn workspaces foreach run clean",
"clean": "rm -rf redis/ && yarn workspaces foreach run clean",
"build": "yarn workspaces foreach -t run build",
"build:clean": "yarn workspaces foreach run clean:build",
"start:dev:gateway": "yarn workspace @1kv/gateway run start:dev",
Expand All @@ -27,10 +28,11 @@
"start:js:worker": "NODE_OPTIONS='--max-old-space-size=6096' node packages/worker/build/index.js start"
},
"devDependencies": {
"@types/node": "^18.8.4",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"eslint": "^8.25.0",
"@types/eslint": "^8",
"@types/node": "^18.11.2",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"eslint": "8.22.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
]
},
"dependencies": {
"@polkadot/keyring": "^10.1.10",
"@polkadot/keyring": "^10.1.11",
"@types/mongoose": "^5.11.97",
"@types/node": "^18.8.4",
"@types/node": "^18.11.2",
"hash.js": "^1.1.7",
"mongoose": "^6.6.5",
"typescript": "^4.8.4",
Expand Down
8 changes: 1 addition & 7 deletions packages/common/src/ApiHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,7 @@ class ApiHandler extends EventEmitter {
return this._api.isConnected;
}

async getApi(): Promise<ApiPromise> {
if (this._reconnectLock) {
return new Promise((resolve) => {
setTimeout(() => resolve(this.getApi()), 2000);
});
}

getApi(): ApiPromise {
return this._api;
}

Expand Down
Loading

0 comments on commit 49082b0

Please sign in to comment.