mirror of https://github.com/lukechilds/umbrel.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
585 lines
26 KiB
585 lines
26 KiB
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
##########################################################
|
|
################## Check dependencies ####################
|
|
##########################################################
|
|
|
|
check_dependencies () {
|
|
for cmd in "$@"; do
|
|
if ! command -v $cmd >/dev/null 2>&1; then
|
|
echo "This script requires \"${cmd}\" to be installed"
|
|
exit 1
|
|
fi
|
|
done
|
|
}
|
|
|
|
if [ ! "$(uname -s)" == "Linux" ]; then
|
|
echo "Sorry, Umbrel only supports Linux-based systems at this point."
|
|
echo
|
|
echo "You may work around this by modifying the configuration script yourself, but it's highly experimental."
|
|
echo "If you get it working, we hope you consider making a PR. :)"
|
|
exit 1
|
|
fi
|
|
|
|
check_dependencies docker docker-compose dirname readlink
|
|
|
|
# Switch to Umbrel's root directory
|
|
UMBREL_ROOT="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")"/..)"
|
|
if [[ ! -d "$UMBREL_ROOT" ]]; then
|
|
echo "Root dir does not exist '$UMBREL_ROOT'"
|
|
exit 1
|
|
fi
|
|
cd "$UMBREL_ROOT"
|
|
|
|
# Make sure we use the status dir from the real Umbrel installation if this is
|
|
# an OTA update.
|
|
STATUS_DIR="${UMBREL_ROOT}/statuses"
|
|
if [[ -f "${UMBREL_ROOT}/../.umbrel" ]]; then
|
|
STATUS_DIR="${UMBREL_ROOT}/../statuses"
|
|
fi
|
|
|
|
# Configure for mainnet or testnet or regtest depending
|
|
# upon the user-supplied value of $NETWORK
|
|
BITCOIN_NETWORK="${NETWORK:-mainnet}"
|
|
|
|
if [ "$BITCOIN_NETWORK" != "mainnet" ] && [ "$BITCOIN_NETWORK" != "testnet" ] && [ "$BITCOIN_NETWORK" != "regtest" ]; then
|
|
echo "Error: Umbrel can only be configured for mainnet (default), testnet or regtest"
|
|
exit 1
|
|
fi
|
|
|
|
# Get current Umbrel version
|
|
UMBREL_VERSION="$(cat ${UMBREL_ROOT}/info.json | jq -r .version)"
|
|
|
|
echo
|
|
echo "======================================"
|
|
if [[ -f "${STATUS_DIR}/configured" ]]; then
|
|
echo "=========== RECONFIGURING ============"
|
|
else
|
|
echo "============ CONFIGURING ============="
|
|
fi
|
|
echo "========= UMBREL (${BITCOIN_NETWORK}) ==========="
|
|
echo "======================================"
|
|
echo
|
|
|
|
|
|
##########################################################
|
|
############### Setup configuration files ###############
|
|
##########################################################
|
|
|
|
# Store paths to intermediary config files
|
|
NGINX_CONF_FILE="./templates/nginx.conf"
|
|
BITCOIN_CONF_FILE="./templates/bitcoin.conf"
|
|
LND_CONF_FILE="./templates/lnd.conf"
|
|
TOR_SERVER_CONF_FILE="./templates/torrc-server"
|
|
TOR_PROXY_CONF_FILE="./templates/torrc-proxy"
|
|
ELECTRS_CONF_FILE="./templates/electrs.toml"
|
|
ENV_FILE="./templates/.env"
|
|
|
|
# Remove intermediary files if they exist from any
|
|
# previous unclean configuration run
|
|
[[ -f "$NGINX_CONF_FILE" ]] && rm -f "$NGINX_CONF_FILE"
|
|
[[ -f "$BITCOIN_CONF_FILE" ]] && rm -f "$BITCOIN_CONF_FILE"
|
|
[[ -f "$LND_CONF_FILE" ]] && rm -f "$LND_CONF_FILE"
|
|
[[ -f "$TOR_SERVER_CONF_FILE" ]] && rm -f "$TOR_SERVER_CONF_FILE"
|
|
[[ -f "$TOR_PROXY_CONF_FILE" ]] && rm -f "$TOR_PROXY_CONF_FILE"
|
|
[[ -f "$ELECTRS_CONF_FILE" ]] && rm -f "$ELECTRS_CONF_FILE"
|
|
[[ -f "$ENV_FILE" ]] && rm -f "$ENV_FILE"
|
|
|
|
# Copy template configs to intermediary configs
|
|
[[ -f "./templates/nginx-sample.conf" ]] && cp "./templates/nginx-sample.conf" "$NGINX_CONF_FILE"
|
|
[[ -f "./templates/bitcoin-sample.conf" ]] && cp "./templates/bitcoin-sample.conf" "$BITCOIN_CONF_FILE"
|
|
[[ -f "./templates/lnd-sample.conf" ]] && cp "./templates/lnd-sample.conf" "$LND_CONF_FILE"
|
|
[[ -f "./templates/torrc-server-sample" ]] && cp "./templates/torrc-server-sample" "$TOR_SERVER_CONF_FILE"
|
|
[[ -f "./templates/torrc-proxy-sample" ]] && cp "./templates/torrc-proxy-sample" "$TOR_PROXY_CONF_FILE"
|
|
[[ -f "./templates/electrs-sample.toml" ]] && cp "./templates/electrs-sample.toml" "$ELECTRS_CONF_FILE"
|
|
[[ -f "./templates/.env-sample" ]] && cp "./templates/.env-sample" "$ENV_FILE"
|
|
|
|
|
|
##########################################################
|
|
############ Generate configuration variables ############
|
|
##########################################################
|
|
|
|
# Load existing credentials if we have some
|
|
[[ -f "./.env" ]] && source "./.env"
|
|
[[ ! -z ${PREV_ENV_FILE+x} ]] && [[ -f "${PREV_ENV_FILE}" ]] && source "${PREV_ENV_FILE}"
|
|
|
|
# Umbrel
|
|
NETWORK_IP="10.21.21.0"
|
|
GATEWAY_IP="10.21.21.1"
|
|
NGINX_IP="10.21.21.2"
|
|
NGINX_PORT="${NGINX_PORT:-80}"
|
|
DASHBOARD_IP="10.21.21.3"
|
|
MANAGER_IP="10.21.21.4"
|
|
MIDDLEWARE_IP="10.21.21.5"
|
|
NEUTRINO_SWITCHER_IP="10.21.21.6"
|
|
BITCOIN_IP="10.21.21.8"
|
|
BITCOIN_RPC_PORT="8332"
|
|
BITCOIN_P2P_PORT="8333"
|
|
BITCOIN_ZMQ_RAWBLOCK_PORT="28332"
|
|
BITCOIN_ZMQ_RAWTX_PORT="28333"
|
|
BITCOIN_ZMQ_HASHBLOCK_PORT="28334"
|
|
BITCOIN_ZMQ_SEQUENCE_PORT="28335"
|
|
LND_IP="10.21.21.9"
|
|
LND_GRPC_PORT="10009"
|
|
LND_REST_PORT="8080"
|
|
ELECTRUM_IP="10.21.21.10"
|
|
ELECTRUM_PORT="50001"
|
|
TOR_PROXY_IP="10.21.21.11"
|
|
TOR_PROXY_PORT="9050"
|
|
TOR_SERVER_IP="10.21.21.49"
|
|
|
|
# Apps
|
|
APP_BTC_RPC_EXPLORER_IP="10.21.21.12"
|
|
APP_BTC_RPC_EXPLORER_IP="10.21.21.12"
|
|
APP_BTC_RPC_EXPLORER_PORT="3002"
|
|
APP_THUNDERHUB_IP="10.21.21.13"
|
|
APP_THUNDERHUB_PORT="3000"
|
|
APP_SPHINX_RELAY_IP="10.21.21.14"
|
|
APP_SPHINX_RELAY_PORT="3300"
|
|
APP_RIDE_THE_LIGHTNING_IP="10.21.21.15"
|
|
APP_RIDE_THE_LIGHTNING_PORT="3001"
|
|
APP_RIDE_THE_LIGHTNING_LOOP_IP="10.21.21.16"
|
|
APP_RIDE_THE_LIGHTNING_BOLTZ_IP="10.21.21.63"
|
|
APP_LIGHTNING_TERMINAL_IP="10.21.21.17"
|
|
APP_LIGHTNING_TERMINAL_PORT="3004"
|
|
APP_SPECTER_DESKTOP_IP="10.21.21.18"
|
|
APP_SPECTER_DESKTOP_PORT="25441"
|
|
APP_BTCPAY_SERVER_IP="10.21.21.19"
|
|
APP_BTCPAY_SERVER_PORT="3003"
|
|
APP_BTCPAY_SERVER_NBXPLORER_IP="10.21.21.20"
|
|
APP_BTCPAY_SERVER_DB_IP="10.21.21.21"
|
|
APP_LNBITS_IP="10.21.21.29"
|
|
APP_LNBITS_PORT="3007"
|
|
APP_MEMPOOL_IP="10.21.21.26"
|
|
APP_MEMPOOL_PORT="3006"
|
|
APP_MEMPOOL_API_IP="10.21.21.27"
|
|
APP_MEMPOOL_DB_IP="10.21.21.28"
|
|
APP_SAMOURAI_SERVER_IP="10.21.21.22"
|
|
APP_SAMOURAI_SERVER_DOJO_PORT="3009"
|
|
APP_SAMOURAI_SERVER_CONNECT_PORT="3005"
|
|
APP_SAMOURAI_SERVER_WHIRLPOOL_IP="10.21.21.23"
|
|
APP_SAMOURAI_SERVER_WHIRLPOOL_PORT="8898"
|
|
APP_SAMOURAI_SERVER_DB_IP="10.21.21.24"
|
|
APP_SAMOURAI_SERVER_NODE_IP="10.21.21.25"
|
|
APP_BLUEWALLET_LNDHUB_IP="10.21.21.30"
|
|
APP_BLUEWALLET_LNDHUB_PORT="3008"
|
|
APP_BLUEWALLET_REDIS_IP="10.21.21.31"
|
|
APP_NEXTCLOUD_PORT="8081"
|
|
APP_NEXTCLOUD_IP="10.21.21.32"
|
|
APP_NEXTCLOUD_DB_IP="10.21.21.33"
|
|
APP_NEXTCLOUD_REDIS_IP="10.21.21.34"
|
|
APP_NEXTCLOUD_CRON_IP="10.21.21.35"
|
|
APP_PI_HOLE_PORT="8082"
|
|
APP_PI_HOLE_IP="10.21.21.36"
|
|
APP_HOME_ASSISTANT_PORT="8083"
|
|
APP_HOME_ASSISTANT_IP="10.21.21.37"
|
|
APP_GITEA_PORT="8085"
|
|
APP_GITEA_SSH_PORT="2222"
|
|
APP_GITEA_IP="10.21.21.39"
|
|
APP_GITEA_DB_IP="10.21.21.40"
|
|
APP_SIMPLETORRENT_PORT="8086"
|
|
APP_SIMPLETORRENT_IP="10.21.21.41"
|
|
APP_PHOTOPRISM_IP="10.21.21.42"
|
|
APP_PHOTOPRISM_PORT="8087"
|
|
APP_PHOTOPRISM_DB_IP="10.21.21.43"
|
|
APP_SYNAPSE_IP="10.21.21.44"
|
|
APP_SYNAPSE_PORT="8008"
|
|
APP_ELEMENT_IP="10.21.21.45"
|
|
APP_ELEMENT_PORT="8088"
|
|
APP_VAULTWARDEN_IP="10.21.21.46"
|
|
APP_VAULTWARDEN_PORT="8089"
|
|
APP_CODE_SERVER_IP="10.21.21.53"
|
|
APP_CODE_SERVER_PORT="8091"
|
|
APP_SQUEAKNODE_IP="10.21.21.54"
|
|
APP_SQUEAKNODE_PORT="12994"
|
|
APP_SQUEAKNODE_GRPC_PORT="8994"
|
|
APP_SQUEAKNODE_P2P_PORT="8555"
|
|
APP_SQUEAKNODE_P2P_TESTNET_PORT="18555"
|
|
APP_KRYSTAL_BULL_IP="10.21.21.56"
|
|
APP_KRYSTAL_BULL_PORT="3010"
|
|
APP_KRYSTAL_BULL_SERVER_IP="10.21.21.57"
|
|
APP_NODE_RED_IP="10.21.21.55"
|
|
APP_NODE_RED_PORT="1880"
|
|
APP_LNMARKETS_IP="10.21.21.58"
|
|
APP_LNMARKETS_PORT="4242"
|
|
APP_ELECTRUMX_IP="10.21.21.59"
|
|
APP_ELECTRUMX_PORT="55001"
|
|
APP_TALLYCOIN_CONNECT_IP="10.21.21.60"
|
|
APP_TALLYCOIN_CONNECT_PORT="8123"
|
|
APP_SYNCTHING_IP="10.21.21.61"
|
|
APP_SYNCTHING_PORT="8384"
|
|
APP_SYNCTHING_SYNC_PORT="22000"
|
|
APP_UPTIME_KUMA_PORT="8385"
|
|
APP_UPTIME_KUMA_IP="10.21.21.62"
|
|
APP_HELIPAD_PORT="2112"
|
|
APP_HELIPAD_IP="10.21.21.65"
|
|
APP_ITCHYSATS_IP="10.21.21.64"
|
|
APP_ITCHYSATS_PORT="7113"
|
|
APP_LIGHTNING_SHELL_PORT="7681"
|
|
APP_LIGHTNING_SHELL_IP="10.21.21.66"
|
|
APP_SATSALE_PORT="5000"
|
|
APP_SATSALE_IP="10.21.21.67"
|
|
APP_BITFEED_IP="10.21.21.68"
|
|
APP_BITFEED_PORT="8314"
|
|
APP_BITFEED_API_IP="10.21.21.69"
|
|
APP_BITFEED_API_PORT="8315"
|
|
APP_KOLLIDER_IP="10.21.21.70"
|
|
APP_KOLLIDER_PORT="4243"
|
|
APP_KOLLIDER_WS_IP="10.21.21.71"
|
|
APP_KOLLIDER_WS_PORT="4244"
|
|
APP_KOLLIDER_HH_IP="10.21.21.72"
|
|
APP_SUREDBITS_WALLET_IP="10.21.21.73"
|
|
APP_SUREDBITS_WALLET_PORT="3020"
|
|
APP_SUREDBITS_WALLET_SERVER_IP="10.21.21.74"
|
|
APP_SUREDBITS_WALLET_P2P_PORT="2862"
|
|
APP_LNDG_IP="10.21.21.75"
|
|
APP_LNDG_PORT="8889"
|
|
APP_LNDG_IP="10.21.21.75"
|
|
APP_LNDG_PORT="8889"
|
|
APP_URBIT_IP="10.21.21.76"
|
|
APP_URBIT_PORT="8090"
|
|
APP_URBIT_P2P_PORT="34343"
|
|
APP_USOCIAL_IP="10.21.21.77"
|
|
APP_USOCIAL_PORT="8448"
|
|
APP_USOCIAL_FETCHER_IP="10.21.21.78"
|
|
APP_TAILSCALE_IP="10.21.21.80"
|
|
APP_TAILSCALE_PORT="2100"
|
|
APP_URBIT_BITCOIN_CONNECTOR_IP="10.21.21.81"
|
|
APP_URBIT_BITCOIN_CONNECTOR_PORT="9090"
|
|
APP_URBIT_BITCOIN_CONNECTOR_SERVER_PORT="55555"
|
|
APP_SNOWFLAKE_IP="10.21.21.82"
|
|
APP_SNOWFLAKE_PORT="3800"
|
|
APP_SNOWFLAKE_PROXY_IP="10.21.21.83"
|
|
APP_JAM_IP="10.21.21.84"
|
|
APP_JAM_PORT="5002"
|
|
APP_BLESKOMAT_SERVER_PORT="3333"
|
|
APP_BLESKOMAT_SERVER_IP="10.21.21.85"
|
|
APP_BLESKOMAT_SERVER_DB_IP="10.21.21.86"
|
|
APP_AGORA_IP="10.21.21.87"
|
|
APP_AGORA_PORT="12080"
|
|
APP_AGORA_SERVER_IP="10.21.21.88"
|
|
APP_AGORA_FILEBROWSER_IP="10.21.21.89"
|
|
APP_SPARKKIOSK_IP="10.21.21.90"
|
|
APP_SPARKKIOSK_PORT="21214"
|
|
|
|
# Generate RPC credentials
|
|
if [[ -z ${BITCOIN_RPC_USER+x} ]] || [[ -z ${BITCOIN_RPC_PASS+x} ]] || [[ -z ${BITCOIN_RPC_AUTH+x} ]]; then
|
|
echo "Generating auth credentials"
|
|
echo
|
|
BITCOIN_RPC_USER="umbrel"
|
|
BITCOIN_RPC_DETAILS=$("./scripts/rpcauth.py" "$BITCOIN_RPC_USER")
|
|
BITCOIN_RPC_PASS=$(echo "$BITCOIN_RPC_DETAILS" | tail -1)
|
|
BITCOIN_RPC_AUTH=$(echo "$BITCOIN_RPC_DETAILS" | head -2 | tail -1 | sed -e "s/^rpcauth=//")
|
|
fi
|
|
|
|
# Pull Tor image and generate Tor password
|
|
if [[ -z ${TOR_PASSWORD+x} ]] || [[ -z ${TOR_HASHED_PASSWORD+x} ]]; then
|
|
echo "Generating Tor password"
|
|
echo
|
|
TOR_PASSWORD=$("./scripts/rpcauth.py" "itdoesntmatter" | tail -1)
|
|
TOR_HASHED_PASSWORD=$(docker run --rm getumbrel/tor:v0.4.1.9 --quiet --hash-password "$TOR_PASSWORD")
|
|
fi
|
|
|
|
|
|
##########################################################
|
|
### Update config files with configuration variables #####
|
|
##########################################################
|
|
|
|
if [ "$BITCOIN_NETWORK" == "testnet" ]; then
|
|
# Set testnet ports
|
|
BITCOIN_RPC_PORT=18332
|
|
BITCOIN_P2P_PORT=18333
|
|
# Switch Bitcoin Core to testnet
|
|
sed -i '1s/^/testnet=1\n[test]\n\n/' "$BITCOIN_CONF_FILE"
|
|
# Switch LND to testnet
|
|
sed -i "s/bitcoin.mainnet=1/bitcoin.testnet=1/g;" "$LND_CONF_FILE"
|
|
# Uncomment testnet neutrino block and peers
|
|
sed -i "s/\# \[neutrino\]/\[neutrino\]/g;" "$LND_CONF_FILE"
|
|
sed -i "s/\# neutrino.addpeer=testnet1-btcd.zaphq.io/neutrino.addpeer=testnet1-btcd.zaphq.io/g;" "$LND_CONF_FILE"
|
|
sed -i "s/\# neutrino.addpeer=testnet2-btcd.zaphq.io/neutrino.addpeer=testnet2-btcd.zaphq.io/g;" "$LND_CONF_FILE"
|
|
# Set electrs to testnet
|
|
sed -i "s/network = \"bitcoin\"/network = \"testnet\"/g;" "$ELECTRS_CONF_FILE"
|
|
|
|
fi
|
|
|
|
if [ "$BITCOIN_NETWORK" == "regtest" ]; then
|
|
# Set regtest ports
|
|
BITCOIN_RPC_PORT=18443
|
|
BITCOIN_P2P_PORT=18444
|
|
# Switch Bitcoin Core to regtest
|
|
sed -i '1s/^/regtest=1\n[regtest]\n\n/' "$BITCOIN_CONF_FILE"
|
|
# Switch LND to regtest
|
|
sed -i "s/bitcoin.mainnet=1/bitcoin.regtest=1/g;" "$LND_CONF_FILE"
|
|
# Use bitcoind as the node
|
|
sed -i "s/bitcoin.node=neutrino/bitcoin.node=bitcoind/g;" "$LND_CONF_FILE"
|
|
# Set electrs to regtest
|
|
sed -i "s/network = \"bitcoin\"/network = \"regtest\"/g;" "$ELECTRS_CONF_FILE"
|
|
fi
|
|
|
|
# Update RPC, P2P and ZMQ Ports
|
|
sed -i "s/rpcport=<port>/rpcport=$BITCOIN_RPC_PORT/g;" "$BITCOIN_CONF_FILE"
|
|
sed -i "s/port=<port>/port=$BITCOIN_P2P_PORT/g;" "$BITCOIN_CONF_FILE"
|
|
sed -i "/daemon_rpc_addr/s/<port>/$BITCOIN_RPC_PORT/g;" "$ELECTRS_CONF_FILE"
|
|
sed -i "s/BITCOIN_RPC_PORT=<port>/BITCOIN_RPC_PORT=$BITCOIN_RPC_PORT/g;" "$ENV_FILE"
|
|
sed -i "s/BITCOIN_P2P_PORT=<port>/BITCOIN_P2P_PORT=$BITCOIN_P2P_PORT/g;" "$ENV_FILE"
|
|
|
|
# Add rpcauth
|
|
sed -i "s/rpcauth=<rpcauth>/rpcauth=$BITCOIN_RPC_AUTH/g;" "$BITCOIN_CONF_FILE"
|
|
sed -i "s/BITCOIN_RPC_AUTH=<rpcauth>/BITCOIN_RPC_AUTH='$BITCOIN_RPC_AUTH'/g;" "$ENV_FILE"
|
|
# Add RPC credentials to lnd.conf
|
|
sed -i "s/bitcoind.rpcuser=<username>/bitcoind.rpcuser=$BITCOIN_RPC_USER/g;" "$LND_CONF_FILE"
|
|
sed -i "s/bitcoind.rpcpass=<password>/bitcoind.rpcpass=$BITCOIN_RPC_PASS/g;" "$LND_CONF_FILE"
|
|
# Add RPC credentials to env file
|
|
sed -i "s/BITCOIN_RPC_USER=<username>/BITCOIN_RPC_USER=$BITCOIN_RPC_USER/g;" "$ENV_FILE"
|
|
sed -i "s/BITCOIN_RPC_PASS=<password>/BITCOIN_RPC_PASS=$BITCOIN_RPC_PASS/g;" "$ENV_FILE"
|
|
|
|
# Add chain to env file
|
|
sed -i "s/BITCOIN_NETWORK=<network>/BITCOIN_NETWORK=$BITCOIN_NETWORK/g;" "$ENV_FILE"
|
|
|
|
# Add Tor password
|
|
sed -i "s/HashedControlPassword <password>/HashedControlPassword $TOR_HASHED_PASSWORD/g;" "$TOR_PROXY_CONF_FILE"
|
|
sed -i "s/torpassword=<password>/torpassword=$TOR_PASSWORD/g;" "$BITCOIN_CONF_FILE"
|
|
sed -i "s/tor.password=<password>/tor.password=$TOR_PASSWORD/g;" "$LND_CONF_FILE"
|
|
sed -i "s/TOR_PASSWORD=<password>/TOR_PASSWORD=$TOR_PASSWORD/g;" "$ENV_FILE"
|
|
sed -i "s/TOR_HASHED_PASSWORD=<password>/TOR_HASHED_PASSWORD=$TOR_HASHED_PASSWORD/g;" "$ENV_FILE"
|
|
|
|
# Store docker binary path
|
|
DOCKER_BINARY=$(readlink -f "$(which docker)")
|
|
sed -i "s#DOCKER_BINARY=<path>#DOCKER_BINARY=$DOCKER_BINARY#g;" "$ENV_FILE"
|
|
|
|
# Set Umbrel version in electrs banner
|
|
sed -i "/server_banner/s/<version>/$UMBREL_VERSION/g;" "$ELECTRS_CONF_FILE"
|
|
|
|
# Add hostname to lnd.conf for TLS certificate
|
|
DEVICE_HOSTNAME="$(hostname)"
|
|
sed -i "s/tlsextradomain=<hostname>/tlsextradomain=$DEVICE_HOSTNAME.local/g;" "$LND_CONF_FILE"
|
|
|
|
# If node is already synced, do not reset to neutrino
|
|
if [[ -f "${STATUS_DIR}/node-status-bitcoind-ready" ]]; then
|
|
sed -i "s/bitcoin.node=.*/bitcoin.node=bitcoind/g;" "$LND_CONF_FILE"
|
|
fi
|
|
|
|
# Set LND fee URL (but only for mainnet Neutrino)
|
|
LND_FEE_URL=""
|
|
if [[ "$BITCOIN_NETWORK" == "mainnet" ]] && [[ ! -f "${STATUS_DIR}/node-status-bitcoind-ready" ]]; then
|
|
LND_FEE_URL="https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json"
|
|
fi
|
|
|
|
# TODO: Update all the above code to use this simpler logic
|
|
for template in "${NGINX_CONF_FILE}" "${BITCOIN_CONF_FILE}" "${LND_CONF_FILE}" "${TOR_PROXY_CONF_FILE}" "${TOR_SERVER_CONF_FILE}" "${ELECTRS_CONF_FILE}" "${ENV_FILE}"; do
|
|
# Umbrel
|
|
sed -i "s/<network-ip>/${NETWORK_IP}/g" "${template}"
|
|
sed -i "s/<gateway-ip>/${GATEWAY_IP}/g" "${template}"
|
|
sed -i "s/<nginx-ip>/${NGINX_IP}/g" "${template}"
|
|
sed -i "s/<nginx-port>/${NGINX_PORT}/g" "${template}"
|
|
sed -i "s/<dashboard-ip>/${DASHBOARD_IP}/g" "${template}"
|
|
sed -i "s/<manager-ip>/${MANAGER_IP}/g" "${template}"
|
|
sed -i "s/<middleware-ip>/${MIDDLEWARE_IP}/g" "${template}"
|
|
sed -i "s/<neutrino-switcher-ip>/${NEUTRINO_SWITCHER_IP}/g" "${template}"
|
|
sed -i "s/<bitcoin-ip>/${BITCOIN_IP}/g" "${template}"
|
|
sed -i "s/<bitcoin-p2p-port>/${BITCOIN_P2P_PORT}/g" "${template}"
|
|
sed -i "s/<bitcoin-rpc-port>/$BITCOIN_RPC_PORT/g" "${template}"
|
|
sed -i "s/<lnd-ip>/${LND_IP}/g" "${template}"
|
|
sed -i "s/<lnd-grpc-port>/${LND_GRPC_PORT}/g" "${template}"
|
|
sed -i "s/<lnd-rest-port>/${LND_REST_PORT}/g" "${template}"
|
|
sed -i "s/<electrum-ip>/${ELECTRUM_IP}/g" "${template}"
|
|
sed -i "s/<electrum-port>/${ELECTRUM_PORT}/g" "${template}"
|
|
sed -i "s/<tor-proxy-ip>/${TOR_PROXY_IP}/g" "${template}"
|
|
sed -i "s/<tor-proxy-port>/${TOR_PROXY_PORT}/g" "${template}"
|
|
sed -i "s/<tor-server-ip>/${TOR_SERVER_IP}/g" "${template}"
|
|
sed -i "s/<zmq-rawblock-port>/${BITCOIN_ZMQ_RAWBLOCK_PORT}/g;" "${template}"
|
|
sed -i "s/<zmq-rawtx-port>/${BITCOIN_ZMQ_RAWTX_PORT}/g;" "${template}"
|
|
sed -i "s/<zmq-hashblock-port>/${BITCOIN_ZMQ_HASHBLOCK_PORT}/g;" "${template}"
|
|
sed -i "s/<zmq-sequence-port>/${BITCOIN_ZMQ_SEQUENCE_PORT}/g;" "${template}"
|
|
sed -i "s#<lndfeeurl>#${LND_FEE_URL}#g;" "${template}"
|
|
|
|
# Apps
|
|
sed -i "s/<app-btc-rpc-explorer-ip>/${APP_BTC_RPC_EXPLORER_IP}/g" "${template}"
|
|
sed -i "s/<app-btc-rpc-explorer-port>/${APP_BTC_RPC_EXPLORER_PORT}/g" "${template}"
|
|
sed -i "s/<app-thunderhub-ip>/${APP_THUNDERHUB_IP}/g" "${template}"
|
|
sed -i "s/<app-thunderhub-port>/${APP_THUNDERHUB_PORT}/g" "${template}"
|
|
sed -i "s/<app-sphinx-relay-ip>/${APP_SPHINX_RELAY_IP}/g" "${template}"
|
|
sed -i "s/<app-sphinx-relay-port>/${APP_SPHINX_RELAY_PORT}/g" "${template}"
|
|
sed -i "s/<app-ride-the-lightning-ip>/${APP_RIDE_THE_LIGHTNING_IP}/g" "${template}"
|
|
sed -i "s/<app-ride-the-lightning-port>/${APP_RIDE_THE_LIGHTNING_PORT}/g" "${template}"
|
|
sed -i "s/<app-ride-the-lightning-loop-ip>/${APP_RIDE_THE_LIGHTNING_LOOP_IP}/g" "${template}"
|
|
sed -i "s/<app-ride-the-lightning-boltz-ip>/${APP_RIDE_THE_LIGHTNING_BOLTZ_IP}/g" "${template}"
|
|
sed -i "s/<app-lightning-terminal-ip>/${APP_LIGHTNING_TERMINAL_IP}/g" "${template}"
|
|
sed -i "s/<app-lightning-terminal-port>/${APP_LIGHTNING_TERMINAL_PORT}/g" "${template}"
|
|
sed -i "s/<app-specter-desktop-ip>/${APP_SPECTER_DESKTOP_IP}/g" "${template}"
|
|
sed -i "s/<app-specter-desktop-port>/${APP_SPECTER_DESKTOP_PORT}/g" "${template}"
|
|
sed -i "s/<app-btcpay-server-ip>/${APP_BTCPAY_SERVER_IP}/g" "${template}"
|
|
sed -i "s/<app-btcpay-server-port>/${APP_BTCPAY_SERVER_PORT}/g" "${template}"
|
|
sed -i "s/<app-btcpay-server-nbxplorer-ip>/${APP_BTCPAY_SERVER_NBXPLORER_IP}/g" "${template}"
|
|
sed -i "s/<app-btcpay-server-db-ip>/${APP_BTCPAY_SERVER_DB_IP}/g" "${template}"
|
|
sed -i "s/<app-lnbits-ip>/${APP_LNBITS_IP}/g" "${template}"
|
|
sed -i "s/<app-lnbits-port>/${APP_LNBITS_PORT}/g" "${template}"
|
|
sed -i "s/<app-mempool-ip>/${APP_MEMPOOL_IP}/g" "${template}"
|
|
sed -i "s/<app-mempool-port>/${APP_MEMPOOL_PORT}/g" "${template}"
|
|
sed -i "s/<app-mempool-db-ip>/${APP_MEMPOOL_DB_IP}/g" "${template}"
|
|
sed -i "s/<app-mempool-api-ip>/${APP_MEMPOOL_API_IP}/g" "${template}"
|
|
sed -i "s/<app-samourai-server-ip>/${APP_SAMOURAI_SERVER_IP}/g" "${template}"
|
|
sed -i "s/<app-samourai-server-dojo-port>/${APP_SAMOURAI_SERVER_DOJO_PORT}/g" "${template}"
|
|
sed -i "s/<app-samourai-server-connect-port>/${APP_SAMOURAI_SERVER_CONNECT_PORT}/g" "${template}"
|
|
sed -i "s/<app-samourai-server-whirlpool-ip>/${APP_SAMOURAI_SERVER_WHIRLPOOL_IP}/g" "${template}"
|
|
sed -i "s/<app-samourai-server-whirlpool-port>/${APP_SAMOURAI_SERVER_WHIRLPOOL_PORT}/g" "${template}"
|
|
sed -i "s/<app-samourai-server-db-ip>/${APP_SAMOURAI_SERVER_DB_IP}/g" "${template}"
|
|
sed -i "s/<app-samourai-server-node-ip>/${APP_SAMOURAI_SERVER_NODE_IP}/g" "${template}"
|
|
sed -i "s/<app-bluewallet-lndhub-ip>/${APP_BLUEWALLET_LNDHUB_IP}/g" "${template}"
|
|
sed -i "s/<app-bluewallet-lndhub-port>/${APP_BLUEWALLET_LNDHUB_PORT}/g" "${template}"
|
|
sed -i "s/<app-bluewallet-redis-ip>/${APP_BLUEWALLET_REDIS_IP}/g" "${template}"
|
|
sed -i "s/<app-nextcloud-port>/${APP_NEXTCLOUD_PORT}/g" "${template}"
|
|
sed -i "s/<app-nextcloud-ip>/${APP_NEXTCLOUD_IP}/g" "${template}"
|
|
sed -i "s/<app-nextcloud-db-ip>/${APP_NEXTCLOUD_DB_IP}/g" "${template}"
|
|
sed -i "s/<app-nextcloud-redis-ip>/${APP_NEXTCLOUD_REDIS_IP}/g" "${template}"
|
|
sed -i "s/<app-nextcloud-cron-ip>/${APP_NEXTCLOUD_CRON_IP}/g" "${template}"
|
|
sed -i "s/<app-pi-hole-port>/${APP_PI_HOLE_PORT}/g" "${template}"
|
|
sed -i "s/<app-pi-hole-ip>/${APP_PI_HOLE_IP}/g" "${template}"
|
|
sed -i "s/<app-home-assistant-port>/${APP_HOME_ASSISTANT_PORT}/g" "${template}"
|
|
sed -i "s/<app-home-assistant-ip>/${APP_HOME_ASSISTANT_IP}/g" "${template}"
|
|
sed -i "s/<app-gitea-port>/${APP_GITEA_PORT}/g" "${template}"
|
|
sed -i "s/<app-gitea-ssh-port>/${APP_GITEA_SSH_PORT}/g" "${template}"
|
|
sed -i "s/<app-gitea-ip>/${APP_GITEA_IP}/g" "${template}"
|
|
sed -i "s/<app-gitea-db-ip>/${APP_GITEA_DB_IP}/g" "${template}"
|
|
sed -i "s/<app-simple-torrent-port>/${APP_SIMPLETORRENT_PORT}/g" "${template}"
|
|
sed -i "s/<app-simple-torrent-ip>/${APP_SIMPLETORRENT_IP}/g" "${template}"
|
|
sed -i "s/<app-photoprism-ip>/${APP_PHOTOPRISM_IP}/g" "${template}"
|
|
sed -i "s/<app-photoprism-port>/${APP_PHOTOPRISM_PORT}/g" "${template}"
|
|
sed -i "s/<app-photoprism-db-ip>/${APP_PHOTOPRISM_DB_IP}/g" "${template}"
|
|
sed -i "s/<app-synapse-ip>/${APP_SYNAPSE_IP}/g" "${template}"
|
|
sed -i "s/<app-synapse-port>/${APP_SYNAPSE_PORT}/g" "${template}"
|
|
sed -i "s/<app-element-ip>/${APP_ELEMENT_IP}/g" "${template}"
|
|
sed -i "s/<app-element-port>/${APP_ELEMENT_PORT}/g" "${template}"
|
|
sed -i "s/<app-vaultwarden-ip>/${APP_VAULTWARDEN_IP}/g" "${template}"
|
|
sed -i "s/<app-vaultwarden-port>/${APP_VAULTWARDEN_PORT}/g" "${template}"
|
|
sed -i "s/<app-code-server-ip>/${APP_CODE_SERVER_IP}/g" "${template}"
|
|
sed -i "s/<app-code-server-port>/${APP_CODE_SERVER_PORT}/g" "${template}"
|
|
sed -i "s/<app-squeaknode-ip>/${APP_SQUEAKNODE_IP}/g" "${template}"
|
|
sed -i "s/<app-squeaknode-port>/${APP_SQUEAKNODE_PORT}/g" "${template}"
|
|
sed -i "s/<app-squeaknode-grpc-port>/${APP_SQUEAKNODE_GRPC_PORT}/g" "${template}"
|
|
sed -i "s/<app-squeaknode-p2p-port>/${APP_SQUEAKNODE_P2P_PORT}/g" "${template}"
|
|
sed -i "s/<app-squeaknode-p2p-testnet-port>/${APP_SQUEAKNODE_P2P_TESTNET_PORT}/g" "${template}"
|
|
sed -i "s/<app-krystal-bull-ip>/${APP_KRYSTAL_BULL_IP}/g" "${template}"
|
|
sed -i "s/<app-krystal-bull-port>/${APP_KRYSTAL_BULL_PORT}/g" "${template}"
|
|
sed -i "s/<app-krystal-bull-server-ip>/${APP_KRYSTAL_BULL_SERVER_IP}/g" "${template}"
|
|
sed -i "s/<app-node-red-ip>/${APP_NODE_RED_IP}/g" "${template}"
|
|
sed -i "s/<app-node-red-port>/${APP_NODE_RED_PORT}/g" "${template}"
|
|
sed -i "s/<app-lnmarkets-ip>/${APP_LNMARKETS_IP}/g" "${template}"
|
|
sed -i "s/<app-lnmarkets-port>/${APP_LNMARKETS_PORT}/g" "${template}"
|
|
sed -i "s/<app-electrumx-ip>/${APP_ELECTRUMX_IP}/g" "${template}"
|
|
sed -i "s/<app-electrumx-port>/${APP_ELECTRUMX_PORT}/g" "${template}"
|
|
sed -i "s/<app-tallycoin-connect-ip>/${APP_TALLYCOIN_CONNECT_IP}/g" "${template}"
|
|
sed -i "s/<app-tallycoin-connect-port>/${APP_TALLYCOIN_CONNECT_PORT}/g" "${template}"
|
|
sed -i "s/<app-syncthing-ip>/${APP_SYNCTHING_IP}/g" "${template}"
|
|
sed -i "s/<app-syncthing-port>/${APP_SYNCTHING_PORT}/g" "${template}"
|
|
sed -i "s/<app-syncthing-sync-port>/${APP_SYNCTHING_SYNC_PORT}/g" "${template}"
|
|
sed -i "s/<app-uptime-kuma-port>/${APP_UPTIME_KUMA_PORT}/g" "${template}"
|
|
sed -i "s/<app-uptime-kuma-ip>/${APP_UPTIME_KUMA_IP}/g" "${template}"
|
|
sed -i "s/<app-helipad-port>/${APP_HELIPAD_PORT}/g" "${template}"
|
|
sed -i "s/<app-helipad-ip>/${APP_HELIPAD_IP}/g" "${template}"
|
|
sed -i "s/<app-itchysats-ip>/${APP_ITCHYSATS_IP}/g" "${template}"
|
|
sed -i "s/<app-itchysats-port>/${APP_ITCHYSATS_PORT}/g" "${template}"
|
|
sed -i "s/<app-lightning-shell-port>/${APP_LIGHTNING_SHELL_PORT}/g" "${template}"
|
|
sed -i "s/<app-lightning-shell-ip>/${APP_LIGHTNING_SHELL_IP}/g" "${template}"
|
|
sed -i "s/<app-satsale-port>/${APP_SATSALE_PORT}/g" "${template}"
|
|
sed -i "s/<app-satsale-ip>/${APP_SATSALE_IP}/g" "${template}"
|
|
sed -i "s/<app-bitfeed-ip>/${APP_BITFEED_IP}/g" "${template}"
|
|
sed -i "s/<app-bitfeed-port>/${APP_BITFEED_PORT}/g" "${template}"
|
|
sed -i "s/<app-bitfeed-api-ip>/${APP_BITFEED_API_IP}/g" "${template}"
|
|
sed -i "s/<app-bitfeed-api-port>/${APP_BITFEED_API_PORT}/g" "${template}"
|
|
sed -i "s/<app-kollider-ip>/${APP_KOLLIDER_IP}/g" "${template}"
|
|
sed -i "s/<app-kollider-port>/${APP_KOLLIDER_PORT}/g" "${template}"
|
|
sed -i "s/<app-kollider-ws-ip>/${APP_KOLLIDER_WS_IP}/g" "${template}"
|
|
sed -i "s/<app-kollider-ws-port>/${APP_KOLLIDER_WS_PORT}/g" "${template}"
|
|
sed -i "s/<app-kollider-hh-ip>/${APP_KOLLIDER_HH_IP}/g" "${template}"
|
|
sed -i "s/<app-suredbits-wallet-ip>/${APP_SUREDBITS_WALLET_IP}/g" "${template}"
|
|
sed -i "s/<app-suredbits-wallet-port>/${APP_SUREDBITS_WALLET_PORT}/g" "${template}"
|
|
sed -i "s/<app-suredbits-wallet-server-ip>/${APP_SUREDBITS_WALLET_SERVER_IP}/g" "${template}"
|
|
sed -i "s/<app-suredbits-wallet-p2p-port>/${APP_SUREDBITS_WALLET_P2P_PORT}/g" "${template}"
|
|
sed -i "s/<app-lndg-ip>/${APP_LNDG_IP}/g" "${template}"
|
|
sed -i "s/<app-lndg-port>/${APP_LNDG_PORT}/g" "${template}"
|
|
sed -i "s/<app-urbit-ip>/${APP_URBIT_IP}/g" "${template}"
|
|
sed -i "s/<app-urbit-port>/${APP_URBIT_PORT}/g" "${template}"
|
|
sed -i "s/<app-urbit-p2p-port>/${APP_URBIT_P2P_PORT}/g" "${template}"
|
|
sed -i "s/<app-usocial-ip>/${APP_USOCIAL_IP}/g" "${template}"
|
|
sed -i "s/<app-usocial-port>/${APP_USOCIAL_PORT}/g" "${template}"
|
|
sed -i "s/<app-usocial-fetcher-ip>/${APP_USOCIAL_FETCHER_IP}/g" "${template}"
|
|
sed -i "s/<app-tailscale-ip>/${APP_TAILSCALE_IP}/g" "${template}"
|
|
sed -i "s/<app-tailscale-port>/${APP_TAILSCALE_PORT}/g" "${template}"
|
|
sed -i "s/<app-urbit-bitcoin-connector-ip>/${APP_URBIT_BITCOIN_CONNECTOR_IP}/g" "${template}"
|
|
sed -i "s/<app-urbit-bitcoin-connector-port>/${APP_URBIT_BITCOIN_CONNECTOR_PORT}/g" "${template}"
|
|
sed -i "s/<app-urbit-bitcoin-connector-server-port>/${APP_URBIT_BITCOIN_CONNECTOR_SERVER_PORT}/g" "${template}"
|
|
sed -i "s/<app-snowflake-ip>/${APP_SNOWFLAKE_IP}/g" "${template}"
|
|
sed -i "s/<app-snowflake-port>/${APP_SNOWFLAKE_PORT}/g" "${template}"
|
|
sed -i "s/<app-snowflake-proxy-ip>/${APP_SNOWFLAKE_PROXY_IP}/g" "${template}"
|
|
sed -i "s/<app-jam-ip>/${APP_JAM_IP}/g" "${template}"
|
|
sed -i "s/<app-jam-port>/${APP_JAM_PORT}/g" "${template}"
|
|
sed -i "s/<app-bleskomat-server-port>/${APP_BLESKOMAT_SERVER_PORT}/g" "${template}"
|
|
sed -i "s/<app-bleskomat-server-ip>/${APP_BLESKOMAT_SERVER_IP}/g" "${template}"
|
|
sed -i "s/<app-bleskomat-server-db-ip>/${APP_BLESKOMAT_SERVER_DB_IP}/g" "${template}"
|
|
sed -i "s/<app-agora-ip>/${APP_AGORA_IP}/g" "${template}"
|
|
sed -i "s/<app-agora-port>/${APP_AGORA_PORT}/g" "${template}"
|
|
sed -i "s/<app-agora-server-ip>/${APP_AGORA_SERVER_IP}/g" "${template}"
|
|
sed -i "s/<app-agora-filebrowser-ip>/${APP_AGORA_FILEBROWSER_IP}/g" "${template}"
|
|
sed -i "s/<app-sparkkiosk-ip>/${APP_SPARKKIOSK_IP}/g" "${template}"
|
|
sed -i "s/<app-sparkkiosk-port>/${APP_SPARKKIOSK_PORT}/g" "${template}"
|
|
done
|
|
|
|
##########################################################
|
|
############## Override main config files ################
|
|
##########################################################
|
|
|
|
mv -f "$NGINX_CONF_FILE" "./nginx/nginx.conf"
|
|
mv -f "$BITCOIN_CONF_FILE" "./bitcoin/bitcoin.conf"
|
|
mv -f "$TOR_SERVER_CONF_FILE" "./tor/torrc-server"
|
|
mv -f "$TOR_PROXY_CONF_FILE" "./tor/torrc-proxy"
|
|
mv -f "$ELECTRS_CONF_FILE" "./electrs/electrs.toml"
|
|
mv -f "$ENV_FILE" "./.env"
|
|
|
|
# Only write LND config if one doesn't already exist to preserve any user changes.
|
|
if [[ -f "./lnd/lnd.conf" ]]; then
|
|
echo "Skipping lnd.conf update to preserve user changes..."
|
|
rm "$LND_CONF_FILE"
|
|
else
|
|
mv -f "$LND_CONF_FILE" "./lnd/lnd.conf"
|
|
fi
|
|
|
|
##########################################################
|
|
######### Generate hidden services on first run ##########
|
|
##########################################################
|
|
|
|
# Prevents CORS issue if dashboard's hidden service
|
|
# doesn't exist on the first run
|
|
if [[ ! -f "${STATUS_DIR}/configured" ]]; then
|
|
echo "Generating hidden services..."
|
|
echo
|
|
docker-compose up --detach tor_proxy
|
|
wait_for_tor=10
|
|
while [[ ! -f "${UMBREL_ROOT}/tor/data/web/hostname" ]]; do
|
|
if [[ "${wait_for_tor}" == 0 ]]; then
|
|
echo "Dashboard's hidden service file wasn't created..."
|
|
echo
|
|
break
|
|
fi
|
|
sleep 1
|
|
((wait_for_tor--))
|
|
done
|
|
docker-compose down
|
|
fi
|
|
|
|
##########################################################
|
|
################ Configuration complete ##################
|
|
##########################################################
|
|
|
|
echo "Configuring permissions..."
|
|
echo
|
|
find "$UMBREL_ROOT" -path "$UMBREL_ROOT/app-data" -prune -o -exec chown 1000:1000 {} + || true
|
|
|
|
# Create configured status
|
|
touch "${STATUS_DIR}/configured"
|
|
|
|
echo "Configuration successful"
|
|
echo "You can now start Umbrel by running:"
|
|
echo " sudo ./scripts/start"
|
|
echo
|
|
|