Open schildbach opened 3 years ago
AFAIK none of the active contributors here seriously use Docker (sorry @romanz if I misunderstood). It'd be best if you or some other docker-experienced person makes a PR.
There's also a Debian repository with Bitcoin packages which does a better job at orchestrating dependencies, IMO. :) (You could say I'm biased but I made it specifically because I was dissatisfied with Docker...) The wording is outdated and overly scary - it's no longer experimental, but beta. I have a WIP PR to fix that but it got blocked on some details.
I don't use docker for running electrs personally - but PRs are welcome :)
I'm sharing the part of the docker-compose.yml that already works:
electrs:
image: electrs-app
depends_on:
- bitcoind
volumes:
- "${ELECTRS_DATA_DIR}:/home/user/db/testnet"
ports:
- "51001:51001"
command: electrs
environment:
- ELECTRS_NETWORK=testnet
- ELECTRS_VERBOSE=3
- ELECTRS_ELECTRUM_RPC_ADDR=electrs:51001
- ELECTRS_DAEMON_RPC_ADDR=bitcoind:18332
- ELECTRS_COOKIE_FILE=/run/secrets/bitcoind_rpc_cookie
- ELECTRS_JSONRPC_IMPORT=true
secrets:
- bitcoind_rpc_cookie
${ELECTRS_DATA_DIR} needs to be replaced by your volume to contain the database.
The secret containing the RPC cookie can be defined like this:
secrets:
bitcoind_rpc_cookie:
file: ./bitcoind_rpc_cookie
Important: The cookie file should not contain any newlines, not even at the end. Maybe electrs should sanitize the cookie?
I'm currently working on using Traefik to provide SSL to electrs, but I'm stuck. Has anyone already done this?
bitcoind
already stores the cookie without newline, so it should be correct. Unless docker does something idiotic like appending newlines to files. But I've been told Docker is perfect and solves all problems, so that shouldn't happen. ;)
@Kixunil It seems like you presume the cookie is created with bitcoind, which is not the case for me. I used rpcauth.py
(comes with Bitcoin Core), and you have to scrape the cookie from screen as it doesn't create the file for you. WIth this step, it's easy to accidently introduce a newline after the cookie.
Actually I'd really like to let bitcoind create the cookie. However since bitcoind and electrs are running as different users, even in different containers, I did not find a way to make the secure transmission of the cookie work. If you've got an idea on how to do this, let me know.
Ah, interesting. I'm not a Docker expert but I was looking at something related in BTCPayServer-docker recently and they seem to managed to do exactly that (by sharing volumes), so I suggest looking at it.
Sorry for the delayed response... please take a look at: https://github.com/lukechilds/electrs-next/blob/master/docker-compose.yml cc: @lukechilds
@schildbach Could you please try latest v0.9.0
release?
Chances are that people who use the dockerized version of electrs are already using bitcoind within a docker container. An easy way to orchestrate containers with depencencies is docker-compose. I'd suggest to provide an example for this – like many other dockerized projects do.