-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add Discovery Apollo GraphQL server #5145
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff! I do think we should look into how to make this a discovery plugin, since that's the pattern other new things are following
sourceType: 'module' | ||
}, | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': 'off', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be nice to use shared eslint once monorepo is a thing!
// } | ||
|
||
// type Track { | ||
// blocknumber: Int! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, thanks for creating schemas for all these already!
@@ -30,6 +29,7 @@ x-common: | |||
- "audius-protocol-storagev2-1:host-gateway" | |||
- "audius-protocol-storagev2-2:host-gateway" | |||
- "audius-protocol-storagev2-3:host-gateway" | |||
- "audius-protocol-discovyer-provider-graphql:host-gateway" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "audius-protocol-discovyer-provider-graphql:host-gateway" | |
- "audius-protocol-discovery-provider-graphql:host-gateway" |
// type TrackSegment { | ||
// duration: String! | ||
// multihash: String! | ||
// } | ||
|
||
// type Followee { | ||
// user: User! | ||
// is_delete: Boolean! | ||
// repost_item_id: String! | ||
// repost_type: String! | ||
// } | ||
|
||
// type Download { | ||
// is_downloadable: Boolean | ||
// requires_follow: Boolean | ||
// cid: String | ||
// } | ||
|
||
// type FieldVisibility { | ||
// genre: Boolean! | ||
// mood: Boolean! | ||
// tags: Boolean! | ||
// share: Boolean! | ||
// play_count: Boolean! | ||
// remixes: Boolean! | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! did you generate these using a tool or are they hand written?
const dbConfig = { | ||
client: 'pg', | ||
connection: { | ||
host: 'db', | ||
port: 5432, | ||
user: 'postgres', | ||
password: 'postgres', | ||
database: 'audius_discovery' | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it may be simpler to use a connection string like our other knex/ts apps, that way if any of the configuration changes it's only in the url, plus you can gather it right from the discovery .env file
example of how the notifications plugin does it:
https://github.com/AudiusProject/audius-protocol/blob/main/discovery-provider/plugins/notifications/src/conn.ts
.where('is_current', true) | ||
|
||
if (res.length !== 1) { | ||
throw new Error('Expected SINGLE row in blocks marked as current') | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add a .first()
here and avoid this check as well as the throwing
https://knexjs.org/guide/query-builder.html#first
|
||
export const DiscoveryDB = (dbConnection: Knex) => { | ||
const blockConfirmationDataLoader = new DataLoader( | ||
async (blockNumbers: readonly number[]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm curious, is the readonly
annotation required for GQL queries?
"knex": "2.4.2", | ||
"lodash": "4.17.21", | ||
"pg": "8.10.0", | ||
"sequelize": "6.31.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are knex and sequelize both required? seems like sequelize could be removed
@@ -310,6 +311,7 @@ def load_env(protocol_dir, service, environment): | |||
@click.option( | |||
"--no-solana", is_flag=True, help="Don't bring up solana-test-validator container" | |||
) | |||
@click.option("--no-graphql", is_flag=True, help="Don't bring up graphql container") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know this kind of goes against the established pattern but shouldn't the default here be to not start up the gql container? that way we have to explicitly bring it up until it's ready for release, that also would avoid the need for other to pass this flag just to run their local stack
ARG git_sha | ||
ARG audius_loggly_disable | ||
ARG audius_loggly_token | ||
ARG audius_loggly_tags | ||
|
||
ENV GIT_SHA=$git_shas | ||
ENV audius_loggly_disable=$audius_loggly_disable | ||
ENV audius_loggly_token=$audius_loggly_token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we use loggly anymore?
Description
-Add new container containing an apollo graphql server to be run on discovery nodes
Tests
Monitoring - How will this change be monitored? Are there sufficient logs / alerts?