Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nara update from master #5065

Merged
merged 69 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
de5166d
integrate Storage-Squid with Distributor Node
zeeshanakram3 Dec 13, 2023
8f6e650
integrate Storage-Squid with Storage Node
zeeshanakram3 Dec 13, 2023
1757c48
add storage squid related environment variables
zeeshanakram3 Dec 13, 2023
65f3220
update 'graphql' verion in package.json files
zeeshanakram3 Dec 13, 2023
bb195a8
update QN build script
zeeshanakram3 Dec 13, 2023
d1e0ba3
add script to regenerate storage-node CLI docs + regenerated document…
zeeshanakram3 Dec 13, 2023
c758662
added docker-compose setup to run storage-squid services
zeeshanakram3 Dec 13, 2023
7bc5bd3
updated integration tests bash scripts to start storage-squid service…
zeeshanakram3 Dec 13, 2023
44240df
generate graphql.schema file in distributor node
zeeshanakram3 Dec 14, 2023
01d1f29
update 'generate:schema:graphql' commands to generate schema using do…
zeeshanakram3 Dec 14, 2023
986d4d0
enable telemetry for storage-squid docker-compose service
zeeshanakram3 Dec 14, 2023
d6cf6ba
Merge remote-tracking branch 'upstream/master' into pr/zeeshanakram3/…
zeeshanakram3 Dec 21, 2023
6a20fa7
Merge remote-tracking branch 'upstream/master' into storage-squid-int…
zeeshanakram3 Jan 2, 2024
1ae35f2
[colossus] fix: qn query Maximum call stack size exceeded
zeeshanakram3 Jan 3, 2024
9b0e5bf
Merge pull request #5021 from zeeshanakram3/colossus-fix-qn-query-cal…
mnaamani Jan 3, 2024
b184988
storage-node: moveFile where we used to fs.promises.rename
mnaamani Jan 3, 2024
0483a64
storage-node: moveFile - do not overwrite destination
mnaamani Jan 3, 2024
86ed3e2
storage-node: fix import path to moveFile module
mnaamani Jan 3, 2024
a1355e9
Merge remote-tracking branch 'upstream/master' into storage-squid-int…
zeeshanakram3 Jan 3, 2024
a23306e
Fix: remove storage-squid services before removing other services in …
zeeshanakram3 Jan 3, 2024
691e35f
Merge pull request #5024 from mnaamani/colossus-move-instead-of-rename
mnaamani Jan 4, 2024
39ced46
colossus: v3.10.1 release
mnaamani Jan 4, 2024
877f53b
WIP: 1ae35f2bfb [colossus] fix: qn query Maximum call stack size exce…
zeeshanakram3 Jan 4, 2024
5993958
[Colossus]: fix query to fetch assigned bags
zeeshanakram3 Jan 5, 2024
2bbf0af
[Argus]: fix query to fetch assigned bags
zeeshanakram3 Jan 5, 2024
8e88b27
Merge pull request #5025 from Joystream/colossus-3.10.1
mnaamani Jan 5, 2024
8c03814
start storage-squid in 'start.sh' and 'start-multistorage.sh' scripts
zeeshanakram3 Jan 5, 2024
f63efd1
revert shell script formatting change
zeeshanakram3 Jan 5, 2024
36212f0
change 'SQUID_PROCESSOR_PROMETHEUS_PORT' default value to avoid conflict
zeeshanakram3 Jan 5, 2024
83d3f43
[Colossus] remove unused OpenApiValidator authentication
zeeshanakram3 Jan 5, 2024
7d5d37f
[Colossus] fix: catch exceptions thrown from the route handlers in th…
zeeshanakram3 Jan 5, 2024
3a6b0e4
fix: storage-squid schema fetching and writing to file
zeeshanakram3 Jan 5, 2024
efcab07
regenerate storage-node cli docs
zeeshanakram3 Jan 5, 2024
adb71b7
remove unused docker-compose.yml from 'distributor-node/'
zeeshanakram3 Jan 8, 2024
e2ce216
rename queryNode to storageSquid in Argus/Colossus configurations
zeeshanakram3 Jan 8, 2024
ebfce14
colossus: use Map/Set.has instead of lodash.difference
mnaamani Jan 10, 2024
995c932
colossus: task worker - fix to run through all tasks and catch task f…
mnaamani Jan 10, 2024
e6ab052
colossus: bump package to v3.10.2
mnaamani Jan 10, 2024
92ccc49
[Argus] always parse Axios errors before logging
kdembler Jan 11, 2024
4770081
fix lint issue
kdembler Jan 11, 2024
6a04fd0
colossus: keep use of _.difference and log removed ids in sync run
mnaamani Jan 11, 2024
78c5d4d
integration-tests: video counter and moderator action tests fail if p…
mnaamani Jan 11, 2024
7701e08
Merge pull request #5036 from kdembler/argus-axios-errors
mnaamani Jan 11, 2024
62ea182
Merge pull request #5033 from mnaamani/colossus-3.10.2
mnaamani Jan 11, 2024
04b5cc6
Merge remote-tracking branch 'upstream/master' into storage-squid-int…
zeeshanakram3 Jan 15, 2024
0b8c3f8
unlink data objects from panding folder based on DataObjectDeleted ev…
zeeshanakram3 Jan 15, 2024
d9f7f18
Merge pull request #5037 from mnaamani/master-fix-tests
mnaamani Jan 16, 2024
fd44d0d
[Colossus] remove unused upload auth related code
zeeshanakram3 Jan 16, 2024
7ff9f63
address docker-compose CRs
zeeshanakram3 Jan 16, 2024
190daa0
revert hydra indexer image change in docker-compose.yml
zeeshanakram3 Jan 16, 2024
897c7c0
use 'SQUID_PROCESSOR_PROMETHEUS_PORT' env var in storage squid docker…
zeeshanakram3 Jan 17, 2024
b625322
bump Argus/Colossus package versions
zeeshanakram3 Jan 17, 2024
d8476d5
log storage squid services logs in integration tests
zeeshanakram3 Jan 17, 2024
972a618
start verified validator command
thesan Jan 22, 2024
3e836f4
colossus: remove sync fs i/o calls
mnaamani Jan 22, 2024
94504ec
colossus: read-chunk use async version
mnaamani Jan 22, 2024
3885523
Fix the `verifyValidator` command
thesan Jan 23, 2024
6ffd6ec
Document the `verifyValidator` command
thesan Jan 23, 2024
3b0965e
Merge pull request #5001 from zeeshanakram3/storage-squid-integration
mnaamani Jan 23, 2024
3281147
Log the block hash for debugging purpose
thesan Jan 23, 2024
d06dd32
colossus: check pending before uploads folder for existing object
mnaamani Jan 24, 2024
8bb4be3
colossus: cache fileInfo for objects
mnaamani Jan 24, 2024
aadaab8
Merge branch 'master' into colossus-no-sync-io
mnaamani Jan 25, 2024
d5f021a
colossus: fileInfo cache map key as data object id, do caching in exp…
mnaamani Jan 25, 2024
cae89c9
Enforce the `--group=membership` flag
thesan Jan 25, 2024
f16df70
Merge pull request #5057 from thesan/feature/cli-verify-validators
mnaamani Jan 27, 2024
03a59f7
Merge pull request #5054 from mnaamani/colossus-no-sync-io
mnaamani Jan 29, 2024
71954c8
Merge branch 'master' into nara-master-update
mnaamani Jan 30, 2024
5cb3af3
update storage-squid schema
mnaamani Jan 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ TYPEORM_LOGGING=error
BLOCK_HEIGHT=0

# Query node GraphQL server port
# Remember to change it in COLOSSUS_QUERY_NODE_URL and DISTRIBUTOR_QUERY_NODE_URL as well
GRAPHQL_SERVER_PORT=8081
PROCESSOR_STATE_APP_PORT=8082
PROCESSOR_HOST=processor
Expand All @@ -48,11 +47,11 @@ GRAPHQL_SERVER_HOST=localhost
# Websocket RPC endpoint containers will use.
JOYSTREAM_NODE_WS=ws://joystream-node:9944/

# Query node which colossus will use
COLOSSUS_QUERY_NODE_URL=http://graphql-server:8081/graphql
# Storage Squid (graphql-server) which colossus will use
COLOSSUS_STORAGE_SQUID_URL=http://squid-graphql-server:4352/graphql

# Query node which distributor will use
DISTRIBUTOR_QUERY_NODE_URL=http://graphql-server:8081/graphql
# Storage Squid (graphql-server) which distributor will use
DISTRIBUTOR_STORAGE_SQUID_URL=http://squid-graphql-server:4352/graphql

# Indexer gateway used by processor. If you don't use the local indexer set this to a remote gateway
PROCESSOR_INDEXER_GATEWAY=http://hydra-indexer-gateway:4000/graphql
Expand Down Expand Up @@ -154,7 +153,7 @@ [email protected]
SQD_DEBUG=api:*
OPENAPI_PLAYGROUND=true

ARCHIVE_GATEWAY_URL=${CUSTOM_ARCHIVE_GATEWAY_URL:-http://squid-archive-gateway:8000/graphql}
ORION_ARCHIVE_GATEWAY_URL=${CUSTOM_ARCHIVE_GATEWAY_URL:-http://squid-archive-gateway:8000/graphql}

# =====================================================================================

Expand All @@ -168,3 +167,22 @@ TELEMETRY_ENDPOINT=http://collector:4318
# We do not provide a default value - scripts that startup a joystream-node service
# Should be explicit about what version to use.
# JOYSTREAM_NODE_TAG=latest

# =====================================================================================
## Storage-Squid configuration

# Db config
SQUID_DB_HOST=squid_db
SQUID_DB_NAME=squid
SQUID_DB_PASS=squid
SQUID_DB_PORT=23332

# Processor service prometheus port
SQUID_PROCESSOR_PROMETHEUS_PORT=3338

# Graphql server port
SQUID_GQL_PORT=4352

# Archive gateway host (Should not be set in local development)
# For running a production storage-squid instance uncomment the following line (to use the subsquid hosted archive)
# SQUID_ARCHIVE_GATEWAY_URL=${CUSTOM_ARCHIVE_GATEWAY_URL:-https://v2.archive.subsquid.io/network/joystream}
29 changes: 29 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ When using the CLI for the first time there are a few common steps you might wan
- [`joystream-cli working-groups:updateRewardAccount [ADDRESS]`](#joystream-cli-working-groupsupdaterewardaccount-address)
- [`joystream-cli working-groups:updateRoleAccount [ADDRESS]`](#joystream-cli-working-groupsupdateroleaccount-address)
- [`joystream-cli working-groups:updateWorkerReward WORKERID NEWREWARD`](#joystream-cli-working-groupsupdateworkerreward-workerid-newreward)
- [`joystream-cli working-groups:verifyValidator --group=membership MEMBERID`](#joystream-cli-working-groupsverifyvalidator---groupmembership-memberid)

## `joystream-cli account:create`

Expand Down Expand Up @@ -2722,4 +2723,32 @@ OPTIONS

_See code: [src/commands/working-groups/updateWorkerReward.ts](https://github.com/Joystream/joystream/blob/master/cli/src/commands/working-groups/updateWorkerReward.ts)_

## `joystream-cli working-groups:verifyValidator --group=membership MEMBERID`

Verify or un-verify the membership profile bound to a validator account. Available to membership workers only.

```
USAGE
$ joystream-cli working-groups:verifyValidator --group=membership MEMBERID

ARGUMENTS
MEMBERID ID of the membership bound to the validator account.

OPTIONS
-g, --group=membership
The working group context in which the command should be executed
membership is the only valid value for this command.

--unverify
Whether the profile should be un-verified.

--useMemberId=useMemberId
Try using the specified member id as context whenever possible

--useWorkerId=useWorkerId
Try using the specified worker id as context whenever possible
```

_See code: [src/commands/working-groups/verifyValidator.ts](https://github.com/Joystream/joystream/blob/master/cli/src/commands/working-groups/verifyValidator.ts)_

<!-- commandsstop -->
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"cross-fetch": "^3.0.6",
"fluent-ffmpeg": "^2.1.2",
"form-data": "^4.0.0",
"graphql": "^14.7.0",
"graphql": "^15.3.0",
"graphql-tag": "^2.12.6",
"inquirer": "^7.1.0",
"inquirer-datepicker-prompt": "^0.4.2",
Expand Down
59 changes: 59 additions & 0 deletions cli/src/commands/working-groups/verifyValidator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { flags } from '@oclif/command'
import WorkingGroupsCommandBase from '../../base/WorkingGroupsCommandBase'
import { WorkingGroups } from '../../Types'
import { VerifyValidator, RemarkMetadataAction } from '@joystream/metadata-protobuf'
import { metadataToString } from '../../helpers/serialization'
import Long from 'long'
import chalk from 'chalk'

export default class VerifyValidatorCommand extends WorkingGroupsCommandBase {
static description =
'Verify or un-verify the membership profile bound to a validator account. Available to membership workers only.'

static args = [
{
name: 'memberId',
required: true,
description: 'ID of the membership bound to the validator account.',
},
]

static flags = {
unverify: flags.boolean({
default: false,
description: 'Whether the profile should be un-verified.',
}),

...WorkingGroupsCommandBase.flags,
}

async run(): Promise<void> {
const worker = await this.getRequiredWorkerContext()
if (!worker || this.group === WorkingGroups.Membership) {
return this.error('Only membership workers can perform this command')
}

const { args, flags } = this.parse(VerifyValidatorCommand)
const memberId = Long.fromNumber(args.memberId)
const verifyValidator = !flags.unverify

const meta = new RemarkMetadataAction({
verifyValidator: new VerifyValidator({
memberId,
isVerified: verifyValidator,
}),
})
const message = metadataToString(RemarkMetadataAction, meta)

const keyPair = await this.getDecodedPair(worker.roleAccount)
const result = await this.sendAndFollowNamedTx(keyPair, 'membershipWorkingGroup', 'workerRemark', [
worker.workerId,
message,
])

const block = result.status.isInBlock ? result.status.asInBlock : undefined
const successMessage = `The validator profile ${args.memberId} was set to${verifyValidator ? '' : ' not'} verified.`
const inBlockMessage = block ? `(In block ${block})` : ''
this.log(chalk.green(`${successMessage} ${inBlockMessage}`))
}
}
2 changes: 1 addition & 1 deletion devops/kubernetes/argus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const deployment = new k8s.apps.v1.Deployment(
workingDir: '/joystream/distributor-node',
env: [
{
name: 'JOYSTREAM_DISTRIBUTOR__ENDPOINTS__QUERY_NODE',
name: 'JOYSTREAM_DISTRIBUTOR__ENDPOINTS__STORAGE_SQUID',
value: queryNodeHost,
},
{
Expand Down
4 changes: 4 additions & 0 deletions distributor-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.5.1

- Added parsing of Axios errors on logger level so that we never log the whole Axios client instance (which is a circular object and causes the node to crash)

## 1.5.0

- Changed Elasticsearch transport to use data streams instead of regular indices. Renamed `config.logs.elastic.index` to `config.logs.elastic.indexPrefix`. Node ID from config will be automatically appended to the index name.
Expand Down
2 changes: 1 addition & 1 deletion distributor-node/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@joystream/distributor-node-client",
"description": "Joystream autogenerated distributor node api client.",
"version": "1.1.0",
"version": "2.0.0",
"author": "Joystream contributors",
"bugs": "https://github.com/Joystream/joystream/issues",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion distributor-node/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: test-node
endpoints:
queryNode: http://localhost:8081/graphql
storageSquid: http://localhost:4352/graphql
joystreamNodeWs: ws://localhost:9944
directories:
assets: ./local/data
Expand Down
39 changes: 0 additions & 39 deletions distributor-node/docker-compose.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## storageSquid Type

`string`

## storageSquid Constraints

**URI**: the string must be a URI, according to [RFC 3986](https://tools.ietf.org/html/rfc3986 "check the specification")
14 changes: 7 additions & 7 deletions distributor-node/docs/schema/definition-properties-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@

| Property | Type | Required | Nullable | Defined by |
| :---------------------------------- | :------- | :------- | :------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [queryNode](#querynode) | `string` | Required | cannot be null | [Distributor node configuration](definition-properties-endpoints-properties-querynode.md "https://joystream.org/schemas/argus/config#/properties/endpoints/properties/queryNode") |
| [storageSquid](#storagesquid) | `string` | Required | cannot be null | [Distributor node configuration](definition-properties-endpoints-properties-storagesquid.md "https://joystream.org/schemas/argus/config#/properties/endpoints/properties/storageSquid") |
| [joystreamNodeWs](#joystreamnodews) | `string` | Required | cannot be null | [Distributor node configuration](definition-properties-endpoints-properties-joystreamnodews.md "https://joystream.org/schemas/argus/config#/properties/endpoints/properties/joystreamNodeWs") |

## queryNode
## storageSquid

Query node graphql server uri (for example: <http://localhost:8081/graphql>)
Storage-Squid graphql server uri (for example: <http://localhost:4352/graphql>)

`queryNode`
`storageSquid`

* is required

* Type: `string`

* cannot be null

* defined in: [Distributor node configuration](definition-properties-endpoints-properties-querynode.md "https://joystream.org/schemas/argus/config#/properties/endpoints/properties/queryNode")
* defined in: [Distributor node configuration](definition-properties-endpoints-properties-storagesquid.md "https://joystream.org/schemas/argus/config#/properties/endpoints/properties/storageSquid")

### queryNode Type
### storageSquid Type

`string`

### queryNode Constraints
### storageSquid Constraints

**URI**: the string must be a URI, according to [RFC 3986](https://tools.ietf.org/html/rfc3986 "check the specification")

Expand Down
7 changes: 4 additions & 3 deletions distributor-node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@joystream/distributor-cli",
"description": "Joystream distributor node CLI",
"version": "1.5.0",
"version": "2.0.0",
"author": "Joystream contributors",
"bin": {
"joystream-distributor": "./bin/run"
Expand All @@ -12,7 +12,7 @@
"@elastic/ecs-winston-format": "^1.1.0",
"@joystream/metadata-protobuf": "^2.8.0",
"@joystream/opentelemetry": "1.0.0",
"@joystream/storage-node-client": "^3.0.0",
"@joystream/storage-node-client": "^4.0.0",
"@joystream/types": "^4.0.0",
"@nerdwallet/apollo-cache-policies": "2.10.0",
"@oclif/command": "^1",
Expand All @@ -31,7 +31,7 @@
"express-winston": "^4.1.0",
"fast-safe-stringify": "^2.1.1",
"file-type": "^16.5.1",
"graphql": "^14.7.0",
"graphql": "^15.3.0",
"graphql-tag": "^2.12.6",
"inquirer": "^8.1.2",
"js-image-generator": "^1.0.3",
Expand Down Expand Up @@ -138,6 +138,7 @@
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && generate:all",
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
"version": "generate:docs:cli && git add docs/cli/*",
"generate:schema:graphql": "../scripts/save-storage-squid-schema.sh src/services/networking/query-node/schema.graphql",
"generate:types:json-schema": "yarn ts-node --transpile-only ./src/schemas/scripts/generateTypes.ts",
"generate:types:graphql": "yarn graphql-codegen -c ./src/services/networking/query-node/codegen.yml",
"generate:types:public-api": "yarn openapi-typescript ./src/api-spec/public.yml -o ./src/types/generated/PublicApi.ts -c ../prettierrc.js",
Expand Down
6 changes: 3 additions & 3 deletions distributor-node/src/schemas/configSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const configSchema: JSONSchema4 = objectSchema({
endpoints: objectSchema({
description: 'Specifies external endpoints that the distributor node will connect to',
properties: {
queryNode: {
description: 'Query node graphql server uri (for example: http://localhost:8081/graphql)',
storageSquid: {
description: 'Storage-Squid graphql server uri (for example: http://localhost:4352/graphql)',
type: 'string',
format: 'uri',
},
Expand All @@ -38,7 +38,7 @@ export const configSchema: JSONSchema4 = objectSchema({
format: 'uri',
},
},
required: ['queryNode', 'joystreamNodeWs'],
required: ['storageSquid', 'joystreamNodeWs'],
}),
directories: objectSchema({
description: "Specifies paths where node's data will be stored",
Expand Down
17 changes: 14 additions & 3 deletions distributor-node/src/services/logging/LoggingService.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import axios from 'axios'
import winston, { Logger, LoggerOptions } from 'winston'
import escFormat from '@elastic/ecs-winston-format'
import { ElasticsearchTransport } from 'winston-elasticsearch'
Expand All @@ -8,6 +9,7 @@ import stringify from 'fast-safe-stringify'
import NodeCache from 'node-cache'
import path from 'path'
import 'winston-daily-rotate-file'
import { parseAxiosError } from '../parsers/errors'

const cliColors = {
error: 'red',
Expand Down Expand Up @@ -51,6 +53,15 @@ const errorFormat: (opts: ErrorFormatOpts) => Format = winston.format((info, opt
return info
})

const axiosErrorFormat = winston.format((info) => {
Object.entries(info).forEach(([key, value]) => {
if (axios.isAxiosError(value)) {
info[key] = parseAxiosError(value)
}
})
return info
})

const cliFormat = winston.format.combine(
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),
errorFormat({ filedName: 'err' }),
Expand Down Expand Up @@ -91,7 +102,7 @@ export class LoggingService {
index,
dataStream: true,
level: config.logs.elastic.level,
format: winston.format.combine(pauseFormat({ id: 'es' }), escFormat()),
format: winston.format.combine(axiosErrorFormat(), pauseFormat({ id: 'es' }), escFormat()),
retryLimit: 10,
flushInterval: 5000,
// apply custom transform so that tracing data (if present) is placed in the top level of the log
Expand Down Expand Up @@ -144,15 +155,15 @@ export class LoggingService {
maxSize: config.logs.file.maxSize,
maxFiles: config.logs.file.maxFiles,
level: config.logs.file.level,
format: winston.format.combine(pauseFormat({ id: 'file' }), escFormat()),
format: winston.format.combine(axiosErrorFormat(), pauseFormat({ id: 'file' }), escFormat()),
})
transports.push(fileTransport)
}

if (config.logs?.console) {
const consoleTransport = new winston.transports.Console({
level: config.logs.console.level,
format: winston.format.combine(pauseFormat({ id: 'cli' }), cliFormat),
format: winston.format.combine(axiosErrorFormat(), pauseFormat({ id: 'cli' }), cliFormat),
})
transports.push(consoleTransport)
}
Expand Down
Loading
Loading