From 944aa771bba8ee8c5ce3d642dc8cd91f4d7dc586 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Mon, 18 Mar 2024 22:18:17 +0100 Subject: [PATCH] chore(bitcoin): add traefik labels and simplify config --- apps/bitcoind/config.json | 109 +++++++++++++++++-------------- apps/bitcoind/docker-compose.yml | 35 ++++++++-- 2 files changed, 91 insertions(+), 53 deletions(-) diff --git a/apps/bitcoind/config.json b/apps/bitcoind/config.json index 38f22e44..e5742fdf 100644 --- a/apps/bitcoind/config.json +++ b/apps/bitcoind/config.json @@ -1,49 +1,62 @@ { - "$schema": "../schema.json", - "name": "Bitcoin", - "available": true, - "exposable": false, - "no_gui": true, - "port": 8333, - "id": "bitcoind", - "description": "Bitcoin core node", - "tipi_version": 1, - "version": "26.0", - "categories": ["finance"], - "short_desc": "Bitcoin core node", - "author": "Bitcoin developers", - "source": "https://github.com/lncm/docker-bitcoind", - "form_fields": [ - { - "type": "number", - "label": "DB Cache Size (In mb)", - "hint": "Set database cache size in megabytes; machines sync faster with a larger cache. Recommend setting as high as possible based upon machine's available RAM. Default 450 Mb.", - "required": false, - "env_variable": "DB_CACHE" - }, - { - "type": "number", - "label": "Max Mempool Size (In mb)", - "hint": "Keep the transaction memory pool below megabytes. Default 300 Mb.", - "required": false, - "env_variable": "MAX_MEMPOOL" - }, - { - "type": "number", - "label": "Listen for Incoming Connections (0 disabled / 1 enabled)", - "hint": "Accept incoming connections from peers. Default disabled.", - "regex": "^[01]$", - "required": false, - "env_variable": "LISTEN" - }, - { - "type": "number", - "label": "Max Peer Connections", - "hint": "Maintain at most N connections to peers. Default 125.", - "required": false, - "env_variable": "MAXPEERS" - } - - ], - "supported_architectures": ["amd64", "arm64", "arm"] -} \ No newline at end of file + "$schema": "../schema.json", + "name": "Bitcoin", + "available": true, + "exposable": false, + "no_gui": true, + "port": 8333, + "id": "bitcoind", + "description": "Bitcoin core node", + "tipi_version": 1, + "version": "26.0", + "categories": [ + "finance" + ], + "short_desc": "Bitcoin core node", + "author": "Bitcoin developers", + "source": "https://github.com/lncm/docker-bitcoind", + "form_fields": [ + { + "type": "number", + "label": "DB Cache Size (In mb)", + "hint": "Set database cache size in megabytes; machines sync faster with a larger cache. Recommend setting as high as possible based upon machine's available RAM. Default 450 Mb.", + "required": false, + "env_variable": "BITCOIND_DB_CACHE" + }, + { + "type": "number", + "label": "Max Mempool Size (In mb)", + "hint": "Keep the transaction memory pool below megabytes. Default 300 Mb.", + "required": false, + "env_variable": "BITCOIND_MAX_MEMPOOL" + }, + { + "type": "text", + "label": "Listen for Incoming Connections", + "hint": "Accept incoming connections from peers.", + "required": false, + "env_variable": "BITCOIND_LISTEN", + "options": [ + { + "label": "Yes", + "value": "1" + }, + { + "label": "No", + "value": "0" + } + ] + }, + { + "type": "number", + "label": "Max Peer Connections", + "hint": "Maintain at most N connections to peers. Leave empty for default 125.", + "required": false, + "env_variable": "BITCOIND_MAXPEERS" + } + ], + "supported_architectures": [ + "amd64", + "arm64" + ] +} diff --git a/apps/bitcoind/docker-compose.yml b/apps/bitcoind/docker-compose.yml index 1022c39e..54dce6c3 100644 --- a/apps/bitcoind/docker-compose.yml +++ b/apps/bitcoind/docker-compose.yml @@ -14,9 +14,34 @@ services: restart: unless-stopped stop_grace_period: 15m30s command: >- - --dbcache=${DB_CACHE:-450} - --maxmempool=${MAX_MEMPOOL:-300} - --listen=${LISTEN:-0} - --maxconnections=${MAXPEERS:-125} + --dbcache=${BITCOIND_DB_CACHE:-450} + --maxmempool=${BITCOIND_MAX_MEMPOOL:-300} + --listen=${BITCOIND_LISTEN:-0} + --maxconnections=${BITCOIND_MAXPEERS:-125} networks: - - tipi_main_network \ No newline at end of file + - tipi_main_network + labels: + # Main + traefik.enable: true + traefik.http.middlewares.bitcoind-web-redirect.redirectscheme.scheme: https + traefik.http.services.bitcoind.loadbalancer.server.port: 3333 + # Web + traefik.http.routers.bitcoind-insecure.rule: Host(`${APP_DOMAIN}`) + traefik.http.routers.bitcoind-insecure.entrypoints: web + traefik.http.routers.bitcoind-insecure.service: bitcoind + traefik.http.routers.bitcoind-insecure.middlewares: bitcoind-web-redirect + # Websecure + traefik.http.routers.bitcoind.rule: Host(`${APP_DOMAIN}`) + traefik.http.routers.bitcoind.entrypoints: websecure + traefik.http.routers.bitcoind.service: bitcoind + traefik.http.routers.bitcoind.tls.certresolver: myresolver + # Local domain + traefik.http.routers.bitcoind-local-insecure.rule: Host(`bitcoind.${LOCAL_DOMAIN}`) + traefik.http.routers.bitcoind-local-insecure.entrypoints: web + traefik.http.routers.bitcoind-local-insecure.service: bitcoind + traefik.http.routers.bitcoind-local-insecure.middlewares: bitcoind-web-redirect + # Local domain secure + traefik.http.routers.bitcoind-local.rule: Host(`bitcoind.${LOCAL_DOMAIN}`) + traefik.http.routers.bitcoind-local.entrypoints: websecure + traefik.http.routers.bitcoind-local.service: bitcoind + traefik.http.routers.bitcoind-local.tls: true