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

feat: indexer service #1

Merged
merged 4 commits into from
Oct 4, 2024
Merged

feat: indexer service #1

merged 4 commits into from
Oct 4, 2024

Conversation

0xkenj1
Copy link
Collaborator

@0xkenj1 0xkenj1 commented Oct 2, 2024

🤖 Linear

Closes GIT-30 GIT-31 GIT-50 GIT-51

Description

Adds indexer service, docker file for the indexer process from envio, base docker-compose for the full app , docs and last but not least an important test that ensures that all the events from envio config.yaml file are handled.

Checklist before requesting a review

  • I have conducted a self-review of my code.
  • I have conducted a QA.
  • If it is a core feature, I have included comprehensive tests.

@0xkenj1 0xkenj1 requested review from 0xnigir1 and 0xyaco October 2, 2024 19:22
Copy link
Collaborator

@0xnigir1 0xnigir1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few smol comments

.npmrc Outdated
shamefully-hoist=true
# Needed so users can run `pnpm install` in the root of the repo without requiring the `-w` flag.
ignore-workspace-root-check=true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like the necessity of adding the -w flag so you don't mistakenly install a dep globally when it should specific to a package/app

address:
- 0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3

- id: 10 # optimism
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we sync all chains but only consume one for the MVP?

"yaml": "2.5.1"
},
"devDependencies": {
"@types/chai": "^4.3.11",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove carets ^ (why the .npmrc config didn't work here 🤔 )

"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"module": "CommonJS"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is because of the issue you mentioned offline regarding envio deps right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, lets be flexible here :)

const eventHandlers = loadYaml(yamlFilePath);
const handlerFunctions = loadHandlerFunctions(handlersDir);

assert.equal(compareEventsAndHandlers(eventHandlers, handlerFunctions), false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💎 byutiful, maybe we can make this a script instead of part of a test suite wdyt? just a thought

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, initially was a script, but wanted to integrate it to the ci/cd pipeline as fast as possible 🤣

Finally i left it as a test, but i will add a TODO comment to migrate it to a Github workflow as a script, because this checks will grow in the future.

- "5433:5432"
volumes:
- db_data:/var/lib/postgresql/data
environment:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO for the env vars

Copy link
Collaborator

@0xyaco 0xyaco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments, looking good

COPY . /app
WORKDIR /app

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the target= point to $PNPM_HOME/store?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm dlx envio codegen

CMD pnpm dlx envio local db-migrate setup && pnpm dlx envio start
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to ask, do we want to db-migrate setup the DB whenever a new container boots up? The docs say that it drops the schema before running all migrations.

If this is going to be used during dev only, we could rename this Dockerfile to Dockerfile.dev

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, i think we can replace it like this

Suggested change
CMD pnpm dlx envio local db-migrate setup && pnpm dlx envio start
CMD pnpm dlx envio local db-migrate up && pnpm dlx envio start

and won't drop older tables i think.

Lets keep Dockerfile name as it is, if we need to improve it or create a new one in the future we can rename it :)

@0xkenj1 0xkenj1 requested review from 0xnigir1 and 0xyaco October 3, 2024 17:29
@0xkenj1 0xkenj1 merged commit 8500783 into dev Oct 4, 2024
6 checks passed
@0xkenj1 0xkenj1 deleted the feat/indexer-service branch October 4, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants