docker: Add PIVX, Dash and Firo to isolated config

Changed pivx-params location to PIVX datadir.

Still need a way to set the Firo wallet seed.
2024-05-20_merge
tecnovert 2 years ago
parent ae2ddc4049
commit f65ae07cf9
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 32
      bin/basicswap_prepare.py
  2. 16
      docker/production/compose-fragments/1_dash.yml
  3. 16
      docker/production/compose-fragments/1_firo.yml
  4. 16
      docker/production/compose-fragments/1_pivx.yml
  5. 27
      docker/production/dash/Dockerfile
  6. 11
      docker/production/dash/entrypoint.sh
  7. 18
      docker/production/example.env
  8. 25
      docker/production/firo/Dockerfile
  9. 11
      docker/production/firo/entrypoint.sh
  10. 14
      docker/production/notes.md
  11. 25
      docker/production/pivx/Dockerfile
  12. 11
      docker/production/pivx/entrypoint.sh

@ -159,6 +159,9 @@ TEST_ONION_LINK = toBool(os.getenv('TEST_ONION_LINK', 'false'))
BITCOIN_FASTSYNC_URL = os.getenv('BITCOIN_FASTSYNC_URL', 'http://utxosets.blob.core.windows.net/public/')
BITCOIN_FASTSYNC_FILE = os.getenv('BITCOIN_FASTSYNC_FILE', 'utxo-snapshot-bitcoin-mainnet-720179.tar')
# Set to false when running individual docker containers
START_DAEMONS = toBool(os.getenv('START_DAEMONS', 'true'))
use_tor_proxy = False
default_socket = socket.socket
@ -688,11 +691,11 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic, extra_opts={}):
elif coin == 'namecoin':
fp.write('prune=2000\n')
elif coin == 'pivx':
base_dir = extra_opts.get('data_dir', data_dir)
params_dir = os.path.join(base_dir, 'pivx-params')
params_dir = os.path.join(data_dir, 'pivx-params')
downloadPIVXParams(params_dir)
fp.write('prune=4000\n')
fp.write(f'paramsdir={params_dir}\n')
PIVX_PARAMSDIR = os.getenv('PIVX_PARAMSDIR', params_dir)
fp.write(f'paramsdir={PIVX_PARAMSDIR}\n')
if PIVX_RPC_USER != '':
fp.write('rpcauth={}:{}${}\n'.format(PIVX_RPC_USER, salt, password_to_hmac(salt, PIVX_RPC_PWD)))
elif coin == 'dash':
@ -929,19 +932,20 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
coin_settings = settings['chainclients'][coin_name]
c = swap_client.getCoinIdFromName(coin_name)
if c == Coins.XMR:
if coin_settings['manage_wallet_daemon']:
daemons.append(startXmrWalletDaemon(coin_settings['datadir'], coin_settings['bindir'], 'monero-wallet-rpc'))
else:
if coin_settings['manage_daemon']:
filename = coin_name + 'd' + ('.exe' if os.name == 'nt' else '')
coin_args = ['-nofindpeers', '-nostaking'] if c == Coins.PART else []
if START_DAEMONS:
if c == Coins.XMR:
if coin_settings['manage_wallet_daemon']:
daemons.append(startXmrWalletDaemon(coin_settings['datadir'], coin_settings['bindir'], 'monero-wallet-rpc'))
else:
if coin_settings['manage_daemon']:
filename = coin_name + 'd' + ('.exe' if os.name == 'nt' else '')
coin_args = ['-nofindpeers', '-nostaking'] if c == Coins.PART else []
if c == Coins.FIRO:
coin_args += ['-hdseed={}'.format(swap_client.getWalletKey(Coins.FIRO, 1).hex())]
if c == Coins.FIRO:
coin_args += ['-hdseed={}'.format(swap_client.getWalletKey(Coins.FIRO, 1).hex())]
daemons.append(startDaemon(coin_settings['datadir'], coin_settings['bindir'], filename, daemon_args + coin_args))
swap_client.setDaemonPID(c, daemons[-1].pid)
daemons.append(startDaemon(coin_settings['datadir'], coin_settings['bindir'], filename, daemon_args + coin_args))
swap_client.setDaemonPID(c, daemons[-1].pid)
swap_client.setCoinRunParams(c)
swap_client.createCoinInterface(c)

@ -0,0 +1,16 @@
dash_core:
image: i_dash
build:
context: dash
dockerfile: Dockerfile
container_name: dash_core
volumes:
- ${DATA_PATH}/dash:/data
expose:
- ${DASH_RPC_PORT}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
restart: unless-stopped

@ -0,0 +1,16 @@
firo_core:
image: i_firo
build:
context: firo
dockerfile: Dockerfile
container_name: firo_core
volumes:
- ${DATA_PATH}/firo:/data
expose:
- ${FIRO_RPC_PORT}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
restart: unless-stopped

@ -0,0 +1,16 @@
pivx_core:
image: i_pivx
build:
context: pivx
dockerfile: Dockerfile
container_name: pivx_core
volumes:
- ${DATA_PATH}/pivx:/data
expose:
- ${PIVX_RPC_PORT}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
restart: unless-stopped

@ -0,0 +1,27 @@
# https://github.com/NicolasDorier/docker-bitcoin/blob/master/README.md
FROM i_swapclient as install_stage
RUN basicswap-prepare --preparebinonly --bindir=/coin_bin --withcoin=dash --withoutcoins=particl && \
find /coin_bin -name *.tar.gz -delete
FROM debian:bullseye-slim
COPY --from=install_stage /coin_bin .
ENV DASH_DATA /data
RUN groupadd -r dash && useradd -r -m -g dash dash \
&& apt-get update \
&& apt-get install -qq --no-install-recommends gosu \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir "$DASH_DATA" \
&& chown -R dash:dash "$DASH_DATA" \
&& ln -sfn "$DASH_DATA" /home/dash/.dash \
&& chown -h dash:dash /home/dash/.dash
VOLUME /data
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 9999 9998
CMD ["/dash/dashd", "--datadir=/data"]

@ -0,0 +1,11 @@
#!/bin/bash
set -e
if [[ "$1" == "dash-cli" || "$1" == "dash-tx" || "$1" == "dashd" || "$1" == "test_dash" ]]; then
mkdir -p "$DASH_DATA"
chown -h dash:dash /home/dash/.dash
exec gosu dash "$@"
else
exec "$@"
fi

@ -35,3 +35,21 @@ 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
PIVX_DATA_DIR=/data/pivx
PIVX_RPC_HOST=pivx_core
PIVX_RPC_PORT=51473
PIVX_RPC_USER=pivx_user
PIVX_RPC_PWD=pivx_pwd
DASH_DATA_DIR=/data/dash
DASH_RPC_HOST=dash_core
DASH_RPC_PORT=9998
DASH_RPC_USER=dash_user
DASH_RPC_PWD=dash_pwd
FIRO_DATA_DIR=/data/firo
FIRO_RPC_HOST=firo_core
FIRO_RPC_PORT=8888
FIRO_RPC_USER=firo_user
FIRO_RPC_PWD=firo_pwd

@ -0,0 +1,25 @@
FROM i_swapclient as install_stage
RUN basicswap-prepare --preparebinonly --bindir=/coin_bin --withcoin=firo --withoutcoins=particl && \
find /coin_bin -name *.tar.gz -delete
FROM debian:bullseye-slim
COPY --from=install_stage /coin_bin .
ENV FIRO_DATA /data
RUN groupadd -r firo && useradd -r -m -g firo firo \
&& apt-get update \
&& apt-get install -qq --no-install-recommends gosu \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir "$FIRO_DATA" \
&& chown -R firo:firo "$FIRO_DATA" \
&& ln -sfn "$FIRO_DATA" /home/firo/.firo \
&& chown -h firo:firo /home/firo/.firo
VOLUME /data
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8168 8888
CMD ["/firo/firod", "--datadir=/data"]

@ -0,0 +1,11 @@
#!/bin/bash
set -e
if [[ "$1" == "firo-cli" || "$1" == "firo-tx" || "$1" == "firod" || "$1" == "test_firo" ]]; then
mkdir -p "$FIRO_DATA"
chown -h firo:firo /home/firo/.firo
exec gosu firo "$@"
else
exec "$@"
fi

@ -8,6 +8,16 @@ Copy and edit .env config:
cp example.env .env
Optionally set random RPC passwords:
for KEY in $(grep -o '^.*_RPC_PWD' .env)
do
echo "Replacing: $KEY"
NEW_PWD=$(cat /dev/random | base16 | head -c 48)
sed -i "s/${KEY}=.*$/${KEY}=${NEW_PWD}/g" .env
done
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
@ -21,6 +31,9 @@ Create docker-compose config:
cat compose-fragments/1_bitcoin.yml >> docker-compose.yml
cat compose-fragments/1_litecoin.yml >> docker-compose.yml
cat compose-fragments/1_monero-wallet.yml >> docker-compose.yml
cat compose-fragments/1_pivx.yml >> docker-compose.yml
cat compose-fragments/1_dash.yml >> docker-compose.yml
cat compose-fragments/1_firo.yml >> docker-compose.yml
# Copy for prepare script config
cp docker-compose.yml docker-compose-prepare.yml
@ -28,6 +41,7 @@ Create docker-compose config:
# 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

@ -0,0 +1,25 @@
FROM i_swapclient as install_stage
RUN basicswap-prepare --preparebinonly --bindir=/coin_bin --withcoin=pivx --withoutcoins=particl && \
find /coin_bin -name *.tar.gz -delete
FROM debian:bullseye-slim
COPY --from=install_stage /coin_bin .
ENV PIVX_DATA /data
RUN groupadd -r pivx && useradd -r -m -g pivx pivx \
&& apt-get update \
&& apt-get install -qq --no-install-recommends gosu \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir "$PIVX_DATA" \
&& chown -R pivx:pivx "$PIVX_DATA" \
&& ln -sfn "$PIVX_DATA" /home/pivx/.pivx \
&& chown -h pivx:pivx /home/pivx/.pivx
VOLUME /data
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 51472 51473
CMD ["/pivx/pivxd", "--datadir=/data"]

@ -0,0 +1,11 @@
#!/bin/bash
set -e
if [[ "$1" == "pivx-cli" || "$1" == "pivx-tx" || "$1" == "pivxd" || "$1" == "test_pivx" ]]; then
mkdir -p "$PIVX_DATA"
chown -h pivx:pivx /home/pivx/.pivx
exec gosu pivx "$@"
else
exec "$@"
fi
Loading…
Cancel
Save