From 270cf1d7366f4efa378f9d192de957a676f62494 Mon Sep 17 00:00:00 2001 From: reverse hash <11018433+reverse-hash@users.noreply.github.com> Date: Sun, 9 Jun 2024 22:36:21 +0200 Subject: [PATCH] V2024.6 * Add USER_ID param and update some services * Add gitignore --- .env.example | 34 +++++++++++++------ .gitignore | 1 + GETTING_STARTED.md | 2 ++ README.md | 8 ++--- bitcoind/Dockerfile | 4 ++- .../Dockerfile | 5 +-- docker-compose.yml | 8 +++-- electrs/Dockerfile | 3 +- tor/Dockerfile | 3 +- 9 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 .gitignore rename {btc-rpc-explorer => btcrpcexplorer}/Dockerfile (84%) diff --git a/.env.example b/.env.example index e3ade34..cc146bf 100644 --- a/.env.example +++ b/.env.example @@ -1,26 +1,34 @@ +# Group identifier for file sharing betweenthe local machine and the containers. +# Check the installation documentation for more details. +SHARED_GID=1099 + # Tor expert bundle version and platform to build the container. # To be obtained from this site: https://gitweb.torproject.org/tor.git # Example: tor-0.4.8.10 -TOR_VERSION=0.4.8.11 -TOR_DATA=./volumes/tor +TOR_VERSION=0.4.8.12 -# Group identifier for file sharing betweenthe local machine and the containers. -# Check the installation documentation for more details. -SHARED_GID=1099 +# User identifier used for tor inside the container +TOR_USER_ID=1099 + +# Directory on the host machine where to moutn the data volume for tor +TOR_DATA=./volumes/tor # Bitcoin core version and platform to build the container. # To be obtained from this site: https://github.com/bitcoin/bitcoin/releases # Example: bitcoin-v26.0 -BITCOIN_VERSION=27.0 +BITCOIN_VERSION=26.1 # Directory on the local machine where to mount the data volume for bitcoin # core (where the blockchain, indexes and configuration will be stored) BITCOIN_DATA=./volumes/bitcoind +# User identifier used for bitcoin inside the container +BITCOIN_USER_ID=1099 + # Electrs version to build the container. # To be obtained from this site: https://github.com/romanz/electrs/releases # Example: v0.10.1 -ELECTRS_VERSION=0.10.4 +ELECTRS_VERSION=0.10.5 # Port on the local machine where to bind Electrs ELECTRS_SSL_PORT=50002 @@ -28,16 +36,22 @@ ELECTRS_SSL_PORT=50002 # Directory on the local machine where to mount the data volume for electrs ELECTRS_DATA=./volumes/electrs +# User identifier used for electrs inside the container +ELECTRS_USER_ID=1099 + # BTC Explorer to build the container. # To be obtained from this site: https://github.com/janoside/btc-rpc-explorer/releases # Example: v3.3.0.tar.gz (3.3.0) BTC_RPC_EXPLORER_VERSION=3.4.0 -# Port on the local machine where to bind BTC Explorer +# Port on the local machine where to bind btc explorer BTC_RPC_EXPLORER_HTTPS_PORT=3003 -# Directory on the local machine where to mount the data for BTC Explorer +# Directory on the local machine where to mount the data for btc explorer BTC_RPC_EXPLORER_DATA=./volumes/btc-rpc-explorer -# Directory on the local machine where to mount the data for NGINX +# User identifier used for btc explorer inside the container +BTC_RPC_EXPLORER_USER_ID=1099 + +# Directory on the local machine where to mount the data for ngix NGINX_DATA=./volumes/nginx diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index ad2aabd..fc29854 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -89,6 +89,8 @@ BTC_RPC_EXPLORER_DATA=/mnt/hdd/btcrpcexplorer NGINX_DATA=/mnt/hdd/nginx ``` +Optionally, the user id of each service can be adjusted to match the user id of the host machine. Generally, this is not necessary as being in the same group is usually sufficient. However, some users have reported permission issues when accessing volume files in certain environments. + ## Running services for the first time For the first installation, we recommend starting the services one at a time. Take your time to verify by yourself the `Dockerfiles` and validate that the services are being deployed correctly. diff --git a/README.md b/README.md index 48131ef..d5bd366 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,10 @@ The following services are deployed: | Container | Service | Base image | Size | | -------------- | ---------------------------- | ------------------ | -------- | -| tor | Tor 0.4.8.11 | debian:stable-slim | 83.2 MB | -| bitcoind | Bitcoin core daemon 26.0 | debian:stable-slim | 80.2 MB | -| electrs | Electrum rust service 0.10.4 | debian:stable-slim | 82.85 MB | -| btcrpcexplorer | Bitcoin explorer 3.4.0 | node:16-slim | 333 MB | +| tor | Tor 0.4.8.12 | debian:stable-slim | 83.2 MB | +| bitcoind | Bitcoin core daemon 26.1 | debian:stable-slim | 80.2 MB | +| electrs | Electrum rust service 0.10.5 | debian:stable-slim | 82.85 MB | +| btcrpcexplorer | Bitcoin RPC Explorer 3.4.0 | node:22-slim | 366 MB | | nginx | NGINX stable | nginx:alpine-slim | 11.5 MB | ## Documentation diff --git a/bitcoind/Dockerfile b/bitcoind/Dockerfile index ff2a088..06408aa 100644 --- a/bitcoind/Dockerfile +++ b/bitcoind/Dockerfile @@ -5,6 +5,7 @@ RUN apt-get update \ && cd /tmp \ && wget https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/achow101.gpg \ && wget https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/fanquake.gpg \ + && wget https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/glozow.gpg \ && wget https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/guggero.gpg \ && wget https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/hebasto.gpg \ && wget https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/theStack.gpg \ @@ -40,10 +41,11 @@ RUN apt-get update \ FROM debian:stable-slim +ARG BITCOIN_USER_ID ARG GROUP_ID COPY --from=build /tmp/bitcoin/src/bitcoind /usr/local/bin/bitcoind RUN addgroup --gid ${GROUP_ID} bitcoin \ - && adduser --disabled-password --gecos "" --ingroup bitcoin bitcoin \ + && adduser -u ${BITCOIN_USER_ID} --disabled-password --gecos "" --ingroup bitcoin bitcoin \ && mkdir /home/bitcoin/.bitcoin \ && chown bitcoin:bitcoin /home/bitcoin/.bitcoin diff --git a/btc-rpc-explorer/Dockerfile b/btcrpcexplorer/Dockerfile similarity index 84% rename from btc-rpc-explorer/Dockerfile rename to btcrpcexplorer/Dockerfile index ad5bc73..c7b671a 100644 --- a/btc-rpc-explorer/Dockerfile +++ b/btcrpcexplorer/Dockerfile @@ -11,11 +11,12 @@ RUN apk add --update --no-cache git gpg gpg-agent nodejs npm python3 wget \ && apk del git gpg gpg-agent nodejs npm python3 wget -FROM node:16-slim +FROM node:22-slim +ARG BTC_RPC_EXPLORER_USER_ID ARG GROUP_ID COPY --from=build /opt/btc-rpc-explorer /opt/btc-rpc-explorer RUN addgroup --gid $GROUP_ID btcrpcexplorer \ - && adduser --disabled-password --gecos "" --ingroup btcrpcexplorer btcrpcexplorer \ + && adduser -u ${BTC_RPC_EXPLORER_USER_ID} --disabled-password --gecos "" --ingroup btcrpcexplorer btcrpcexplorer \ && mkdir /home/btcrpcexplorer/.config \ && chown btcrpcexplorer:btcrpcexplorer /home/btcrpcexplorer/.config \ && cd /opt/btc-rpc-explorer diff --git a/docker-compose.yml b/docker-compose.yml index 5691a5f..f232c6b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: context: ./tor args: - TOR_VERSION=$TOR_VERSION + - TOR_USER_ID=$TOR_USER_ID - GROUP_ID=$SHARED_GID volumes: - $TOR_DATA:/home/tor @@ -21,6 +22,7 @@ services: context: ./bitcoind args: - BITCOIN_VERSION=$BITCOIN_VERSION + - BITCOIN_USER_ID=$BITCOIN_USER_ID - GROUP_ID=$SHARED_GID volumes: - $BITCOIN_DATA:/home/bitcoin/.bitcoin @@ -36,6 +38,7 @@ services: context: ./electrs args: - ELECTRS_VERSION=$ELECTRS_VERSION + - ELECTRS_USER_ID=$ELECTRS_USER_ID - GROUP_ID=$SHARED_GID volumes: - $BITCOIN_DATA:/home/electrs/.bitcoin @@ -45,14 +48,15 @@ services: default: ipv4_address: 172.18.0.4 btcrpcexplorer: - image: btc-rpc-explorer:$BTC_RPC_EXPLORER_VERSION + image: btcrpcexplorer:$BTC_RPC_EXPLORER_VERSION depends_on: - bitcoind - electrs build: - context: ./btc-rpc-explorer + context: ./btcrpcexplorer args: - BTC_RPC_EXPLORER_VERSION=$BTC_RPC_EXPLORER_VERSION + - BTC_RPC_EXPLORER_USER_ID=$BTC_RPC_EXPLORER_USER_ID - GROUP_ID=$SHARED_GID volumes: - $BTC_RPC_EXPLORER_DATA:/home/btcrpcexplorer/.config diff --git a/electrs/Dockerfile b/electrs/Dockerfile index 9102bd4..cd9d31a 100644 --- a/electrs/Dockerfile +++ b/electrs/Dockerfile @@ -13,10 +13,11 @@ RUN apt-get update \ FROM debian:stable-slim +ARG ELECTRS_USER_ID ARG GROUP_ID COPY --from=build /tmp/electrs/target/release/electrs /usr/local/bin/electrs RUN addgroup --gid ${GROUP_ID} electrs \ - && adduser --disabled-password --gecos "" --ingroup electrs electrs \ + && adduser -u ${ELECTRS_USER_ID} --disabled-password --gecos "" --ingroup electrs electrs \ && mkdir /home/electrs/.electrs \ && chown electrs:electrs /home/electrs/.electrs diff --git a/tor/Dockerfile b/tor/Dockerfile index dbac77f..2c61edf 100644 --- a/tor/Dockerfile +++ b/tor/Dockerfile @@ -26,9 +26,10 @@ RUN apt-get update \ FROM debian:stable-slim +ARG TOR_USER_ID ARG GROUP_ID COPY --from=build /tmp/tor/src/app/tor /usr/local/bin/tor -RUN addgroup --gid ${GROUP_ID} tor \ +RUN addgroup -u ${TOR_USER_ID} --gid ${GROUP_ID} tor \ && adduser --disabled-password --gecos "" --ingroup tor tor USER tor