Browse Source

Merge pull request #152 from Samourai-Wallet/feat_mydojo_whirlpool

add new optional whirlpool container
use-env-var-docker
kenshin samourai 5 years ago
committed by GitHub
parent
commit
7ea3484fc7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 75
      doc/DOCKER_advanced_setups.md
  2. 83
      doc/DOCKER_setup.md
  3. 3
      docker/my-dojo/.env
  4. 20
      docker/my-dojo/conf/docker-whirlpool.conf.tpl
  5. 9
      docker/my-dojo/docker-compose.yaml
  6. 66
      docker/my-dojo/dojo.sh
  7. 16
      docker/my-dojo/install/install-scripts.sh
  8. 16
      docker/my-dojo/install/upgrade-scripts.sh
  9. 1
      docker/my-dojo/nginx/Dockerfile
  10. 15
      docker/my-dojo/nginx/whirlpool.conf
  11. 24
      docker/my-dojo/overrides/whirlpool.install.yaml
  12. 7
      docker/my-dojo/tor/restart.sh
  13. 78
      docker/my-dojo/whirlpool/Dockerfile
  14. 35
      docker/my-dojo/whirlpool/restart.sh

75
doc/DOCKER_advanced_setups.md

@ -9,6 +9,7 @@ A word of caution, though, the default values of these options try to maximize y
## Table of Content ##
- [Local indexer of Bitcoin addresses](#local_indexer)
- [Local Electrum server used as data source for imports/rescans](#local_electrum)
- [Local Whirlpool client](#local_whirlpool)
- [External Bitcoin full node](#external_bitcoind)
- [bitcoind RPC API ans ZMQ notifications exposed to external apps](#exposed_rpc_zmq)
- [Static onion address for bitcoind hidden service](#static_onion)
@ -117,6 +118,80 @@ nano ./conf/docker-node.conf
```
<a name="local_whirlpool"/>
## Local Whirlpool client ##
This setup allows to install and run a [Whirlpool client](https://github.com/Samourai-Wallet/whirlpool-client-cli) inside MyDojo.
The client can be configured and controlled through a REST API exposed as a Tor hidden service.
### Procedure ###
```
# If you're installing a new Dojo or if you're upgrading from a Dojo version < 1.6, edit the docker-whirlpool.conf.tpl file
nano ./conf/docker-whirlpool.conf.tpl
# Otherwise, edit the docker-whirlpool.conf file
nano ./conf/docker-whirlpool.conf
#
# Set the value of WHIRLPOOL_INSTALL to "on"
## Save and exit nano
#
```
### Installation of Whirlpool GUI ###
The [Whirlpool GUI application]((https://github.com/Samourai-Wallet/whirlpool-gui)) provides a graphical interface for your Whirlpool client.
These steps describe how to install the Whirlpool GUI application how a computer and how to connect it to your Whirlpool client.
**Requirements**
- MyDojo has been fully initialized,
- Whirlpool client has been activated in MyDojo,
- Your Samourai Wallet is paired to MyDojo,
- MyDojo is running.
- Tor browser is installed on the computer that will run the Whirlpool GUI application.
**Procedure**
- Retrieve the onion address of the API provided by your Whirlpool client
```
# Open a terminal console on the computer hosting your Dojo
# Retrieve the onion address of the Whirlpool API
./dojo.sh onion
```
- Install and configure the Whirlpool GUI application
```
# If needed, install Tor browser on the computer that will run the Whirlpool GUI application
# Launch the Tor browser
# Install the Whirlpool GUI application on the computer and launch it
# Select 'Advanced: remote CLI'
# Set 'CLI address' with 'http://your_onion_address' where your_onion_address is the address of the Whirlpool API
# Check that the 'Tor proxy' field has the correct socks5 port used by your Tor browser.
# Click 'Connect'.
# Paste the pairing payload from your mobile device when prompted:
# Select the Samourai Wallet Menu (3 dots top right),
# Go to Settings -> Transactions -> Pair to Whirlpool GUI,
# Copy the payload and send to your main computer using any method you prefer,
# Paste the payload.
# The GUI will restart and prompt for you to enter your Samourai Wallet passphrase.
# You are all set and ready to mix!
```
<a name="external_bitcoind"/>
## External Bitcoin full node ##

83
doc/DOCKER_setup.md

@ -27,42 +27,41 @@ MyDojo is a set of Docker containers providing a full Samourai backend composed
## Architecture ##
------------------- ------------------- --------------------
| Samourai Wallet | | Sentinel | | Bitcoin full nodes |
------------------- ------------------- --------------------
|_______________________|_______________________|
|
------------
Tor network
------------
|
Host machine | (Tor hidden services)
______________________________ | _____________________________
| | |
| --------- dmznet |
| --------| Tor |------------ |
| | --------- | |
| | | |
| --------- | |
| --| Nginx |-------- | |
| | --------- | | |
|- - - - -|- - - - - - - - - - -|- - - - - - - - -|- - - - - - |
| | | | |
| ---------- ---------- ---------- |
| | Nodejs |----------| Explorer |------| Bitcoind | |
| ---------- ---------- ---------- |
| | | | | |
| | ------- | | |
| | | | | |
| ---------- | ---------- | |
| | MySQL | ----| Indexer |----------- |
| ---------- ---------- |
| dojonet |
|______________________________________________________________|
------------------ -------------------- --------------- -----------------------
| Mobile Wallets | | Bitcoin full nodes | | Whirlpool GUI | | Whirlpool Coordinator |
------------------ -------------------- --------------- -----------------------
|_______________________|____________________|_______________________|
|
-------------
| |
---------------------- | Tor network |
| | |
| ------------
| |
| | (Tor hidden services)
_____ | ____________________________ | _________________________________________
| | | | |
| | | --------- dmznet |
| | | -----------| Tor |------------------------ |
| | | | --------- | |
| | --------- | |
| | | nginx | - - - - - - - - - - - - - - - - - - - - - -|- - - - - - |
| | --------- | |
| | | | | | |
| | --- | ---------------------------- | |
| | | | | | | |
| ----------- | ---------- ---------- ---------- |
| | whirlpool | | | Nodejs |----------| Explorer |------| Bitcoind | |
| ----------- | ---------- ---------- ---------- |
| | | | | | |
| | | ------- | | |
| | | | | | |
| | ---------- | ---------- | |
| | | MySQL | ----| Indexer |----------- |
| | ---------- ---------- |
| whirlnet | dojonet |
|_________________|______________________________________________________________|
Host machine
@ -160,6 +159,7 @@ This procedure allows to install a new Dojo from scratch.
* Dojo provides a few additional settings for advanced setups:
* installation of an address indexer used for fast imports and rescans,
* support of an external electrum server (ElectrumX or electrs) used for fast imports and rescans,
* installation of a Whirlpool client,
* static onion address for your full node,
* bitcoind RPC API exposed to external apps,
* use of an external full node,
@ -258,6 +258,7 @@ Available commands:
dojo.sh logs pushtx : display the logs of the pushTx API (nodejs)
dojo.sh logs pushtx-orchest : display the logs of the Orchestrator (nodejs)
dojo.sh logs explorer : display the logs of the Explorer
dojo.sh logs whirlpool : display the logs of the Whirlpool client
Available options (for api, tracker, pushtx, pushtx-orchest and explorer modules):
-d [VALUE] : select the type of log to be displayed.
@ -277,6 +278,12 @@ Available commands:
upgrade Upgrade your Dojo.
version Display the version of dojo.
whirlpool [action] Interact with the internal whirlpool-cli mdule."
Available actions:"
apikey : display the API key generated by whirlpool-cli."
reset : reset the whirlpool-cli instance (delete configuration file)."
```
@ -346,6 +353,10 @@ The maintenance tool is accessed as a Tor hidden service (static onion address).
The block explorer is accessed as a Tor hidden service (static onion address).
The Whirlpool API is accessed as a Tor hidden service (static onion address).
The Whirlpool client connects to the Whirlpool Coordinator hidden service.
The Bitcoin node only allows incoming connections from Tor (ephemeral onion address).
The Bitcoin node attempts outgoing connections to both Tor and clearnet nodes (through the Tor local proxy).

3
docker/my-dojo/.env

@ -14,10 +14,11 @@ DOJO_VERSION_TAG=1.6.0
DOJO_DB_VERSION_TAG=1.1.1
DOJO_BITCOIND_VERSION_TAG=1.5.0
DOJO_NODEJS_VERSION_TAG=1.6.0
DOJO_NGINX_VERSION_TAG=1.4.0
DOJO_NGINX_VERSION_TAG=1.5.0
DOJO_TOR_VERSION_TAG=1.4.0
DOJO_EXPLORER_VERSION_TAG=1.3.0
DOJO_INDEXER_VERSION_TAG=1.0.0
DOJO_WHIRLPOOL_VERSION_TAG=1.0.0
#########################################

20
docker/my-dojo/conf/docker-whirlpool.conf.tpl

@ -0,0 +1,20 @@
#########################################
# CONFIGURATION OF WHIRLPOOL CONTAINER
#########################################
# Install and run an instance of whirlpool-cli inside Docker
# Value: on | off
WHIRLPOOL_INSTALL=off
#
# EXPERT SETTINGS
#
# Activate debug logs
# Value: on | off
WHIRLPOOL_DEBUG=off
# Activate more debug logs
# Value: on | off
WHIRLPOOL_DEBUG_CLIENT=off

9
docker/my-dojo/docker-compose.yaml

@ -66,6 +66,8 @@ services:
depends_on:
- node
networks:
whirlnet:
ipv4_address: 172.30.1.3
dmznet:
ipv4_address: 172.29.1.3
dojonet:
@ -79,6 +81,7 @@ services:
env_file:
- ./.env
- ./conf/docker-explorer.conf
- ./conf/docker-whirlpool.conf
- ./conf/docker-tor.conf
restart: always
command: /restart.sh
@ -103,6 +106,12 @@ networks:
driver: default
config:
- subnet: 172.29.0.0/16
whirlnet:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.30.0.0/16
volumes:
data-mysql:

66
docker/my-dojo/dojo.sh

@ -14,6 +14,7 @@ source_file() {
}
# Source config files
source_file "$DIR/conf/docker-whirlpool.conf"
source_file "$DIR/conf/docker-indexer.conf"
source_file "$DIR/conf/docker-bitcoind.conf"
source_file "$DIR/conf/docker-explorer.conf"
@ -43,6 +44,10 @@ select_yaml_files() {
yamlFiles="$yamlFiles -f $DIR/overrides/indexer.install.yaml"
fi
if [ "$WHIRLPOOL_INSTALL" == "on" ]; then
yamlFiles="$yamlFiles -f $DIR/overrides/whirlpool.install.yaml"
fi
# Return yamlFiles
echo "$yamlFiles"
}
@ -236,6 +241,7 @@ uninstall() {
docker image rm -f samouraiwallet/dojo-nginx:"$DOJO_NGINX_VERSION_TAG"
docker image rm -f samouraiwallet/dojo-tor:"$DOJO_TOR_VERSION_TAG"
docker image rm -f samouraiwallet/dojo-indexer:"$DOJO_INDEXER_VERSION_TAG"
docker image rm -f samouraiwallet/dojo-whirlpool:"$DOJO_WHIRLPOOL_VERSION_TAG"
docker volume prune -f
return 0
@ -264,6 +270,7 @@ clean() {
del_images_for samouraiwallet/dojo-nginx "$DOJO_NGINX_VERSION_TAG"
del_images_for samouraiwallet/dojo-tor "$DOJO_TOR_VERSION_TAG"
del_images_for samouraiwallet/dojo-indexer "$DOJO_INDEXER_VERSION_TAG"
del_images_for samouraiwallet/dojo-whirlpool "$DOJO_WHIRLPOOL_VERSION_TAG"
}
# Upgrade
@ -334,6 +341,11 @@ onion() {
V3_ADDR=$( docker exec -it tor cat /var/lib/tor/hsv3dojo/hostname )
echo "Maintenance Tool hidden service address = $V3_ADDR"
if [ "$WHIRLPOOL_INSTALL" == "on" ]; then
V3_ADDR_WHIRLPOOL=$( docker exec -it tor cat /var/lib/tor/hsv3whirlpool/hostname )
echo "Whirlpool API hidden service address = $V3_ADDR_WHIRLPOOL"
fi
if [ "$BITCOIND_INSTALL" == "on" ]; then
V2_ADDR_BTCD=$( docker exec -it tor cat /var/lib/tor/hsv2bitcoind/hostname )
echo "bitcoind hidden service address = $V2_ADDR_BTCD"
@ -345,6 +357,29 @@ version() {
echo "Dojo v$DOJO_VERSION_TAG"
}
# Interact with whirlpool-cli
whirlpool() {
if [ "$WHIRLPOOL_INSTALL" == "off" ]; then
echo -e "Command not supported for your setup.\nCause: Your Dojo is not running a whirlpool client"
fi
case $1 in
apikey )
API_KEY=$( docker exec -it whirlpool cat /home/whirlpool/.whirlpool-cli/whirlpool-cli-config.properties | grep cli.apiKey= | cut -c 12-)
echo "$API_KEY"
;;
reset )
eval "docker exec -it whirlpool rm -f /home/whirlpool/.whirlpool-cli/*.json"
eval "docker exec -it whirlpool rm -f /home/whirlpool/.whirlpool-cli/whirlpool-cli-config.properties"
yamlFiles=$(select_yaml_files)
eval "docker-compose $yamlFiles restart whirlpool"
;;
* )
echo -e "Unkonwn action for the whirlpool command"
;;
esac
}
# Display logs
logs_node() {
if [ $3 -eq 0 ]; then
@ -362,9 +397,18 @@ logs_explorer() {
fi
}
logs_whirlpool() {
if [ $3 -eq 0 ]; then
docker exec -ti whirlpool tail -f /home/whirlpool/.whirlpool-cli/whirlpool-output.log
else
docker exec -ti whirlpool tail -n $3 /home/whirlpool/.whirlpool-cli/whirlpool-output.log
fi
}
logs() {
source_file "$DIR/conf/docker-bitcoind.conf"
source_file "$DIR/conf/docker-indexer.conf"
source_file "$DIR/conf/docker-whirlpool.conf"
source_file "$DIR/conf/docker-common.conf"
case $1 in
@ -400,6 +444,13 @@ logs() {
explorer )
logs_explorer $1 $2 $3
;;
whirlpool )
if [ "$WHIRLPOOL_INSTALL" == "on" ]; then
logs_whirlpool $1 $2 $3
else
echo -e "Command not supported for your setup.\nCause: Your Dojo is not running a whirlpool client"
fi
;;
* )
yamlFiles=$(select_yaml_files)
services="nginx node tor db"
@ -412,6 +463,9 @@ logs() {
if [ "$INDEXER_INSTALL" == "on" ]; then
services="$services indexer"
fi
if [ "$WHIRLPOOL_INSTALL" == "on" ]; then
services="$services whirlpool"
fi
eval "docker-compose $yamlFiles logs --tail=0 --follow $services"
;;
esac
@ -448,8 +502,9 @@ help() {
echo " dojo.sh logs pushtx : display the logs of the pushTx API (nodejs)"
echo " dojo.sh logs pushtx-orchest : display the logs of the pushTx Orchestrator (nodejs)"
echo " dojo.sh logs explorer : display the logs of the Explorer"
echo " dojo.sh logs whirlpool : display the logs of the Whirlpool client"
echo " "
echo " Available options (only available for api, tracker, pushtx, pushtx-orchest and explorer modules):"
echo " Available options (only available for api, tracker, pushtx, pushtx-orchest, explorer and whirlpool modules):"
echo " -d [VALUE] : select the type of log to be displayed."
echo " VALUE can be output (default) or error."
echo " -n [VALUE] : display the last VALUE lines"
@ -471,6 +526,12 @@ help() {
echo " --nocache : rebuild the docker containers without reusing the cached layers."
echo " "
echo " version Display the version of dojo"
echo " "
echo " whirlpool [action] Interact with the internal whirlpool-cli mdule."
echo " "
echo " Available actions:"
echo " apikey : display the API key generated by whirlpool-cli."
echo " reset : reset the whirlpool-cli instance (delete configuration file)."
}
@ -566,4 +627,7 @@ case "$subcommand" in
version )
version
;;
whirlpool )
whirlpool "$@"
;;
esac

16
docker/my-dojo/install/install-scripts.sh

@ -12,6 +12,12 @@ else
source ./conf/docker-explorer.conf.tpl
fi
if [ -f ./conf/docker-whirlpool.conf ]; then
source ./conf/docker-whirlpool.conf
else
source ./conf/docker-whirlpool.conf.tpl
fi
if [ -f ./conf/docker-common.conf ]; then
source ./conf/docker-common.conf
else
@ -76,6 +82,9 @@ init_config_files() {
cp ./conf/docker-indexer.conf.tpl ./conf/docker-indexer.conf
echo "Initialized docker-indexer.conf"
cp ./conf/docker-whirlpool.conf.tpl ./conf/docker-whirlpool.conf
echo "Initialized docker-whirlpool.conf"
if [ "$EXPLORER_INSTALL" == "on" ]; then
cp ./nginx/explorer.conf ./nginx/dojo-explorer.conf
else
@ -83,6 +92,13 @@ init_config_files() {
fi
echo "Initialized dojo-explorer.conf (nginx)"
if [ "$WHIRLPOOL_INSTALL" == "on" ]; then
cp ./nginx/whirlpool.conf ./nginx/dojo-whirlpool.conf
else
cp /dev/null ./nginx/dojo-ewhirlpool.conf
fi
echo "Initialized dojo-whirlpool.conf (nginx)"
# Initialize config files for nginx and the maintenance tool
if [ "$COMMON_BTC_NETWORK" == "testnet" ]; then
cp ./nginx/testnet.conf ./nginx/dojo.conf

16
docker/my-dojo/install/upgrade-scripts.sh

@ -12,6 +12,12 @@ else
source ./conf/docker-explorer.conf.tpl
fi
if [ -f ./conf/docker-whirlpool.conf ]; then
source ./conf/docker-whirlpool.conf
else
source ./conf/docker-whirlpool.conf.tpl
fi
source ./conf/docker-bitcoind.conf
# Confirm upgrade operation
@ -60,6 +66,9 @@ update_config_files() {
update_config_file ./conf/docker-indexer.conf ./conf/docker-indexer.conf.tpl
echo "Initialized docker-indexer.conf"
update_config_file ./conf/docker-whirlpool.conf ./conf/docker-whirlpool.conf.tpl
echo "Initialized docker-whirlpool.conf"
# Initialize config files for nginx and the maintenance tool
if [ "$EXPLORER_INSTALL" == "on" ]; then
cp ./nginx/explorer.conf ./nginx/dojo-explorer.conf
@ -68,6 +77,13 @@ update_config_files() {
fi
echo "Initialized dojo-explorer.conf (nginx)"
if [ "$WHIRLPOOL_INSTALL" == "on" ]; then
cp ./nginx/whirlpool.conf ./nginx/dojo-whirlpool.conf
else
cp /dev/null ./nginx/dojo-ewhirlpool.conf
fi
echo "Initialized dojo-whirlpool.conf (nginx)"
if [ "$COMMON_BTC_NETWORK" == "testnet" ]; then
cp ./nginx/testnet.conf ./nginx/dojo.conf
echo "Initialized dojo.conf (nginx)"

1
docker/my-dojo/nginx/Dockerfile

@ -10,6 +10,7 @@ RUN mkdir -p "$LOGS_DIR" && \
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./dojo.conf /etc/nginx/sites-enabled/dojo.conf
COPY ./dojo-explorer.conf /etc/nginx/sites-enabled/dojo-explorer.conf
COPY ./dojo-whirlpool.conf /etc/nginx/sites-enabled/dojo-whirlpool.conf
# Copy wait-for script
COPY ./wait-for /wait-for

15
docker/my-dojo/nginx/whirlpool.conf

@ -0,0 +1,15 @@
server {
listen 8898;
server_name _;
resolver 127.0.0.11 valid=30s;
location / {
set $upstream http://whirlpool:8898;
proxy_pass $upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

24
docker/my-dojo/overrides/whirlpool.install.yaml

@ -0,0 +1,24 @@
version: "3.2"
services:
whirlpool:
image: "samouraiwallet/dojo-whirlpool:${DOJO_WHIRLPOOL_VERSION_TAG}"
container_name: whirlpool
build:
context: ./whirlpool
env_file:
- ./.env
- ./conf/docker-common.conf
- ./conf/docker-whirlpool.conf
restart: always
command: /restart.sh
expose:
- "8898"
volumes:
- data-whirlpool:/home/whirlpool
networks:
whirlnet:
ipv4_address: 172.30.1.8
volumes:
data-whirlpool:

7
docker/my-dojo/tor/restart.sh

@ -32,6 +32,13 @@ if [ "$EXPLORER_INSTALL" == "on" ]; then
tor_options+=(--HiddenServiceDirGroupReadable 1)
fi
if [ "$WHIRLPOOL_INSTALL" == "on" ]; then
tor_options+=(--HiddenServiceDir /var/lib/tor/hsv3whirlpool)
tor_options+=(--HiddenServiceVersion 3)
tor_options+=(--HiddenServicePort "80 172.29.1.3:8898")
tor_options+=(--HiddenServiceDirGroupReadable 1)
fi
if [ "$TOR_USE_BRIDGES" == "on" ]; then
tor_options+=(--ClientTransportPlugin "obfs4 exec /usr/local/bin/obfs4proxy")
tor_options+=(--UseBridges 1)

78
docker/my-dojo/whirlpool/Dockerfile

@ -0,0 +1,78 @@
FROM debian:buster
ENV WHIRLPOOL_HOME /home/whirlpool
ENV WHIRLPOOL_DIR /usr/local/whirlpool-cli
# Install prerequisites
# Create group & user whirlpool
# Create .whirlpool-cli subdirectory of WHIRLPOOL_HOME
# Create /usr/local/src/whirlpool-cli directory
RUN set -ex && \
apt-get update && \
apt-get install -y libevent-dev zlib1g-dev libssl-dev gcc make automake ca-certificates autoconf musl-dev coreutils gpg wget default-jdk && \
addgroup --system -gid 1113 whirlpool && \
adduser --system --ingroup whirlpool -uid 1110 whirlpool && \
mkdir -p "$WHIRLPOOL_HOME/.whirlpool-cli" && \
chown -Rv whirlpool:whirlpool "$WHIRLPOOL_HOME" && \
chmod -R 750 "$WHIRLPOOL_HOME" && \
mkdir -p "$WHIRLPOOL_DIR"
# Install Tor
ENV WHIRLPOOL_TOR_URL https://archive.torproject.org/tor-package-archive
ENV WHIRLPOOL_TOR_VERSION 0.4.2.7
ENV WHIRLPOOL_TOR_GPG_KS_URI hkp://keyserver.ubuntu.com:80
ENV WHIRLPOOL_TOR_GPG_KEY1 0xEB5A896A28988BF5
ENV WHIRLPOOL_TOR_GPG_KEY2 0xC218525819F78451
ENV WHIRLPOOL_TOR_GPG_KEY3 0x21194EBB165733EA
ENV WHIRLPOOL_TOR_GPG_KEY4 0x6AFEE6D49E92B601
RUN set -ex && \
mkdir -p /usr/local/src/ && \
cd /usr/local/src && \
wget -qO "tor-$WHIRLPOOL_TOR_VERSION.tar.gz" "$WHIRLPOOL_TOR_URL/tor-$WHIRLPOOL_TOR_VERSION.tar.gz" && \
wget -qO "tor-$WHIRLPOOL_TOR_VERSION.tar.gz.asc" "$WHIRLPOOL_TOR_URL/tor-$WHIRLPOOL_TOR_VERSION.tar.gz.asc" && \
gpg --keyserver "$WHIRLPOOL_TOR_GPG_KS_URI" --recv-keys "$WHIRLPOOL_TOR_GPG_KEY1" && \
gpg --keyserver "$WHIRLPOOL_TOR_GPG_KS_URI" --recv-keys "$WHIRLPOOL_TOR_GPG_KEY2" && \
gpg --keyserver "$WHIRLPOOL_TOR_GPG_KS_URI" --recv-keys "$WHIRLPOOL_TOR_GPG_KEY3" && \
gpg --keyserver "$WHIRLPOOL_TOR_GPG_KS_URI" --recv-keys "$WHIRLPOOL_TOR_GPG_KEY4" && \
gpg --verify "tor-$WHIRLPOOL_TOR_VERSION.tar.gz.asc" && \
tar -xzvf "tor-$WHIRLPOOL_TOR_VERSION.tar.gz" -C /usr/local/src && \
cd "/usr/local/src/tor-$WHIRLPOOL_TOR_VERSION" && \
./configure \
--disable-asciidoc \
--sysconfdir=/etc \
--disable-unittests && \
make && make install && \
cd .. && \
rm -rf "tor-$WHIRLPOOL_TOR_VERSION" && \
rm "tor-$WHIRLPOOL_TOR_VERSION.tar.gz" && \
rm "tor-$WHIRLPOOL_TOR_VERSION.tar.gz.asc"
# Install whirlpool-cli
ENV WHIRLPOOL_URL https://github.com/Samourai-Wallet/whirlpool-client-cli/releases/download
ENV WHIRLPOOL_VERSION 0.10.5
ENV WHIRLPOOL_JAR "whirlpool-client-cli-$WHIRLPOOL_VERSION-run.jar"
ENV WHIRLPOOL_SHA256 94da0b3dc3da1a6292d7ffe74c0cba324a8b553437e66898e86312051ee1b84f
RUN set -ex && \
cd "$WHIRLPOOL_DIR" && \
echo "$WHIRLPOOL_SHA256 *$WHIRLPOOL_JAR" > WHIRLPOOL_CHECKSUMS && \
wget -qO "$WHIRLPOOL_JAR" "$WHIRLPOOL_URL/$WHIRLPOOL_VERSION/$WHIRLPOOL_JAR" && \
sha256sum -c WHIRLPOOL_CHECKSUMS 2>&1 | grep OK && \
mv "$WHIRLPOOL_JAR" whirlpool-client-cli-run.jar && \
chown -Rv whirlpool:whirlpool "$WHIRLPOOL_DIR" && \
chmod -R 750 "$WHIRLPOOL_DIR"
# Copy restart script
COPY ./restart.sh /restart.sh
RUN chown whirlpool:whirlpool /restart.sh && \
chmod u+x /restart.sh && \
chmod g+x /restart.sh
# Expose HTTP API port
EXPOSE 8898
# Switch to user whirlpool
USER whirlpool

35
docker/my-dojo/whirlpool/restart.sh

@ -0,0 +1,35 @@
#!/bin/bash
set -e
whirlpool_options=(
--listen
--cli.api.http-enable=true
--cli.api.http-port=8898
--cli.dojo.enabled=true
--cli.tor=true
--cli.torConfig.executable=/usr/local/bin/tor
--cli.torConfig.coordinator.enabled=true
--cli.torConfig.coordinator.onion=true
--cli.torConfig.backend.enabled=false
--cli.torConfig.backend.onion=false
--logging.file="/home/whirlpool/.whirlpool-cli/whirlpool-output.log"
)
if [ "$COMMON_BTC_NETWORK" == "testnet" ]; then
whirlpool_options+=(--cli.server="TESTNET")
whirlpool_options+=(--cli.dojo.url="http://172.30.1.3:80/test/v2/")
else
whirlpool_options+=(--cli.server="MAINNET")
whirlpool_options+=(--cli.dojo.url="http://172.30.1.3:80/v2/")
fi
if [ "$WHIRLPOOL_DEBUG" == "on" ]; then
whirlpool_options+=(--debug)
fi
if [ "$WHIRLPOOL_DEBUG_CLIENT" == "on" ]; then
whirlpool_options+=(--debug-client)
fi
cd /home/whirlpool/.whirlpool-cli
java -jar /usr/local/whirlpool-cli/whirlpool-client-cli-run.jar "${whirlpool_options[@]}"
Loading…
Cancel
Save