erigon-pulse/docker-compose.yml
Cory 74cf9840ae
Patch plumbing of docker-compose UID/GID build args (#4527)
* Patch plumbing of docker-compose UID/GID build args

* Fallback to 1000/1000 if DOCKER_(U|G)ID not set

* Revise README.md instructions for docker further

* Fix existing typo forc 'servie' -> 'service'

* Rename PUID/GUID -> UID/GID

* Specify user in erigon docker service

* Rely on .env instead of specifying :-1000

* Polish Makefile for docker use case

* one more helpful comment

* make docker should use UID/GID --build-arg

* Fix make docker and more fail-fast if envvar set incorrect

* mv .env->.env.example to not intefere existing workflows

* Specify envvars in docker CI

* Adjust validate_docker_build_args to permit non-erigon user

* Also run docker CI target on macos-11 os

* Add DOCKER_UID, DOCKER_GID in hooks/build

* Patch docker build arg validation for macos

* Add actions-setup-docker@master for macos

* Don't run automated test for docker macos

* Cleanup Makefile

* Comments, targets for erigon users

* More Makefile cleanup, debugging still

* Typo fix

* Create subdirs before calling ls

* Get rid of flaky validation

* DOCKER_UID, DOCKER_GID init to runner if not set

* Get rid of unnecessary variable for now

* Improved README based on new changes

* Proper uid/gid `make user_*` when no envars set

* Fix typo in Makefile comment

* Fix make docker as sudo user
2022-06-30 16:11:37 +06:00

89 lines
3.8 KiB
YAML

# Erigon by default is "all in one binary" solution, but it's possible start TxPool as separated processes.
# Same true about: JSON RPC layer (RPCDaemon), p2p layer (Sentry), history download layer (Downloader), consensus.
# Don't start services as separated processes unless you have clear reason for it: resource limiting, scale, replace by your own implementation, security.
# This file is an example: how to start Erigon's services as separated processes.
# Default: --datadir=/home/erigon/.local/share/erigon
# Default UID: 3473
# Default GID: 3473
# Ports: `9090` execution engine (private api), `9091` sentry, `9092` consensus engine, `9093` snapshot downloader, `9094` TxPool
# Ports: `8545` json rpc, `8551` consensus json rpc, `30303` eth p2p protocol, `42069` bittorrent protocol,
# Connections: erigon -> (sentries, downloader), rpcdaemon -> (erigon, txpool), txpool -> erigon
version: '2.2'
# Basic erigon's service
x-erigon-service: &default-erigon-service
image: thorax/erigon:${TAG:-latest}
pid: service:erigon # Use erigon's PID namespace. It's required to open Erigon's DB from another process (RPCDaemon local-mode)
volumes_from: [ erigon ]
restart: unless-stopped
mem_swappiness: 0
services:
erigon:
image: thorax/erigon:${TAG:-latest}
build:
args:
UID: ${DOCKER_UID}
GID: ${DOCKER_GID}
context: .
user: "${DOCKER_UID}:${DOCKER_GID}"
command: |
erigon ${ERIGON_FLAGS-} --private.api.addr=0.0.0.0:9090
--sentry.api.addr=sentry:9091 --downloader.api.addr=downloader:9093 --txpool.disable
--metrics --metrics.addr=0.0.0.0 --metrics.port=6060 --pprof --pprof.addr=0.0.0.0 --pprof.port=6061
volumes:
# It's ok to mount sub-dirs of "datadir" to different drives
- ${XDG_DATA_HOME:-~/.local/share}/erigon:/home/erigon/.local/share/erigon
restart: unless-stopped
mem_swappiness: 0
sentry:
<<: *default-erigon-service
command: sentry ${SENTRY_FLAGS-} --sentry.api.addr=0.0.0.0:9091
ports: [ "30303:30303/tcp", "30303:30303/udp" ]
downloader:
<<: *default-erigon-service
command: downloader ${DOWNLOADER_FLAGS-} --downloader.api.addr=0.0.0.0:9093
ports: [ "42069:42069/tcp", "42069:42069/udp" ]
txpool:
<<: *default-erigon-service
command: txpool ${TXPOOL_FLAGS-} --private.api.addr=erigon:9090 --txpool.api.addr=0.0.0.0:9094
rpcdaemon:
<<: *default-erigon-service
command: |
rpcdaemon ${RPCDAEMON_FLAGS-} --http.addr=0.0.0.0 --http.vhosts=* --http.corsdomain=* --ws
--private.api.addr=erigon:9090 --txpool.api.addr=txpool:9094
--authrpc.jwtsecret=/home/erigon/.local/share/erigon/jwt.hex
ports: [ "8545:8545" ] # "8551:8551"
prometheus:
image: prom/prometheus:v2.36.0
user: ${DOCKER_UID}:${DOCKER_GID} # Uses erigon user from Dockerfile
command: --log.level=warn --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus --storage.tsdb.retention.time=150d --web.console.libraries=/usr/share/prometheus/console_libraries --web.console.templates=/usr/share/prometheus/consoles
ports: [ "9090:9090" ]
volumes:
- ${ERIGON_PROMETHEUS_CONFIG:-./cmd/prometheus/prometheus.yml}:/etc/prometheus/prometheus.yml
- ${XDG_DATA_HOME:-~/.local/share}/erigon-prometheus:/prometheus
restart: unless-stopped
grafana:
image: grafana/grafana:8.5.4
user: ${DOCKER_UID}:${DOCKER_GID} # Uses erigon user from Dockerfile
ports: [ "3000:3000" ]
volumes:
- ${ERIGON_GRAFANA_CONFIG:-./cmd/prometheus/grafana.ini}:/etc/grafana/grafana.ini
- ./cmd/prometheus/datasources:/etc/grafana/provisioning/datasources
- ./cmd/prometheus/dashboards:/etc/grafana/provisioning/dashboards
- ${XDG_DATA_HOME:-~/.local/share}/erigon-grafana:/var/lib/grafana
restart: unless-stopped