From 14eaf6824cc62efdf48f80ad65ae8c03b112b603 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 18 Jul 2021 03:11:04 +0200 Subject: [PATCH] Feat: Experimental workaround for dockerized rpcdaemon in Local-Mode. Fix some permissions issues in docker containers. --- Makefile | 2 +- README.md | 6 +++--- docker-compose.yml | 10 +++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 01baa0d6a76..bec40ee6de7 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ docker: docker build -t turbo-geth:latest --build-arg git_commit='${GIT_COMMIT}' --build-arg git_branch='${GIT_BRANCH}' --build-arg git_tag='${GIT_TAG}' . docker-compose: - docker-compose up + UID_GID=$(shell id -u):$(shell id -g) docker-compose up # debug build allows see C stack traces, run it with GOTRACEBACK=crash. You don't need debug build for C pit for profiling. To profile C code use SETCGOTRCKEBACK=1 dbg: diff --git a/README.md b/README.md index b41569ae183..da613653ccb 100644 --- a/README.md +++ b/README.md @@ -306,10 +306,10 @@ If genesis sync passed, then it's fine to run multiple Erigon on same Disk. Please read https://github.com/ledgerwatch/erigon/issues/1516#issuecomment-811958891 In short: network-disks are bad for blocks execution - because blocks execution reading data from db non-parallel non-batched way. -### rpcdaemon "Local-Mode" does not work with Docker Container +### rpcdaemon "Local-Mode" experimentally working with docker-compose Running rpcdaemon in "Local-Mode" (including the `--datadir` flag) generally results in better performance for -RPC calls, however, this does not work when running erigon and rpcdaemon in separate containers and datadir as volume. -But it works fine if run erigon and rpcdaemon in same container. +RPC calls. By sharing the PID namespace for both containers, it's possible now to run erigon and rpcdaemon in separate containers and datadir as volume. +You can start up the whole stack with the following command: `make docker-compose` For the absolute best performance bare metal is recommended at this time. Please, help us configure Docker volume driver to support MMAP files with POSIX file-locks (MDBX). diff --git a/docker-compose.yml b/docker-compose.yml index 5d1b0b88013..4027d50f4b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,8 +4,10 @@ services: erigon: image: thorax/erigon:latest + user: ${UID_GID:-1000:1000} build: . command: erigon --datadir=/var/lib/erigon --metrics --metrics.addr=0.0.0.0 --metrics.port=6060 --private.api.addr=0.0.0.0:9090 --pprof --pprof.addr=0.0.0.0 --pprof.port=6061 + pid: host volumes: - ${XDG_DATA_HOME:-~/.local/share}/erigon:/var/lib/erigon ports: @@ -17,6 +19,7 @@ services: prometheus: image: prom/prometheus:v2.28.1 + user: ${UID_GID:-1000:1000} command: --log.level=warn --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus --web.console.libraries=/usr/share/prometheus/console_libraries --web.console.templates=/usr/share/prometheus/consoles ports: - "9090:9090" @@ -27,6 +30,7 @@ services: grafana: image: grafana/grafana:8.0.6 + user: ${UID_GID:-1000:1000} ports: - "3000:3000" volumes: @@ -38,7 +42,11 @@ services: rpcdaemon: image: thorax/erigon:latest - command: rpcdaemon --private.api.addr=erigon:9090 --http.addr=0.0.0.0 --http.vhosts=* --http.corsdomain=* --http.api=eth,debug,net + user: ${UID_GID:-1000:1000} + command: rpcdaemon --datadir /var/lib/erigon --private.api.addr=erigon:9090 --http.addr=0.0.0.0 --http.vhosts=* --http.corsdomain=* --http.api=eth,debug,net + pid: host + volumes: + - ${XDG_DATA_HOME:-~/.local/share}/erigon:/var/lib/erigon ports: - "8545:8545" restart: unless-stopped