From 1affa7b2a320b8ac0d0e3b1783755aa33aee2402 Mon Sep 17 00:00:00 2001 From: Sahil Phule Date: Tue, 29 Oct 2024 21:44:25 -0400 Subject: [PATCH] App Submission: Fulcrum (#1531) Co-authored-by: nmfretz --- fulcrum/data/fulcrum/.gitkeep | 0 fulcrum/docker-compose.yml | 56 +++++++++++++++++++++++++++++++++++ fulcrum/exports.sh | 7 +++++ fulcrum/hooks/pre-start | 26 ++++++++++++++++ fulcrum/torrc.template | 3 ++ fulcrum/umbrel-app.yml | 33 +++++++++++++++++++++ 6 files changed, 125 insertions(+) create mode 100644 fulcrum/data/fulcrum/.gitkeep create mode 100644 fulcrum/docker-compose.yml create mode 100644 fulcrum/exports.sh create mode 100644 fulcrum/hooks/pre-start create mode 100644 fulcrum/torrc.template create mode 100644 fulcrum/umbrel-app.yml diff --git a/fulcrum/data/fulcrum/.gitkeep b/fulcrum/data/fulcrum/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/fulcrum/docker-compose.yml b/fulcrum/docker-compose.yml new file mode 100644 index 0000000000..ea59e5aef0 --- /dev/null +++ b/fulcrum/docker-compose.yml @@ -0,0 +1,56 @@ +version: "3.7" + +services: + app_proxy: + environment: + APP_HOST: $APP_FULCRUM_IP + APP_PORT: 3006 + + app: + image: ghcr.io/sahilph/umbrel-fulcrum:sha-349e246@sha256:5d565f3b15f7bbeab28c027320ffc84d647e7816cd007fd84077c0db05c15393 + depends_on: + - fulcrum + restart: on-failure + environment: + ELECTRUM_HIDDEN_SERVICE: "${APP_FULCRUM_RPC_HIDDEN_SERVICE}" + ELECTRUM_LOCAL_SERVICE: "${DEVICE_DOMAIN_NAME}" + ELECTRUM_PORT: ${APP_FULCRUM_NODE_PORT} + FULCRUM_HOST: "${APP_FULCRUM_NODE_IP}" + FULCRUM_PORT: "${APP_FULCRUM_NODE_PORT}" + BITCOIN_HOST: "${APP_BITCOIN_NODE_IP}" + RPC_USER: "${APP_BITCOIN_RPC_USER}" + RPC_PASSWORD: "${APP_BITCOIN_RPC_PASS}" + RPC_PORT: "${APP_BITCOIN_RPC_PORT}" + networks: + default: + ipv4_address: $APP_FULCRUM_IP + + fulcrum: + image: cculianu/fulcrum:v1.11.1@sha256:70f06b93ab5863997992d4b4508312fe81ce576017e16ecc7e69c7d38165bdf2 + restart: on-failure + user: "1000:1000" + environment: + TCP: 0.0.0.0:${APP_FULCRUM_NODE_PORT} + BITCOIND: ${APP_BITCOIN_NODE_IP}:${APP_BITCOIN_RPC_PORT} + RPCUSER: ${APP_BITCOIN_RPC_USER} + RPCPASSWORD: ${APP_BITCOIN_RPC_PASS} + PEERING: "false" + ANNOUNCE: "false" + command: Fulcrum _ENV_ + volumes: + - "${APP_DATA_DIR}/data/fulcrum:/data" + ports: + - "${APP_FULCRUM_NODE_PORT}:${APP_FULCRUM_NODE_PORT}" + networks: + default: + ipv4_address: $APP_FULCRUM_NODE_IP + + tor: + image: getumbrel/tor:0.4.7.8@sha256:2ace83f22501f58857fa9b403009f595137fa2e7986c4fda79d82a8119072b6a + user: "1000:1000" + restart: on-failure + volumes: + - ${APP_DATA_DIR}/torrc:/etc/tor/torrc:ro + - ${TOR_DATA_DIR}:/data + environment: + HOME: "/tmp" diff --git a/fulcrum/exports.sh b/fulcrum/exports.sh new file mode 100644 index 0000000000..34a1c60828 --- /dev/null +++ b/fulcrum/exports.sh @@ -0,0 +1,7 @@ +export APP_FULCRUM_IP="10.21.22.200" +export APP_FULCRUM_NODE_IP="10.21.21.200" + +export APP_FULCRUM_NODE_PORT="50002" + +rpc_hidden_service_file="${EXPORTS_TOR_DATA_DIR}/app-${EXPORTS_APP_ID}-rpc/hostname" +export APP_FULCRUM_RPC_HIDDEN_SERVICE="$(cat "${rpc_hidden_service_file}" 2>/dev/null || echo "notyetset.onion")" diff --git a/fulcrum/hooks/pre-start b/fulcrum/hooks/pre-start new file mode 100644 index 0000000000..7cf6e7e4f4 --- /dev/null +++ b/fulcrum/hooks/pre-start @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Delay booting Fulcrum until the RPC Tor Hidden Service is ready + +HIDDEN_SERVICE_FILE="${TOR_DATA_DIR}/app-${APP_ID}-rpc/hostname" + +if [[ -f "${HIDDEN_SERVICE_FILE}" ]]; then + exit +fi + +"${UMBREL_ROOT}/scripts/app" compose "${APP_ID}" up --detach fulcrum +"${UMBREL_ROOT}/scripts/app" compose "${APP_ID}" up --detach tor + +echo "App: ${APP_ID} - Generating Tor Hidden Service..." + +for attempt in $(seq 1 100); do + if [[ -f "${HIDDEN_SERVICE_FILE}" ]]; then + echo "App: ${APP_ID} - Hidden service file created successfully!" + break + fi + sleep 0.1 +done + +if [[ ! -f "${HIDDEN_SERVICE_FILE}" ]]; then + echo "App: ${APP_ID} - Hidden service file wasn't created" +fi diff --git a/fulcrum/torrc.template b/fulcrum/torrc.template new file mode 100644 index 0000000000..207fd49abe --- /dev/null +++ b/fulcrum/torrc.template @@ -0,0 +1,3 @@ +# Fulcrum RPC Hidden Service +HiddenServiceDir /data/app-$APP_ID-rpc +HiddenServicePort $APP_FULCRUM_NODE_PORT $APP_FULCRUM_NODE_IP:$APP_FULCRUM_NODE_PORT diff --git a/fulcrum/umbrel-app.yml b/fulcrum/umbrel-app.yml new file mode 100644 index 0000000000..cb77d7699e --- /dev/null +++ b/fulcrum/umbrel-app.yml @@ -0,0 +1,33 @@ +manifestVersion: 1.1 +id: fulcrum +category: bitcoin +name: Fulcrum +version: "1.11.1" +tagline: A fast and nimble Electrum Server +description: >- + Run your personal Electrum server and connect your Electrum-compatible wallet, + including BitBoxApp, BlueWallet, Electrum Wallet (Android and Desktop), Nunchuk + (Desktop), Phoenix, and Sparrow Wallet to it instead of using a third-party + Electrum server. + + + Powered by Fulcrum from Calin Culianu + + + ⚠️ Fulcrum does not yet automatically integrate with other apps in the Bitcoin ecosystem on Umbrel. However, in a future umbrelOS update, users will be able to choose which Electrum Server app they want to use to connect with other apps. +developer: Calin Culianu +website: https://fulcrumserver.org/ +submitter: Sahil Phule +submission: https://github.com/getumbrel/umbrel-apps/pull/1531 +dependencies: + - bitcoin +repo: https://github.com/cculianu/Fulcrum +support: https://github.com/cculianu/Fulcrum/issues +port: 2107 +gallery: + - 1.jpg + - 2.jpg + - 3.jpg +path: "" +defaultPassword: "" +releaseNotes: ""