docker: Fix and document isolated coins config.

This commit is contained in:
tecnovert
2022-07-11 23:36:28 +02:00
parent 48e0cac5ab
commit e03f32ea5f
20 changed files with 219 additions and 120 deletions

View File

@@ -1,22 +0,0 @@
HTML_PORT=127.0.0.1:12700:12700
TZ=UTC
DATA_PATH=/mnt/hdd50/docker2
PART_RPC_HOST=particl_core
LTC_RPC_HOST=litecoin_core
BTC_RPC_HOST=bitcoin_core
PART_RPC_USER=particl_user
PART_RPC_PWD=particl_pwd
BTC_RPC_USER=bitcoin_user
BTC_RPC_PWD=bitcoin_pwd
LTC_RPC_USER=litecoin_user
LTC_RPC_PWD=litecoin_pwd
PART_DATA_DIR=/data/particl
LTC_DATA_DIR=/data/litecoin
BTC_DATA_DIR=/data/bitcoin
XMR_DATA_DIR=/data/monero_daemon
XMR_WALLETS_DIR=/data/monero_wallet
COINS_RPCBIND_IP=0.0.0.0

View File

@@ -2,8 +2,7 @@ version: '3.3'
networks:
default:
external:
name: coinswap_network
name: coinswap_network
services:
particl_core:
image: i_particl
@@ -13,10 +12,9 @@ services:
container_name: particl_core
volumes:
- ${DATA_PATH}/particl:/data
#ports:
# - "51738:51738"
expose:
- 51735
- ${PART_RPC_PORT}
- ${PART_ZMQ_PORT}
logging:
driver: "json-file"
options:

View File

@@ -6,10 +6,8 @@
container_name: bitcoin_core
volumes:
- ${DATA_PATH}/bitcoin:/data
#ports:
# - "8333:8333"
expose:
- 8332
- ${BTC_RPC_PORT}
logging:
driver: "json-file"
options:

View File

@@ -6,6 +6,8 @@
container_name: litecoin_core
volumes:
- ${DATA_PATH}/litecoin:/data
expose:
- ${LTC_RPC_PORT}
logging:
driver: "json-file"
options:

View File

@@ -7,7 +7,7 @@
volumes:
- ${DATA_PATH}/monero_wallet:/data
expose:
- 8332
- ${BASE_XMR_WALLET_PORT}
logging:
driver: "json-file"
options:

View File

@@ -0,0 +1,16 @@
tor:
image: i_tor
container_name: tor
build:
context: ./tor
volumes:
- ${DATA_PATH}/tor/data:/var/lib/tor/
- ${DATA_PATH}/tor/torrc:/etc/tor/torrc
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
networks:
tor_net:
coinswap_network: 172.16.238.200

View File

@@ -6,10 +6,8 @@
container_name: monero_daemon
volumes:
- ${DATA_PATH}/monero_daemon:/data
#ports:
# - "18080:18080"
expose:
- 8332
- ${BASE_XMR_RPC_PORT}
logging:
driver: "json-file"
options:

View File

@@ -13,32 +13,33 @@
- ${DATA_PATH}/litecoin:/data/litecoin
environment:
- TZ
- PART_RPC_HOST
- LTC_RPC_HOST
- BTC_RPC_HOST
- PART_RPC_PORT
- LTC_RPC_PORT
- BTC_RPC_PORT
- XMR_RPC_HOST
- BASE_XMR_RPC_PORT
- BASE_XMR_ZMQ_PORT
- BASE_XMR_WALLET_PORT
- XMR_WALLET_RPC_HOST
- XMR_WALLET_RPC_USER
- XMR_WALLET_RPC_PWD
- DEFAULT_XMR_RESTORE_HEIGHT
- UI_HTML_PORT
- COINS_RPCBIND_IP
- BASICSWAP_DATADIR
- PART_DATA_DIR
- PART_RPC_HOST
- PART_ZMQ_PORT
- PART_RPC_USER
- PART_RPC_PWD
- PART_RPC_PORT
- BTC_DATA_DIR
- BTC_RPC_HOST
- BTC_RPC_PORT
- BTC_RPC_USER
- BTC_RPC_PWD
- LTC_DATA_DIR
- LTC_RPC_HOST
- LTC_RPC_PORT
- LTC_RPC_USER
- LTC_RPC_PWD
- PART_DATA_DIR
- LTC_DATA_DIR
- BTC_DATA_DIR
- XMR_DATA_DIR
- XMR_RPC_HOST
- BASE_XMR_RPC_PORT
- BASE_XMR_ZMQ_PORT
- XMR_WALLETS_DIR
- COINS_RPCBIND_IP
- XMR_WALLET_RPC_HOST
- BASE_XMR_WALLET_PORT
- XMR_WALLET_RPC_USER
- XMR_WALLET_RPC_PWD
- DEFAULT_XMR_RESTORE_HEIGHT
restart: "no"

View File

@@ -1,21 +1,36 @@
HTML_PORT=127.0.0.1:12700:12700
TZ=UTC
DATA_PATH=/var/swapdata/
PART_RPC_HOST=particl_core
LTC_RPC_HOST=litecoin_core
BTC_RPC_HOST=bitcoin_core
DATA_PATH=/var/swapdata/
BASICSWAP_DATADIR=/data/swapclient
COINS_RPCBIND_IP=0.0.0.0
PART_DATA_DIR=/data/particl
PART_RPC_HOST=particl_core
PART_RPC_PORT=19792
PART_ZMQ_PORT=20792
PART_RPC_USER=particl_user
PART_RPC_PWD=particl_pwd
BTC_RPC_USER=bitcoin_user
BTC_RPC_PWD=bitcoin_pwd
LTC_DATA_DIR=/data/litecoin
LTC_RPC_HOST=litecoin_core
LTC_RPC_PORT=19795
LTC_RPC_USER=litecoin_user
LTC_RPC_PWD=litecoin_pwd
PART_DATA_DIR=/data/particl
LTC_DATA_DIR=/data/litecoin
BTC_DATA_DIR=/data/bitcoin
XMR_DATA_DIR=/data/monero_daemon
XMR_WALLETS_DIR=/data/monero_wallet
BTC_RPC_HOST=bitcoin_core
BTC_RPC_PORT=19796
BTC_RPC_USER=bitcoin_user
BTC_RPC_PWD=bitcoin_pwd
COINS_RPCBIND_IP=0.0.0.0
XMR_DATA_DIR=/data/monero_daemon
XMR_RPC_HOST=monero_daemon
BASE_XMR_RPC_PORT=29798
XMR_WALLETS_DIR=/data/monero_wallet
XMR_WALLET_RPC_HOST=monero_wallet
BASE_XMR_WALLET_PORT=29998
XMR_WALLET_RPC_USER=xmr_wallet_user
XMR_WALLET_RPC_PWD=xmr_wallet_pwd

View File

@@ -21,5 +21,4 @@ VOLUME $MONERO_DATA
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 18080
CMD ["monerod", "--non-interactive", "--config-file=/home/monero/.monero/monerod.conf"]
CMD ["/monero/monerod", "--non-interactive", "--config-file=/home/monero/.monero/monerod.conf", "--confirm-external-bind"]

View File

@@ -13,5 +13,4 @@ VOLUME $MONERO_DATA
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 18080
CMD ["monero-wallet-rpc", "--non-interactive", "--config-file=/data/monero_wallet.conf"]
CMD ["/monero/monero-wallet-rpc", "--non-interactive", "--config-file=/data/monero_wallet.conf", "--confirm-external-bind"]

View File

@@ -1,8 +1,16 @@
# Split container setup
This will setup Basicswap so that each coin runs in it's own container.
Copy and edit .env config:
$ cp example.env .env
cp example.env .env
Set the latest Monero chain height, or the height your wallet must restore from:
echo "DEFAULT_XMR_RESTORE_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height)" >> .env
Create docker-compose config:
@@ -12,13 +20,70 @@ Create docker-compose config:
# Add the relevant coin fragments
cat compose-fragments/1_bitcoin.yml >> docker-compose.yml
cat compose-fragments/1_litecoin.yml >> docker-compose.yml
cat compose-fragments/1_monero-daemon.yml >> docker-compose.yml
cat compose-fragments/1_monero-wallet.yml >> docker-compose.yml
cat compose-fragments/8_swapclient.yml >> docker-compose.yml
# Copy for prepare script config
cp docker-compose.yml docker-compose-prepare.yml
cat compose-fragments/9_swapprepare.yml >> docker-compose-prepare.yml
# Add the Monero daemon if required (should not go in docker-compose-prepare.yml)
cat compose-fragments/8_monero-daemon.yml >> docker-compose.yml
# Add the swapclient
cat compose-fragments/8_swapclient.yml >> docker-compose.yml
Create the docker network, with a specific subnet (for optional tor use):
docker network create coinswap_network --subnet="172.16.238.0/24"
Build the swapclient container:
docker-compose build swapclient
Build the monero container, if required:
docker-compose build monero_daemon
Build the remaining coin containers:
docker-compose build
Build the prepare-only containers:
docker-compose -f docker-compose-prepare.yml build
Create config files:
# Select relevant coins:
export WITH_COINS=bitcoin,litecoin,monero
docker-compose -f docker-compose-prepare.yml run --rm swapprepare \
basicswap-prepare --nocores --withcoins=${WITH_COINS} --htmlhost="0.0.0.0" --particl_mnemonic=none
Start coin cores only:
docker-compose -f docker-compose-prepare.yml up -d --scale swapprepare=0
Initialise wallets:
docker-compose -f docker-compose-prepare.yml run --rm swapprepare \
basicswap-prepare --initwalletsonly
Stop cores:
docker-compose -f docker-compose-prepare.yml stop
Start BasicSwap:
docker-compose up

View File

@@ -12,7 +12,7 @@ RUN wget -O protobuf_src.tar.gz https://github.com/protocolbuffers/protobuf/rele
tar xvf protobuf_src.tar.gz && \
cd protobuf-3.21.1 && \
./configure --prefix=/usr && \
make install && \
make -j$(nproc) install && \
ldconfig
ARG COINCURVE_VERSION=v0.1

View File

@@ -0,0 +1,8 @@
FROM alpine:latest
# 9050 SOCKS port
# 9051 control port
# 5353 DNS port
EXPOSE 9050 9051 5353
RUN apk add --no-cache tor
CMD tor -f /etc/tor/torrc