-
Notifications
You must be signed in to change notification settings - Fork 411
Dockerfile rewrite for ElectrumX 1.18.0 #324
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
base: master
Are you sure you want to change the base?
Conversation
contrib/Dockerfile
Outdated
| @@ -1,48 +1,35 @@ | |||
| # example of Dockerfile that installs spesmilo electrumx 1.16.0 | |||
| # ENV variables can be overridden on the `docker run` command | |||
| FROM python:3.10.14-bullseye | |||
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.
Could you use Python 3.14? It would provide better performance and wouldn't need to be updated anytime soon again, making the Dockerfile more "future proof".
contrib/Dockerfile
Outdated
| WORKDIR /usr/src/app | ||
|
|
||
| # Install the libs needed by rocksdb (including development headers) | ||
| # Install all dependencies (build + runtime) for rocksdb |
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.
this still says rocksdb
| && venv/bin/pip install --no-cache-dir e-x[rapidjson,rocksdb]==1.16.0 | ||
|
|
||
| # Copy the entire electrumx source tree | ||
| COPY . /electrumx |
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.
This makes the Dockerfile depend on the repository being available while the previous Dockerfile would fetch e-x from PyPI and work independently of the repository. What is your reasoning behind this change? I think its nice to have encapsulated Dockerfile so it doesn't depend on files being available on the host system.
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.
note: my local Dockerfile has stuff like this:
ARG ELECTRUMX_VERSION=fb28dc2d3d9facb08c861691793dcf749b6f0c44
RUN python3 -m pip install git+https://github.com/sombernight/electrumx.git@${ELECTRUMX_VERSION}#egg=e_x[rocksdb,dev]
Point being, you don't need a git clone even for running HEAD.
|
|
||
| CMD ["/usr/src/app/venv/bin/python", "/usr/src/app/venv/bin/electrumx_server"] | ||
|
|
||
| # build it with eg.: `docker build -t electrumx .` |
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.
Can we keep these examples/docs in the Dockerfile? They seem useful.
|
Thanks for the PR. |
|
Thank you for reviewing, these are great points! I'll respond in a single message to the reviews: --- Main structural change: --- Docker context: Command line for building (run this inside the "electrumx/contrib" directory): --- RocksDB and LevelDB --- Other small changes:
So these are my two cents. My motivation for rewriting the Dockerfile was that I couldn't build from the source code that I had git cloned in the parent directory and it was not clear how to do that. |
|
|
||
| VOLUME /var/lib/electrumx | ||
|
|
||
| RUN mkdir -p "$DB_DIRECTORY" && ulimit -n 1048576 |
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 you sure raising the ulimit can be removed? I think it is needed for busy servers that serve lots of clients.
Alternatively it can also be specified as part of docker run: e.g. $ docker run --ulimit nofile=131072:131072
see
Lines 118 to 126 in 592c4dc
| Process limits | |
| -------------- | |
| You must ensure the ElectrumX process has a large open file limit. | |
| During sync it should not need more than about 1,024 open files. When | |
| serving it will use approximately 256 for LevelDB plus the number of | |
| incoming connections. It is not unusual to have 1,000 to 2,000 | |
| connections being served, so I suggest you set your open files limit | |
| to at least 2,500. |
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.
Good point, I am not sure. My deployment does not serve many clients as well we do not run electrumx on huge chain
Hello,
I had issues building Docker image so I rewrote and simplified the Dockerfile.
Related PR #314
Best,
Tomas