commit f7ca739dc34570914a9c8677b90eff0899ff7ec9 Author: lza_menace Date: Thu Dec 19 15:28:29 2024 -0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c5156b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +data +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6df9ab1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM lalanza808/wownero:v0.11.3.0 + +RUN apt update && apt install curl -y + +WORKDIR /data + +COPY run_wallet.sh /run_wallet.sh diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..c4af558 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,139 @@ +services: + + btcpayserver: + restart: unless-stopped + image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.13.7-altcoins} + container_name: btcpayserver + expose: + - "49392" + environment: + BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Application Name=btcpayserver;Database=btcpayserver${NBITCOIN_NETWORK:-mainnet} + BTCPAY_EXPLORERPOSTGRES: User ID=postgres;Host=postgres;Port=5432;Application Name=btcpayserver;MaxPoolSize=80;Database=nbxplorer${NBITCOIN_NETWORK:-mainnet} + BTCPAY_NETWORK: ${NBITCOIN_NETWORK:-mainnet} + BTCPAY_BIND: 0.0.0.0:49392 + BTCPAY_ROOTPATH: ${BTCPAY_ROOTPATH:-/} + BTCPAY_SSHCONNECTION: "root@host.docker.internal" + BTCPAY_SSHTRUSTEDFINGERPRINTS: ${BTCPAY_SSHTRUSTEDFINGERPRINTS} + BTCPAY_SSHKEYFILE: ${BTCPAY_SSHKEYFILE} + BTCPAY_SSHAUTHORIZEDKEYS: ${BTCPAY_SSHAUTHORIZEDKEYS} + BTCPAY_DEBUGLOG: btcpay.log + BTCPAY_UPDATEURL: https://api.github.com/repos/btcpayserver/btcpayserver/releases/latest + BTCPAY_DOCKERDEPLOYMENT: "true" + BTCPAY_CHAINS: "xmr" + BTCPAY_XMR_DAEMON_URI: http://wownerod:34568 + BTCPAY_XMR_WALLET_DAEMON_URI: http://wownerod_wallet:8000 + BTCPAY_XMR_WALLET_DAEMON_WALLETDIR: /root/xmr_wallet + HIDDENSERVICE_NAME: BTCPayServer + HIDDENSERVICE_REVERSEPROXY: nginx + BTCPAY_TORRCFILE: /usr/local/etc/tor/torrc-2 + BTCPAY_SOCKSENDPOINT: tor:9050 + labels: + traefik.enable: "false" + traefik.http.routers.btcpayserver.rule: Host(`${BTCPAY_HOST}`) + ports: + - 127.0.0.1:49392:49392 + links: + - postgres + volumes: + - "btcpay_datadir:/datadir" + - "nbxplorer_datadir:/root/.nbxplorer" + - "btcpay_pluginsdir:/root/.btcpayserver/Plugins" + - "./data:/root/xmr_wallet" + - "tor_servicesdir:/var/lib/tor/hidden_services" + - "tor_torrcdir:/usr/local/etc/tor/" + + wownerod: + restart: unless-stopped + build: + context: . + container_name: btcpayserver_wownerod + entrypoint: wownerod --rpc-bind-ip=0.0.0.0 --confirm-external-bind --rpc-bind-port=34568 --non-interactive --block-notify="/usr/bin/curl -X GET http://btcpayserver:49392/monerolikedaemoncallback/block?cryptoCode=wow&hash=%s" --hide-my-port --enable-dns-blocklist + expose: + - "34568" + volumes: + - "${DATA_PATH:-./data}:/root/.wownero" + + wownerod_wallet: + restart: unless-stopped + build: + context: . + container_name: btcpayserver_wownero_wallet + command: + bash /run_wallet.sh "${WALLET_PASS:-walletpass}" "http://wownerod:34568" + expose: + - "34568" + volumes: + - "./data:/data" + depends_on: + - wownerod + + nbxplorer: + restart: unless-stopped + image: nicolasdorier/nbxplorer:2.5.14 + container_name: btcpayserver_nbxplorer + expose: + - "32838" + environment: + NBXPLORER_NETWORK: ${NBITCOIN_NETWORK:-mainnet} + NBXPLORER_BIND: 0.0.0.0:32838 + NBXPLORER_TRIMEVENTS: 10000 + NBXPLORER_SIGNALFILESDIR: /datadir + NBXPLORER_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Application Name=nbxplorer;MaxPoolSize=20;Database=nbxplorer${NBITCOIN_NETWORK:-mainnet} + links: + - postgres + volumes: + - "nbxplorer_datadir:/datadir" + + postgres: + restart: unless-stopped + image: btcpayserver/postgres:13.13 + container_name: btcpayserver_postgres + shm_size: 256mb + command: ["-c", "random_page_cost=1.0", "-c", "shared_preload_libraries=pg_stat_statements"] + environment: + POSTGRES_HOST_AUTH_METHOD: trust + volumes: + - "postgres_datadir:/var/lib/postgresql/data" + + tor: + restart: unless-stopped + image: btcpayserver/tor:0.4.8.10 + container_name: btcpayserver_tor + environment: + TOR_PASSWORD: btcpayserver + TOR_ADDITIONAL_CONFIG: /usr/local/etc/tor/torrc-2 + TOR_EXTRA_ARGS: | + CookieAuthentication 1 + expose: + - "9050" + - "9051" + volumes: + - "tor_datadir:/home/tor/.tor" + - "tor_torrcdir:/usr/local/etc/tor" + - "tor_servicesdir:/var/lib/tor/hidden_services" + + tor-gen: + restart: unless-stopped + image: btcpayserver/docker-gen:0.10.7 + container_name: btcpayserver_tor-gen + volumes: + - "/var/run/docker.sock:/tmp/docker.sock:ro" + - "./torrc.tmpl:/etc/docker-gen/templates/torrc.tmpl:ro" + - "tor_torrcdir:/usr/local/etc/tor" + entrypoint: /usr/local/bin/docker-gen -notify-sighup tor -watch -wait 5s:30s /etc/docker-gen/templates/torrc.tmpl /usr/local/etc/tor/torrc-2 + links: + - tor + +volumes: + btcpay_datadir: + btcpay_pluginsdir: + xmr_wallet: + xmr_data: + nbxplorer_datadir: + postgres_datadir: + tor_datadir: + tor_torrcdir: + tor_servicesdir: + +networks: {} + diff --git a/run_wallet.sh b/run_wallet.sh new file mode 100644 index 0000000..3539bc3 --- /dev/null +++ b/run_wallet.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +export WALLET_CREDS="${1}" +export DAEMON_URI="${2}" +export WALLET_FILE="/data/wallet" +export PASSWORD_FILE="/data/password" + +sleep 2 + +env +set -x + +# Create new wallet if it doesn't exist +if [[ ! -f ${WALLET_FILE} ]]; then + echo $WALLET_CREDS > ${PASSWORD_FILE} + wownero-wallet-cli \ + --password "${WALLET_CREDS}" \ + --generate-new-wallet ${WALLET_FILE} \ + --daemon-address ${DAEMON_URI} \ + --password-file ${PASSWORD_FILE} \ + --trusted-daemon \ + --use-english-language-names \ + --mnemonic-language English \ + --command status +fi + +# Run RPC wallet +wownero-wallet-rpc \ + --daemon-address ${DAEMON_URI} \ + --wallet-file ${WALLET_FILE} \ + --password-file ${PASSWORD_FILE} \ + --rpc-bind-port 8000 \ + --rpc-bind-ip 0.0.0.0 \ + --disable-rpc-login \ + --confirm-external-bind \ + --log-file ${WALLET_FILE}.rpc.log \ + --log-level 0 \ + --non-interactive \ + --trusted-daemon \ + --tx-notify="/usr/bin/curl -X GET http://btcpayserver:49392/monerolikedaemoncallback/tx?cryptoCode=xmr&hash=%s" diff --git a/torrc.tmpl b/torrc.tmpl new file mode 100644 index 0000000..0bb8490 --- /dev/null +++ b/torrc.tmpl @@ -0,0 +1,34 @@ +{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }} + +{{ range $name, $containers := groupByMulti $ "Env.HIDDENSERVICE_NAME" "," }} +{{ $firstServicePort := true }} +{{ range $container := $containers }} + {{ range $knownNetwork := $CurrentContainer.Networks }} + {{ range $containerNetwork := $container.Networks }} + {{ if eq $knownNetwork.Name $containerNetwork.Name }} + {{ $containerOrReverseProxyName := coalesce $container.Env.HIDDENSERVICE_REVERSEPROXY $container.Name }} + + {{ range $reverseProxyContainer := where $ "Name" $containerOrReverseProxyName }} + {{ range $containerNetwork := where $reverseProxyContainer.Networks "Name" $knownNetwork.Name }} + {{ $port := coalesceempty (index $container.Env (print $name "_HIDDENSERVICE_PORT")) $container.Env.HIDDENSERVICE_PORT "80" }} + {{ $virtualPort := coalesceempty (index $container.Env (print $name "_HIDDENSERVICE_VIRTUAL_PORT")) $container.Env.HIDDENSERVICE_VIRTUAL_PORT $port }} + {{ if ne $containerNetwork.IP "" }} + {{ if $firstServicePort }} +# For the hidden service {{ $name }} +HiddenServiceDir /var/lib/tor/hidden_services/{{ $name }} + {{ $firstServicePort := false }} + {{ end }} +# Redirecting to {{ $containerOrReverseProxyName }} +HiddenServicePort {{ $virtualPort }} {{ $containerNetwork.IP }}:{{ $port }} + {{ end }} + {{ end }} + {{ end }} + {{ end }} + {{ end }} + {{ end }} +{{ end }} +{{ end }} + +{{ if $.Env.ADDITIONAL_TORRC_CONFIG }} +{{ $.Env.ADDITIONAL_TORRC_CONFIG}} +{{ end }} \ No newline at end of file