ethd update reports error when two different checkouts use reth
tristan opened this issue · 1 comments
I have two checkouts of the eth-docker project while i'm testing out performance of different execution nodes on my setup.
eth-docker
as the main setup, running validators, and eth-docker-sync-only
with only consensus and execution which I used to keep a 2nd execution node up to date.
What i've been doing, is symlinking the volumes created for the two setups together, so I can sync with the eth-docker-sync-only
then just edit the .envs
of each setup to swap the execution nodes, and ./ethd up
them.
e.g.
$ sudo ls -al /var/lib/docker/volumes | grep 'reth\|nm-eth1'
drwx-----x 3 root root 4096 Apr 28 09:00 eth-docker_nm-eth1-data
drwx-----x 3 root root 4096 Mar 18 07:36 eth-docker_reth-el-data
lrwxrwxrwx 1 root root 23 Apr 28 09:03 eth-docker-sync-only_nm-eth1-data -> eth-docker_nm-eth1-data
lrwxrwxrwx 1 root root 23 Apr 9 13:06 eth-docker-sync-only_reth-el-data -> eth-docker_reth-el-data
drwx-----x 3 root root 4096 Apr 11 16:24 reth-el-data
This works fine, however, when running ./ethd update
with this setup, I now get:
docker: Error response from daemon: create eth-docker-sync-only_reth-el-data
eth-docker_reth-el-data
reth-el-data: "eth-docker-sync-only_reth-el-data\neth-docker_reth-el-data\nreth-el-data" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.
./ethd terminated with exit code 125 on line 697
This happened during ./ethd update
The problem is because the reth db version check has $(dodocker volume ls -q -f "name=reth-el-data")
and this command now returns 3 lines, which get included in the follow up command that expects a single volume name.
The following change fixes it for me:
diff --git a/ethd b/ethd
index 7106227..e2d6a57 100755
--- a/ethd
+++ b/ethd
@@ -693,7 +693,7 @@ delete_reth() {
fi
# Check Reth db version
- __db_version="$(dodocker run --rm -v "$(dodocker volume ls -q -f "name=reth-el-data")":"/var/lib/reth" \
+ __db_version="$(dodocker run --rm -v "$(dodocker volume ls -q -f "name=$(basename "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")_reth-el-data")":"/var/lib/reth" \
alpine:3 cat /var/lib/reth/db/database.version)"
if [ "${__db_version}" -ne "1" ]; then
return 0
but I think there's a lot more cases where this could happen (not just with reth), and I'm not familiar enough with the script to be confident in saying this is the right solution or that it wont break something else to make a PR myself (nor do I have the time to spend on making a good PR unfortunately).
Interesting. Thanks for finding this. I'll take a look