Run a haveno daemon from a easy to configure docker container
543
This Docker setup provides a secure and private environment to run the Haveno Daemon, leveraging Tor for anonymous routing and Envoy for proxying and managing the traffic. The following services are part of this stack:
haveno-daemonThis is the main service that powers the decentralized Haveno platform. It connects to the Monero blockchain through the specified Monero node and uses the seed nodes for network discovery.
Key Environment Variables:
TOR_CONTROL_HOST: The IP address of the Tor service.TOR_CONTROL_PORT: The port of the Tor control interface (usually 9051).TOR_CONTROL_PASSWORD: The password used to control the Tor instance.NETWORK_NAME: The custom network name for this Haveno instance.NODE_PORT: The network port on which the Haveno node will listen.API_PASSWORD: The password to secure the API access.MAX_MEMORY: The maximum memory the daemon is allowed to use.SEED_NODES: A list of seed nodes to help the daemon connect to the network.XMR_NODE: The Monero node that the Haveno daemon uses for blockchain data.The Haveno Daemon mounts two key volumes:
/app/user/: User configuration and data for the Haveno instance./app/data/: Network-specific data storage.This service listens on port 3201, which is exposed for API communication.
torTor handles all traffic anonymously, routing it through the Tor network. The Tor instance is configured with the necessary control options to allow the Haveno Daemon to interact with it and manage connections securely.
Key Features:
9051 for managing Tor instance interactions.NET_ADMIN and NET_RAW capabilities to manage low-level networking.Optional:
torrc file can be mounted to configure the Tor instance further.Restart Policy: unless-stopped, ensuring that the Tor service continues running in case of failures.
dnsmasqA DNS forwarder that ensures DNS resolution routes onion hosts to the DNSSock Docker network and anything else to 1.1.1.1 (Cloudflare). It plays a crucial role in resolving DNS queries for services running inside the isolated Docker network (lockdown_net).
Ports:
Capabilities:
NET_ADMIN and NET_RAW for low-level networking tasks.envoyEnvoy acts as a proxy to manage incoming and outgoing traffic to the Haveno Daemon. It routes both gRPC and HTTP requests and can transform gRPC requests into HTTP requests, if necessary.
The key configuration is loaded from a YAML file (transformer-envoy.yaml), which dictates how the traffic is routed and transformed. This service exposes port 2222 for incoming requests.
watchtowerWatchtower monitors the running containers and automatically pulls updates for the services when new images are published. This ensures that the Haveno Daemon, Tor, and Envoy are always up-to-date.
Environment Variables:
WATCHTOWER_CLEANUP: Ensures that old containers are removed after updates.WATCHTOWER_POLL_INTERVAL: Configures the interval (in seconds) at which Watchtower checks for updates.The services communicate over the lockdown_net bridge network. Each service has a static IP address within the subnet 172.23.0.0/16. This ensures predictable IP assignment and facilitates easy configuration, especially for the Tor and Haveno Daemon services.
Example subnet configuration:
172.23.0.3172.23.0.4172.23.0.2172.23.0.5The Haveno Daemon is built using a multi-stage Dockerfile that minimizes the size of the final image by separating the build environment from the runtime environment.
BASE_NETWORK: The base network for the daemon (default: XMR_STAGENET).NETWORK_NAME: The name of the Haveno network (default: HAVENO).NODE_PORT: The port on which the daemon listens (default: 8080).MAX_MEMORY: Maximum memory the daemon can use (default: 1024m).XMR_NODE: The Monero node the daemon connects to (default: localhost:18081).TOR_CONTROL_HOST: The host where the Tor control port is running (default: localhost).TOR_CONTROL_PORT: The control port for Tor (default: 9051).SEED_NODES: Seed nodes for connecting to the network.The entry point dynamically constructs the command for starting the Haveno Daemon based on these environment variables.
This Docker setup provides a secure and private environment to run the Haveno Daemon, leveraging Tor for anonymous routing and Envoy for proxying and managing the traffic. The following services are part of this stack:
Here’s a detailed example of a docker-compose.yml file to run Haveno Daemon with Tor, DNSMasq, Envoy, and Watchtower:
# Copyright 2024 Kewbit (https://kewbit.org/)
version: '3'
services:
haveno-daemon:
image: haveno-daemon:latest
build: .
volumes:
- ./haveno-daemon/user:/app/user/
- ./haveno-daemon/data:/app/data/
ports:
- "3201:3201"
environment:
TOR_CONTROL_HOST: 172.23.0.3
TOR_CONTROL_PORT: 9051
TOR_CONTROL_PASSWORD: "FartLogs"
NETWORK_NAME: WOODSER
NODE_PORT: 9999
API_PASSWORD: "Rotteneggs123"
MAX_MEMORY: 2400
SEED_NODES: "dl57jitswby4yhzpqpu7pwq6iyqg2x6vkio73araparbftlqoqxhvqad.onion:2002,3cqlkowdu766sto5wrdqpntpsi7kezwkkakc532i6jeiyu7hha726ead.onion:3003"
XMR_NODE: http://node2.monerodevs.org:38089
networks:
lockdown_net:
ipv4_address: 172.23.0.4
depends_on:
tor:
condition: service_healthy
dnsmasq:
condition: service_healthy
dns:
- 172.23.0.2
tor:
image: dperson/torproxy
environment:
- TZ=UTC
- SERVICE=80;172.23.0.4:3201,80:172.23.0.5:2222
- EXITNODE=0
volumes:
- ./torrc:/etc/tor/torrc:ro
- ./tordata:/tor/data
restart: unless-stopped
networks:
lockdown_net:
ipv4_address: 172.23.0.3
cap_add:
- NET_ADMIN
- NET_RAW
dnsmasq:
image: havenodex/dnsmasq:latest
networks:
lockdown_net:
ipv4_address: 172.23.0.2
cap_add:
- NET_ADMIN
- NET_RAW
ports:
- "53/tcp"
- "53/udp"
restart: unless-stopped
envoy:
image: envoyproxy/envoy:v1.24.0
volumes:
- ./transformer-envoy.yaml:/etc/envoy/envoy.yaml
depends_on:
- tor
networks:
lockdown_net:
ipv4_address: 172.23.0.5
ports:
- "2222:2222"
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
WATCHTOWER_CLEANUP: "true"
WATCHTOWER_POLL_INTERVAL: 300
networks:
lockdown_net:
ipv4_address: 172.23.0.6
networks:
lockdown_net:
driver: bridge
ipam:
config:
- subnet: 172.23.0.0/16
NET_ADMIN and NET_RAW are added to manipulate low-level network settings.To use this setup, create a docker-compose.yml file with the provided configuration, and run the following commands to start the services:
To start all the services in the background (detached mode), use the following command:
docker-compose up -d
To stop the running services, use the following command:
docker-compose down
To view the logs of a specific service (e.g., the Haveno Daemon), use:
docker-compose logs haveno-daemon
You can replace haveno-daemon with any service name (e.g., tor, envoy) to view logs for other services.
You can check the status of all the running services using:
docker-compose ps
To restart a particular service (e.g., tor), use the following command:
docker-compose restart tor
Here are the key environment variables used to configure the Haveno Daemon. You can adjust these in your docker-compose.yml file under the environment section of the haveno-daemon service.
| Environment Variable | Description | Default Value |
|---|---|---|
BASE_NETWORK | The base network for Haveno (e.g., XMR_MAINNET) | XMR_STAGENET |
NETWORK_NAME | The name of the Haveno network | HAVENO |
NODE_PORT | Port on which the Haveno node will listen | 8080 |
MAX_MEMORY | Maximum memory allowed for Haveno Daemon | 1024m |
XMR_NODE | Monero node for blockchain data | localhost:18081 |
TOR_CONTROL_HOST | Tor control interface host | localhost |
TOR_CONTROL_PORT | Tor control port | 9051 |
TOR_CONTROL_PASSWORD | Password to manage the Tor instance | Not set (required) |
SEED_NODES | List of seed nodes for Haveno network discovery | dl57jitswby4yhzpqpu7pwq.onion:2002,... |
torrc FileIf you need to customize the Tor instance further, you can modify the torrc file and mount it in the tor service. This allows for more control over how Tor interacts with the Haveno Daemon and the rest of the services.
Example:
tor:
image: dperson/torproxy
volumes:
- ./torrc:/etc/tor/torrc:ro
Envoy is responsible for proxying gRPC and HTTP requests to the Haveno Daemon. The configuration for Envoy is provided via a YAML file (transformer-envoy.yaml), which can be customised based on your proxying needs. Ensure the ports and addresses match your Docker network setup. This documentation is provided by Kewbit I wrote an article about dnsmasq vs DNSCrypt which may be appropriate to implement later on as they can supplement each other. If you have any questions at all free free to reach out to me on my Kewbit email (Proton alias to prevent spam)
Although some of the features work, it's a work in progress but should be completed shortly. Do not use in production environments.
Content type
Image
Digest
sha256:8f8b5ca7e…
Size
488 MB
Last updated
almost 2 years ago
docker pull havenodex/haveno-daemon