-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): allow users to use Zebra + LWD with persistent states (#…
…8215) * feat(docker): allow users to use Zebra + LWD with persistent states * fix(docs): better documentation and compose execution * chore(docs): better context box * chore: do not commit further user changes to the `.env` This can always be overriden by forcing this pushes if it was intended * fix(compose): do not add extra volumes and ports * Apply suggestions from code review Co-authored-by: Marek <[email protected]> --------- Co-authored-by: Marek <[email protected]>
- Loading branch information
1 parent
2bf16a3
commit 5feb40e
Showing
9 changed files
with
196 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
RUST_LOG=info | ||
# This variable forces the use of color in the logs | ||
ZEBRA_FORCE_USE_COLOR=1 | ||
LOG_COLOR=true | ||
|
||
### | ||
# Configuration Variables | ||
# These variables are used to configure the zebra node | ||
# Check the entrypoint.sh script for more details | ||
### | ||
|
||
# The config file full path used in the Dockerfile. | ||
ZEBRA_CONF_PATH=/etc/zebrad/zebrad.toml | ||
# [network] | ||
NETWORK=Mainnet | ||
ZEBRA_LISTEN_ADDR=0.0.0.0 | ||
# [consensus] | ||
ZEBRA_CHECKPOINT_SYNC=true | ||
# [state] | ||
# Set this to change the default cached state directory | ||
ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache | ||
LIGHTWALLETD_DATA_DIR=/var/cache/lwd-cache | ||
# [metrics] | ||
METRICS_ENDPOINT_ADDR=0.0.0.0 | ||
METRICS_ENDPOINT_PORT=9999 | ||
# [tracing] | ||
TRACING_ENDPOINT_ADDR=0.0.0.0 | ||
TRACING_ENDPOINT_PORT=3000 | ||
# [rpc] | ||
RPC_LISTEN_ADDR=0.0.0.0 | ||
# if ${RPC_PORT} is not set, it will use the default value for the current network | ||
RPC_PORT=8232 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
version: "3.8" | ||
|
||
services: | ||
zebra: | ||
ports: | ||
- "8232:8232" # Opens an RPC endpoint (for lightwalletd and mining) | ||
healthcheck: | ||
start_period: 1m | ||
interval: 15s | ||
timeout: 10s | ||
retries: 3 | ||
test: ["CMD-SHELL", "curl --data-binary '{\"id\":\"curltest\", \"method\": \"getinfo\"}' -H 'content-type: application/json' 127.0.0.1:8232 || exit 1"] | ||
|
||
lightwalletd: | ||
image: electriccoinco/lightwalletd | ||
platform: linux/amd64 | ||
depends_on: | ||
zebra: | ||
condition: service_started | ||
restart: unless-stopped | ||
deploy: | ||
resources: | ||
reservations: | ||
cpus: "4" | ||
memory: 16G | ||
environment: | ||
- LWD_GRPC_PORT=9067 | ||
- LWD_HTTP_PORT=9068 | ||
configs: | ||
- source: lwd_config | ||
target: /etc/lightwalletd/zcash.conf | ||
uid: '2002' # Golang's container default user uid | ||
gid: '2002' # Golang's container default group gid | ||
mode: 0440 | ||
volumes: | ||
- litewalletd-data:/var/lib/lightwalletd/db | ||
#! This setup with --no-tls-very-insecure is only for testing purposes | ||
#! For production environments follow the guidelines here: https://github.com/zcash/lightwalletd#production-usage | ||
command: > | ||
--no-tls-very-insecure | ||
--grpc-bind-addr=0.0.0.0:9067 | ||
--http-bind-addr=0.0.0.0:9068 | ||
--zcash-conf-path=/etc/lightwalletd/zcash.conf | ||
--data-dir=/var/lib/lightwalletd/db | ||
--log-file=/dev/stdout | ||
--log-level=7 | ||
ports: | ||
- "9067:9067" # gRPC | ||
- "9068:9068" # HTTP | ||
|
||
configs: | ||
lwd_config: | ||
# Change the following line to point to a zcash.conf on your host machine | ||
# to allow for easy configuration changes without rebuilding the image | ||
file: ./zcash-lightwalletd/zcash.conf | ||
|
||
volumes: | ||
litewalletd-data: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
version: "3.8" | ||
|
||
services: | ||
zebra: | ||
image: zfnd/zebra | ||
platform: linux/amd64 | ||
build: | ||
context: ../ | ||
dockerfile: docker/Dockerfile | ||
target: runtime | ||
restart: unless-stopped | ||
deploy: | ||
resources: | ||
reservations: | ||
cpus: "4" | ||
memory: 16G | ||
env_file: | ||
- .env | ||
#! Uncomment the `configs` mapping below to use the `zebrad.toml` config file from the host machine | ||
#! NOTE: This will override the zebrad.toml in the image and make some variables irrelevant | ||
# configs: | ||
# - source: zebra_config | ||
# target: /etc/zebrad/zebrad.toml | ||
# uid: '2001' # Rust's container default user uid | ||
# gid: '2001' # Rust's container default group gid | ||
# mode: 0440 | ||
volumes: | ||
- zebrad-cache:/var/cache/zebrad-cache | ||
ports: | ||
# Zebra uses the following default inbound and outbound TCP ports | ||
- "8233:8233" # Mainnet Network (for peer connections) | ||
# - "8232:8232" # Opens an RPC endpoint (for wallet storing and mining) | ||
# - "18233:18233" # Testnet Network | ||
# - "9999:9999" # Metrics | ||
# - "3000:3000" # Tracing | ||
|
||
configs: | ||
zebra_config: | ||
# Change the following line to point to a zebrad.toml on your host machine | ||
# to allow for easy configuration changes without rebuilding the image | ||
file: ../zebrad/tests/common/configs/v1.0.0-rc.2.toml/ | ||
|
||
volumes: | ||
zebrad-cache: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
rpcbind=zebra | ||
rpcport=8232 | ||
rpcuser=zcashrpc | ||
rpcpassword=changeme | ||
testnet=0 |