chore(bitcoin): add traefik labels and simplify config

This commit is contained in:
Nicolas Meienberger 2024-03-18 22:18:17 +01:00
parent 7c039b97bb
commit 944aa771bb
2 changed files with 91 additions and 53 deletions

View File

@ -1,49 +1,62 @@
{ {
"$schema": "../schema.json", "$schema": "../schema.json",
"name": "Bitcoin", "name": "Bitcoin",
"available": true, "available": true,
"exposable": false, "exposable": false,
"no_gui": true, "no_gui": true,
"port": 8333, "port": 8333,
"id": "bitcoind", "id": "bitcoind",
"description": "Bitcoin core node", "description": "Bitcoin core node",
"tipi_version": 1, "tipi_version": 1,
"version": "26.0", "version": "26.0",
"categories": ["finance"], "categories": [
"short_desc": "Bitcoin core node", "finance"
"author": "Bitcoin developers", ],
"source": "https://github.com/lncm/docker-bitcoind", "short_desc": "Bitcoin core node",
"form_fields": [ "author": "Bitcoin developers",
{ "source": "https://github.com/lncm/docker-bitcoind",
"type": "number", "form_fields": [
"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.", "type": "number",
"required": false, "label": "DB Cache Size (In mb)",
"env_variable": "DB_CACHE" "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 <n> megabytes. Default 300 Mb.", "type": "number",
"required": false, "label": "Max Mempool Size (In mb)",
"env_variable": "MAX_MEMPOOL" "hint": "Keep the transaction memory pool below <n> megabytes. Default 300 Mb.",
}, "required": false,
{ "env_variable": "BITCOIND_MAX_MEMPOOL"
"type": "number", },
"label": "Listen for Incoming Connections (0 disabled / 1 enabled)", {
"hint": "Accept incoming connections from peers. Default disabled.", "type": "text",
"regex": "^[01]$", "label": "Listen for Incoming Connections",
"required": false, "hint": "Accept incoming connections from peers.",
"env_variable": "LISTEN" "required": false,
}, "env_variable": "BITCOIND_LISTEN",
{ "options": [
"type": "number", {
"label": "Max Peer Connections", "label": "Yes",
"hint": "Maintain at most N connections to peers. Default 125.", "value": "1"
"required": false, },
"env_variable": "MAXPEERS" {
} "label": "No",
"value": "0"
], }
"supported_architectures": ["amd64", "arm64", "arm"] ]
} },
{
"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"
]
}

View File

@ -14,9 +14,34 @@ services:
restart: unless-stopped restart: unless-stopped
stop_grace_period: 15m30s stop_grace_period: 15m30s
command: >- command: >-
--dbcache=${DB_CACHE:-450} --dbcache=${BITCOIND_DB_CACHE:-450}
--maxmempool=${MAX_MEMPOOL:-300} --maxmempool=${BITCOIND_MAX_MEMPOOL:-300}
--listen=${LISTEN:-0} --listen=${BITCOIND_LISTEN:-0}
--maxconnections=${MAXPEERS:-125} --maxconnections=${BITCOIND_MAXPEERS:-125}
networks: networks:
- tipi_main_network - 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