Browse Source

Add tor relay fragment (#190)

* Add tor relay fragment

* remove extra ,

* use same tor container for relay

* remove \ns

* use own container for tor relay because of https://trac.torproject.org/projects/tor/ticket/8742

* be explicit with ports

* fix container name

* fix duplicate config

* fix config clash

* do not set daemon config item

* add info about tor requirements and legal implications
feature/lndseedbackup
Andrew Camilleri 5 years ago
committed by Nicolas Dorier
parent
commit
3ff6a88d8e
  1. 12
      Generated/torrc-relay.tmpl
  2. 4
      Generated/torrc.tmpl
  3. 3
      README.md
  4. 4
      btcpay-setup.sh
  5. 33
      docker-compose-generator/docker-fragments/opt-add-tor-relay.yml
  6. 4
      helpers.sh

12
Generated/torrc-relay.tmpl

@ -0,0 +1,12 @@
ORPort 9001
DirPort 9030
ExitPolicy reject *:*
CookieAuthentication 1
Nickname {{ $.Env.TOR_RELAY_NICKNAME}}
ContactInfo {{ $.Env.TOR_RELAY_EMAIL}}
{{ if $.Env.ADDITIONAL_TORRC_CONFIG }}
{{ $.Env.ADDITIONAL_TORRC_CONFIG}}
{{ end }}

4
Generated/torrc.tmpl

@ -27,4 +27,8 @@ HiddenServicePort {{ $virtualPort }} {{ $containerNetwork.IP }}:{{ $port }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ if $.Env.ADDITIONAL_TORRC_CONFIG }}
{{ $.Env.ADDITIONAL_TORRC_CONFIG}}
{{ end }}

3
README.md

@ -108,6 +108,8 @@ 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.
* `BTCPAYGEN_EXCLUDE_FRAGMENTS`: Semicolon-separated list of fragments you want to forcefully exclude (eg. `litecoin-clightning`)
* `TOR_RELAY_NICKNAME`: If tor relay is activated with opt-add-tor-relay, the relay nickname
* `TOR_RELAY_EMAIL`: If tor relay is activated with opt-add-tor-relay, the email for Tor to contact you regarding your relay
Additionally, there are specific environment variables for some addons:
@ -153,6 +155,7 @@ Available `BTCPAYGEN_ADDITIONAL_FRAGMENTS` currently are:
* [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.
* [opt-txindex](docker-compose-generator/docker-fragments/opt-txindex.yml), to enable txindex=1 in bitcoin.conf if you require txindexing for Bisq, DOJO, Esplora, etc.
* [opt-unsafe-expose](docker-compose-generator/docker-fragments/opt-unsafe-expose.yml), to unsafely expose bitcoind P2P port 8333 if you require P2P for Bisq, DOJO, Esplora, etc. WARNING: ONLY USE ON TRUSTED LAN OR WITH FIREWALL RULES WHITELISTING SPECIFIC HOSTS
* [opt-add-tor-relay](docker-compose-generator/docker-fragments/opt-add-tor-relay.yml), for a non-exit tor relay. Make sure to have ports 9001 and 9030 accessible externally. [Please read the legal implications of running a tor relay](https://www.eff.org/torchallenge/faq.html) and [what resources are used to operate the relay](https://trac.torproject.org/projects/tor/wiki/TorRelayGuide#RelayRequirements).
You can also create your own [custom fragments](#how-can-i-customize-the-generated-docker-compose-file).

4
btcpay-setup.sh

@ -104,6 +104,8 @@ Add-on specific variables:
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)
TOR_RELAY_NICKNAME: If tor relay is activated with opt-add-tor-relay, the relay nickname
TOR_RELAY_EMAIL: If tor relay is activated with opt-add-tor-relay, the email for Tor to contact you regarding your relay
END
}
START=""
@ -301,6 +303,8 @@ BTCPAYGEN_ADDITIONAL_FRAGMENTS:$BTCPAYGEN_ADDITIONAL_FRAGMENTS
BTCPAYGEN_EXCLUDE_FRAGMENTS:$BTCPAYGEN_EXCLUDE_FRAGMENTS
BTCPAY_IMAGE:$BTCPAY_IMAGE
ACME_CA_URI:$ACME_CA_URI
TOR_RELAY_NICKNAME: $TOR_RELAY_NICKNAME
TOR_RELAY_EMAIL: $TOR_RELAY_EMAIL
----------------------
Additional exported variables:
BTCPAY_DOCKER_COMPOSE=$BTCPAY_DOCKER_COMPOSE

33
docker-compose-generator/docker-fragments/opt-add-tor-relay.yml

@ -0,0 +1,33 @@
version: "3"
services:
tor-relay-gen:
restart: unless-stopped
image: btcpayserver/docker-gen:0.7.6
container_name: tor-relay-gen
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "./torrc-relay.tmpl:/etc/docker-gen/templates/torrc.tmpl:ro"
- "tor_relay_torrcdir:/usr/local/etc/tor"
entrypoint: /usr/local/bin/docker-gen -notify-sighup tor-relay -watch -wait 5s:30s /etc/docker-gen/templates/torrc.tmpl /usr/local/etc/tor/torrc-2
links:
- tor-relay
environment:
TOR_RELAY_NICKNAME: ${TOR_RELAY_NICKNAME}
TOR_RELAY_EMAIL: ${TOR_RELAY_EMAIL}
tor-relay:
restart: unless-stopped
image: btcpayserver/tor:0.4.1.5
container_name: tor-relay
environment:
TOR_PASSWORD: btcpayserver
TOR_ADDITIONAL_CONFIG: /usr/local/etc/tor/torrc-2
volumes:
- "tor_relay_datadir:/home/tor/.tor"
- "tor_relay_torrcdir:/usr/local/etc/tor"
ports:
- "9001:9001"
- "9030:9030"
volumes:
tor_relay_datadir:
tor_relay_torrcdir:

4
helpers.sh

@ -87,7 +87,9 @@ BTCPAY_SSHAUTHORIZEDKEYS=$BTCPAY_SSHAUTHORIZEDKEYS
LIBREPATRON_HOST=$LIBREPATRON_HOST
BTCTRANSMUTER_HOST=$BTCTRANSMUTER_HOST
BTCPAY_CRYPTOS=$BTCPAY_CRYPTOS
WOOCOMMERCE_HOST=$WOOCOMMERCE_HOST" > $BTCPAY_ENV_FILE
WOOCOMMERCE_HOST=$WOOCOMMERCE_HOST
TOR_RELAY_NICKNAME=$TOR_RELAY_NICKNAME
TOR_RELAY_EMAIL=$TOR_RELAY_EMAIL" > $BTCPAY_ENV_FILE
}
btcpay_up() {

Loading…
Cancel
Save