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

Added Dockerfile and docker-compose for local setup #72

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BanaSeba
Copy link
Collaborator

No description provided.

@BanaSeba BanaSeba requested a review from a team as a code owner January 24, 2025 11:07
Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@BanaSeba Thanks! I'm definitely not an expert on Docker / devops stuff. So appreciate the feedback and advice from you @tk-o and @shrugs on what our next steps should be here.

Shared a few small ideas for now.

@@ -0,0 +1,11 @@
FROM node:20-slim
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps this is all good, but not sure if we should change anything here based on our .nvmrc file: https://github.com/namehash/ensnode/blob/main/.nvmrc or the version of node referenced in our root package.json: https://github.com/namehash/ensnode/blob/main/package.json#L38-L40

Ideally these would all be in total alignment.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we should support the oldest version possible, but use the active LTS version. There's no point in voluntarily using outdated software.

Copy link
Contributor

Choose a reason for hiding this comment

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

agree this should be 18 for now, but truthfully we should be able to update everything to run on 20. if we do so we'll want to do that as a single pr, updating nvmrc, engines fields, and docker bases at once. i've added an issue for that in the prject.

- postgres

postgres:
image: postgres:15
Copy link
Member

Choose a reason for hiding this comment

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

Currently in Railway I see we're using:

CleanShot 2025-01-24 at 15 49 09

Is there some reason why this is different?

Copy link
Contributor

@shrugs shrugs Jan 24, 2025

Choose a reason for hiding this comment

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

def should be 16, could be even later, but let's stay with 16 for now

@@ -0,0 +1,28 @@
services:

indexer:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
indexer:
ensnode:

Copy link
Contributor

Choose a reason for hiding this comment

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

agree, call it ensnode for now, but imo we'll rename the ensnode service to something like indexer or onchain-indexer in the future, since ensnode is now the collection of services. i've added an issue to track this as well.

@BanaSeba BanaSeba changed the title Added Dockerfile and docker-compose for local setup [Draft] Added Dockerfile and docker-compose for local setup Jan 24, 2025
@BanaSeba BanaSeba marked this pull request as draft January 24, 2025 12:43
@BanaSeba BanaSeba changed the title [Draft] Added Dockerfile and docker-compose for local setup Added Dockerfile and docker-compose for local setup Jan 24, 2025
ports:
- "8080:42069"
env_file:
- .env.docker
Copy link
Contributor

Choose a reason for hiding this comment

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

Would using the .env.local file work here? It was meant to be loaded in to the indexer runtime. Let me know what you think 🙃

Copy link
Contributor

Choose a reason for hiding this comment

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

agree, would like to know reason for .env.docker

@lightwalker-eth
Copy link
Member

@shrugs Also I remember you shared some concerns 1-2 weeks about about us introducing Docker into the project at that time. Do you still have a concern on that? If so, could you please share more details with your advice and suggestions? Much appreciated! Thanks!

Sebastian will be on holiday for the coming week. @shrugs @tk-o If either of you guys have suggestions for the general direction @BanaSeba takes here, please share advice in a comment.

Please also note the advice I already shared with @BanaSeba in this Slack thread: https://namehash.slack.com/archives/C086Z6FNBHN/p1737717125731929

@shrugs
Copy link
Contributor

shrugs commented Jan 24, 2025

project is now multi-service, so docker is fine solution. i still worry about logistics-creep but it's the right time to add

@@ -0,0 +1 @@
.env*
Copy link
Contributor

Choose a reason for hiding this comment

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

editor EOF configuration, please automatically include newlines on save


volumes:
postgres_data:
driver: local
Copy link
Contributor

Choose a reason for hiding this comment

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

editor EOF

RUN pnpm install --prod --frozen-lockfile

EXPOSE 8000
CMD [ "pnpm", "start" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

editor EOF


RUN pnpm install --prod --frozen-lockfile

EXPOSE 8000
Copy link
Contributor

Choose a reason for hiding this comment

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

expose 8000 here but mapping 8080:42069 in compose?

context: .
dockerfile: Dockerfile
ports:
- "8080:42069"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rely on the ponder defaults and instead of specifying a port to that container we just map 42069:42069?

ports:
- "8080:42069"
env_file:
- .env.docker
Copy link
Contributor

Choose a reason for hiding this comment

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

agree, would like to know reason for .env.docker

@@ -12,6 +12,8 @@ yarn-error.log*

# Env files
.env*.local
.env.docker
.env
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't need .env file, use .env.local

@lightwalker-eth
Copy link
Member

@BanaSeba Hey, while you were on holiday this week we've moved to a monorepo and also created a docker setup for the new ensrainbow app.

How do you suggest we take next steps here now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops DevOps related
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants