Skip to content

Commit

Permalink
V2024.6
Browse files Browse the repository at this point in the history
* Add USER_ID param and update some services

* Add gitignore
  • Loading branch information
reverse-hash committed Jun 9, 2024
1 parent 142987e commit 270cf1d
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 21 deletions.
34 changes: 24 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
# 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

# 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
2 changes: 2 additions & 0 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion bitcoind/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions btc-rpc-explorer/Dockerfile → btcrpcexplorer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion electrs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion tor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 270cf1d

Please sign in to comment.