From 8534067595753d9c8f39749c597052a5f93ec8fd Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Wed, 22 May 2019 07:14:50 +0000 Subject: [PATCH] Add btc transmuter (#125) * Add Btc Transmuter as a btcpayserver-docker plugin * fix name * bump * Revert "bump " This reverts commit 8817fbdffbe91b5db96a5490a90adeb9a7737862. * change port for now * Revert "change port for now" This reverts commit 49348f013a99cfc6ed3d2ed2ea769ed484ff43cf. * store env vars for transmuter * add volumes * voumes * fix * fix * wip * wip * wip * small fixes * volume map correctly * bump * bump * bump * bump * attempt fix by renaming host service * bump * bump * bump * bump * bump and update config * fix config * bump + extension dir * bump and switch to btcpayserver org * bump * bump * remove crypto env spec * fix formatting * export var * fix export * fix env file * place vars in string * bump * bump * bump * bump * bump --- README.md | 2 ++ btcpay-setup.sh | 16 ++++++++++ .../opt-add-btctransmuter.yml | 32 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 docker-compose-generator/docker-fragments/opt-add-btctransmuter.yml diff --git a/README.md b/README.md index c57a934..c5a07cf 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ Additionally, there are specific environment variables for some addons: * `LIBREPATRON_HOST`: If libre patron is activated with [opt-add-librepatron](docker-compose-generator/docker-fragments/opt-add-librepatron.yml), the hostname of your libre patron website (eg. `librepatron.example.com`) * `WOOCOMMERCE_HOST`: If woocommerce is activated with [opt-add-woocommerce](docker-compose-generator/docker-fragments/opt-add-woocommerce.yml), the hostname of your woocommerce website (eg. `store.example.com`) +* `BTCTRANSMUTER_HOST`: If btctransmuter is activated with [opt-add-btctransmuter](docker-compose-generator/docker-fragments/opt-add-btctransmuter.yml), the hostname of your btctransmuter website (eg. `transmuter.example.com`) # Tooling @@ -173,6 +174,7 @@ Available `BTCPAYGEN_ADDITIONAL_FRAGMENTS` currently are: * [opt-add-librepatron](docker-compose-generator/docker-fragments/opt-add-librepatron.yml), for a self-hosted Patreon alternative backed by BTCPay (More information on this [github repository](https://github.com/JeffVandrewJr/patron), this add-on is maintained by [JeffVandrewJr](https://github.com/JeffVandrewJr). * [opt-add-woocommerce](docker-compose-generator/docker-fragments/opt-add-woocommerce.yml), for a self-hosted woocommerce with BTCPay Server plugin pre installed. * [opt-add-tor](docker-compose-generator/docker-fragments/opt-add-tor.yml), for exposing BTCPayServer, Woocommerce, your lightning nodes as hidden services and accept onion peers for your full node. Warning: This options is for working around NAT and firewall problems as well as to help protect your customer's privacy. This will not protect your privacy against a targeted attack against you. +* [opt-add-btctransmuter](docker-compose-generator/docker-fragments/opt-add-btctransmuter.yml), for a self-hosted IFTTT style service for crypto services such as fiat settlement. You can also create your own [custom fragments](#how-can-i-customize-the-generated-docker-compose-file). diff --git a/btcpay-setup.sh b/btcpay-setup.sh index faebd6d..c9c0643 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -67,6 +67,7 @@ Add-on specific variables: LIBREPATRON_HOST: If libre patron is activated with opt-add-librepatron, the hostname of your libre patron website (eg. librepatron.example.com) WOOCOMMERCE_HOST: If woocommerce is activated with opt-add-woocommerce, the hostname of your woocommerce website (eg. store.example.com) BTCPAYGEN_EXCLUDE_FRAGMENTS: Semicolon-separated list of fragments you want to forcefully exclude (eg. litecoin-clightning) + BTCTRANSMUTER_HOST: If btc transmuter is activated with opt-add-btctransmuter, the hostname of your btc transmuter website (eg. store.example.com) END } @@ -139,6 +140,17 @@ if [[ "$BTCPAYGEN_REVERSEPROXY" == "nginx" ]] && [[ "$BTCPAY_HOST" ]]; then BTCPAY_HOST="$DOMAIN_NAME" fi +BTCPAY_CRYPTOS="" +for i in "$BTCPAYGEN_CRYPTO1" "$BTCPAYGEN_CRYPTO2" "$BTCPAYGEN_CRYPTO3" "$BTCPAYGEN_CRYPTO4" "$BTCPAYGEN_CRYPTO5" "$BTCPAYGEN_CRYPTO5" "$BTCPAYGEN_CRYPTO6" "$BTCPAYGEN_CRYPTO7" "$BTCPAYGEN_CRYPTO8" +do + if [ ! -z "$i" ]; then + if [ ! -z "$BTCPAY_CRYPTOS" ]; then + BTCPAY_CRYPTOS="$BTCPAY_CRYPTOS;" + fi + BTCPAY_CRYPTOS="$BTCPAY_CRYPTOS$i" + fi +done + echo " -------SETUP----------- Parameters passed: @@ -146,6 +158,7 @@ BTCPAY_PROTOCOL:$BTCPAY_PROTOCOL BTCPAY_HOST:$BTCPAY_HOST LIBREPATRON_HOST:$LIBREPATRON_HOST WOOCOMMERCE_HOST:$WOOCOMMERCE_HOST +BTCTRANSMUTER_HOST:$BTCTRANSMUTER_HOST BTCPAY_HOST_SSHKEYFILE:$BTCPAY_HOST_SSHKEYFILE LETSENCRYPT_EMAIL:$LETSENCRYPT_EMAIL NBITCOIN_NETWORK:$NBITCOIN_NETWORK @@ -173,6 +186,7 @@ BTCPAY_ENV_FILE=$BTCPAY_ENV_FILE BTCPAYGEN_OLD_PREGEN=$BTCPAYGEN_OLD_PREGEN BTCPAY_SSHKEYFILE=$BTCPAY_SSHKEYFILE BTCPAY_SSHTRUSTEDFINGERPRINTS:$BTCPAY_SSHTRUSTEDFINGERPRINTS +BTCPAY_CRYPTOS:$BTCPAY_CRYPTOS ---------------------- " @@ -228,6 +242,8 @@ LIGHTNING_ALIAS=$LIGHTNING_ALIAS BTCPAY_SSHTRUSTEDFINGERPRINTS=$BTCPAY_SSHTRUSTEDFINGERPRINTS BTCPAY_SSHKEYFILE=$BTCPAY_SSHKEYFILE LIBREPATRON_HOST=$LIBREPATRON_HOST +BTCTRANSMUTER_HOST=$BTCTRANSMUTER_HOST +BTCPAY_CRYPTOS=$BTCPAY_CRYPTOS WOOCOMMERCE_HOST=$WOOCOMMERCE_HOST" > $BTCPAY_ENV_FILE echo -e "BTCPay Server docker-compose parameters saved in $BTCPAY_ENV_FILE\n" diff --git a/docker-compose-generator/docker-fragments/opt-add-btctransmuter.yml b/docker-compose-generator/docker-fragments/opt-add-btctransmuter.yml new file mode 100644 index 0000000..e1c0793 --- /dev/null +++ b/docker-compose-generator/docker-fragments/opt-add-btctransmuter.yml @@ -0,0 +1,32 @@ +version: "3" + +services: + btctransmuter: + restart: unless-stopped + image: btcpayserver/btctransmuter:0.0.19 + environment: + TRANSMUTER_Database: User ID=postgres;Host=postgres;Port=5432;Database=btctransmuter${NBITCOIN_NETWORK:-regtest} + TRANSMUTER_DatabaseType: postgres + TRANSMUTER_DataProtectionDir: data/keys + TRANSMUTER_ExtensionsDir: data/extensions + NBXplorer_Cryptos: ${BTCPAY_CRYPTOS} + NBXplorer_Uri: http://nbxplorer:32838/ + NBXplorer_NetworkType: ${NBITCOIN_NETWORK:-regtest} + NBXplorer_UseDefaultCookie: 1 + LETSENCRYPT_HOST: ${BTCTRANSMUTER_HOST} + LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-} + VIRTUAL_HOST: ${BTCTRANSMUTER_HOST} + VIRTUAL_HOST_NAME: "btctransmuter" + expose: + - "80" + links: + - postgres + - nbxplorer + volumes: + - "btctransmuter_datadir:/app/data" + - "nbxplorer_datadir:/root/.nbxplorer" + btcpayserver: + environment: + BTCPAY_EXTERNALSERVICES: "BTC Transmuter:${BTCPAY_PROTOCOL:-https}://${BTCTRANSMUTER_HOST};" +volumes: + btctransmuter_datadir: \ No newline at end of file