doc: Update docker install notes.

This commit is contained in:
tecnovert 2022-06-27 22:10:28 +02:00
parent beaff23ac3
commit f7aadd1b9d
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93

View file

@ -6,6 +6,12 @@
## Run Using Docker ## Run Using Docker
Install dependencies:
apt-get curl jq
Docker must be installed and started: Docker must be installed and started:
docker -v docker -v
@ -13,40 +19,58 @@ Docker must be installed and started:
Should return a line containing `Docker version`... Should return a line containing `Docker version`...
It's recommended to setup docker to work without sudo: To install docker engine on your platform see:
https://docs.docker.com/engine/install/#server
It's recommended to setup docker to work without sudo.<br>
Without this step you will need to preface each `docker-compose` command with `sudo`:
https://docs.docker.com/engine/install/linux-postinstall/ https://docs.docker.com/engine/install/linux-postinstall/
#### Create the images: #### Create the images:
COINDATA_PATH can be set to your preferance but must be exported each time you launch Basicswap.<br>
Consider adding COINDATA_PATH to the `.env` file in the docker directory file so it's always set.
export COINDATA_PATH=/var/data/coinswaps
cd basicswap/docker cd basicswap/docker
docker-compose build docker-compose build
#### Prepare the datadir: #### Prepare the datadir:
Set XMR_RPC_HOST and BASE_XMR_RPC_PORT to a public XMR node or exclude to run a local node.
Set xmrrestoreheight to the current xmr chain height. Set xmrrestoreheight to the current xmr chain height.
CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height) CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height)
Adjust `--withcoins` and `--withoutcoins` as desired, eg: `--withcoins=monero,bitcoin`. By default only Particl is loaded. Adjust `--withcoins` and `--withoutcoins` as desired, eg: `--withcoins=monero,bitcoin`. By default only Particl is loaded.
export COINDATA_PATH=/var/data/coinswaps
docker run --rm -e XMR_RPC_HOST="node.xmr.to" -e BASE_XMR_RPC_PORT=18081 -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient \
basicswap-prepare --datadir=/coindata --withcoins=monero --htmlhost="0.0.0.0" --xmrrestoreheight=$CURRENT_XMR_HEIGHT
**Record the mnemonic from the output of the above command.**
##### FastSync ##### FastSync
Use `--usebtcfastsync` to optionally initialise the Bitcoin datadir with a chain snapshot from btcpayserver FastSync. Append `--usebtcfastsync` to the below command to optionally initialise the Bitcoin datadir with a chain snapshot from btcpayserver FastSync.<br>
[FastSync README.md](https://github.com/btcpayserver/btcpayserver-docker/blob/master/contrib/FastSync/README.md) [FastSync README.md](https://github.com/btcpayserver/btcpayserver-docker/blob/master/contrib/FastSync/README.md)
Setup with a local Monero daemon (recommended):
export COINDATA_PATH=/var/data/coinswaps
docker run --rm -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient basicswap-prepare --datadir=/coindata --withcoins=monero --htmlhost="0.0.0.0" --xmrrestoreheight=$CURRENT_XMR_HEIGHT
To instead use Monero public nodes and not run a local Monero daemon<br>(it can be difficult to find reliable public nodes):
Set XMR_RPC_HOST and BASE_XMR_RPC_PORT to a public XMR node.
export COINDATA_PATH=/var/data/coinswaps
docker run --rm -e XMR_RPC_HOST="node.xmr.to" -e BASE_XMR_RPC_PORT=18081 -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient basicswap-prepare --datadir=/coindata --withcoins=monero --htmlhost="0.0.0.0" --xmrrestoreheight=$CURRENT_XMR_HEIGHT
**Record the mnemonic from the output of the above command.**
And the output of `echo $CURRENT_XMR_HEIGHT` for use if you need to later restore your wallet.
#### Set the timezone (optional): #### Set the timezone (optional):
Edit the `.env` file in the docker directory, set TZ to your local timezone. Edit the `.env` file in the docker directory, set TZ to your local timezone.
@ -169,7 +193,8 @@ Open in browser: `http://localhost:12700`
It may take a few minutes to start as the coin daemons are started before the http interface. It may take a few minutes to start as the coin daemons are started before the http interface.
Add a coin: Add a coin (Stop basicswap first):
export SWAP_DATADIR=/Users/$USER/coinswaps export SWAP_DATADIR=/Users/$USER/coinswaps
basicswap-prepare --usebtcfastsync --datadir=/$SWAP_DATADIR --addcoin=bitcoin basicswap-prepare --usebtcfastsync --datadir=/$SWAP_DATADIR --addcoin=bitcoin