From 6dd33ba7688ff9782b7bc975b7cf6cb782766ccb Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Tue, 22 Jan 2019 23:56:58 +0900 Subject: [PATCH] Add librepatron support --- Production/nginx.tmpl | 15 ++++++++ README.md | 13 ++++++- btcpay-setup.sh | 6 ++- .../docker-fragments/opt-add-librepatron.yml | 37 +++++++++++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 docker-compose-generator/docker-fragments/opt-add-librepatron.yml diff --git a/Production/nginx.tmpl b/Production/nginx.tmpl index 5e67e91..024f3c7 100644 --- a/Production/nginx.tmpl +++ b/Production/nginx.tmpl @@ -344,6 +344,21 @@ server { {{ end }} {{ end }} + + {{ if eq $service_name "librepatron" }} + {{ range $container := $ }} + {{ $serviceName := (index $container.Labels "com.docker.compose.service") }} + {{ if (eq $serviceName "isso") }} + location /isso { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Script-Name /isso; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://isso:8080; + } + {{ end }} + {{ end }} + {{ end }} } {{ end }} diff --git a/README.md b/README.md index 4a54094..2f00db2 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,10 @@ You can read [the article](https://medium.com/@BtcpayServer/hosting-btcpay-serve * `BTCPAYGEN_DOCKER_IMAGE`: Optional, Specify which generator image to use if you have customized the C# generator. Set to `btcpayserver/docker-compose-generator:local` to build the generator locally at runtime. * `BTCPAY_IMAGE`: Optional, Specify which btcpayserver image to use if you have a customized btcpayserver. +Additionally, there are specific environment variables for some addons: + +* `LIBREPATRON_HOST`: If libre patron is activated, The hostname of your libre patron website (eg. `librepatron.example.com`) + # Tooling A wide variety of useful scripts are available once BTCPay is installed: @@ -156,10 +160,17 @@ Available `BTCPAYGEN_ADDITIONAL_FRAGMENTS` currently are: * [opt-save-storage-xxs](docker-compose-generator/docker-fragments/opt-save-storage-xxs.yml) will keep around 2 weeks of blocks (prune BTC for 5 GB) (lightning not supported) * [opt-lnd-autopilot](docker-compose-generator/docker-fragments/opt-lnd-autopilot.yml) will activate auto pilot on LND. (5 channels, 60% of allocation) * [opt-save-memory](docker-compose-generator/docker-fragments/opt-save-memory.yml) will decrease the default dbcache at the expense of longer synchronization time (Useful if your machine is less than 2GB) -* [opt-add-btcqbo](docker-compose-generator/docker-fragments/opt-add-btcqbo.yml) will allow you to create an invoice on Quickbooks which include a way for your customer to pay on BTCPay Server (More information on this [github repository](https://github.com/JeffVandrewJr/btcqbo/), this plugin is maintained by [JeffVandrewJr](https://github.com/JeffVandrewJr), see more on [this video](https://www.youtube.com/watch?v=srgwL9ozg6c)) +* [opt-add-btcqbo](docker-compose-generator/docker-fragments/opt-add-btcqbo.yml) will allow you to create an invoice on Quickbooks which include a way for your customer to pay on BTCPay Server (More information on this [github repository](https://github.com/JeffVandrewJr/btcqbo/), this add-on is maintained by [JeffVandrewJr](https://github.com/JeffVandrewJr), see more on [this video](https://www.youtube.com/watch?v=srgwL9ozg6c)) +* [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). You can also create your own [custom fragments](#how-can-i-customize-the-generated-docker-compose-file). +If you want to add an option to `BTCPAYGEN_ADDITIONAL_FRAGMENTS` and re-configure your install: +```bash +export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-lnd-autopilot" +. btcpay-setup.sh -i +``` + For example, if you want `btc` and `ltc` support with `nginx` and `clightning` inside `Generated/docker-compose.custom.yml`: Note: The first run might take a while, but following runs are instantaneous. diff --git a/btcpay-setup.sh b/btcpay-setup.sh index 8d09b31..75af55a 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -62,6 +62,8 @@ Environment variables: BTCPAY_HOST_SSHKEYFILE: Optional, SSH private key that BTCPay can use to connect to this VM's SSH server. This key will be copied on BTCPay's data directory BTCPAYGEN_DOCKER_IMAGE: Allows you to specify a custom docker image for the generator (Default: btcpayserver/docker-compose-generator) BTCPAY_IMAGE: Allows you to specify the btcpayserver docker image to use over the default version. (Default: current stable version of btcpayserver) +Add-on specific variables: + LIBREPATRON_HOST: If libre patron is activated, The hostname of your libre patron website (eg. librepatron.example.com) END } @@ -137,6 +139,7 @@ echo " -------SETUP----------- Parameters passed: BTCPAY_HOST:$BTCPAY_HOST +LIBREPATRON_HOST:$LIBREPATRON_HOST BTCPAY_HOST_SSHKEYFILE:$BTCPAY_HOST_SSHKEYFILE LETSENCRYPT_EMAIL:$LETSENCRYPT_EMAIL NBITCOIN_NETWORK:$NBITCOIN_NETWORK @@ -214,7 +217,8 @@ NBITCOIN_NETWORK=$NBITCOIN_NETWORK LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL LIGHTNING_ALIAS=$LIGHTNING_ALIAS BTCPAY_SSHTRUSTEDFINGERPRINTS=$BTCPAY_SSHTRUSTEDFINGERPRINTS -BTCPAY_SSHKEYFILE=$BTCPAY_SSHKEYFILE" > $BTCPAY_ENV_FILE +BTCPAY_SSHKEYFILE=$BTCPAY_SSHKEYFILE +LIBREPATRON_HOST=$LIBREPATRON_HOST" > $BTCPAY_ENV_FILE echo -e "BTCPay Server docker-compose parameters saved in $BTCPAY_ENV_FILE\n" . /etc/profile.d/btcpay-env.sh diff --git a/docker-compose-generator/docker-fragments/opt-add-librepatron.yml b/docker-compose-generator/docker-fragments/opt-add-librepatron.yml new file mode 100644 index 0000000..f710c41 --- /dev/null +++ b/docker-compose-generator/docker-fragments/opt-add-librepatron.yml @@ -0,0 +1,37 @@ +version: '3' +services: + librepatron: + container_name: librepatron + restart: unless-stopped + image: jvandrew/librepatron:0.6.69 + expose: + - "8006" + volumes: + - data-volume:/var/lib/db + - config-volume:/var/lib/config + environment: + COMMENTS_SUBURI: "1" + SITEURL: ${BTCPAY_PROTOCOL:-https}://${LIBREPATRON_HOST} + SECRET_KEY_LOCATION: /var/lib/db/key + DATABASE_URL: sqlite:////var/lib/db/app.db + VIRTUAL_HOST: ${LIBREPATRON_HOST} + LETSENCRYPT_HOST: ${LIBREPATRON_HOST} + LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-} + VIRTUAL_SERVICE_NAME: "librepatron" + + isso: + container_name: isso + restart: unless-stopped + stop_signal: SIGKILL + image: jvandrew/isso:atron.22 + expose: + - "8080" + volumes: + - data-volume:/var/lib/db + - config-volume:/var/lib/config + btcpayserver: + environment: + BTCPAY_EXTERNALSERVICES: "LibrePatron:${BTCPAY_PROTOCOL:-https}://${LIBREPATRON_HOST};" +volumes: + data-volume: + config-volume: