From 1498423b4e36f9d7678db05848aec93d708deabf Mon Sep 17 00:00:00 2001 From: erciccione Date: Fri, 8 Jul 2022 09:33:14 +0200 Subject: [PATCH] seednode: remove some files, add dockerfile and readme with instructions --- seednode/README.md | 96 ++++---------------------- seednode/bitcoin.conf | 21 ------ seednode/bitcoin.service | 22 ------ seednode/docker-compose.yml | 22 ------ seednode/docker/Dockerfile | 29 ++++++++ seednode/docker/README.md | 21 ------ seednode/docker/development/Dockerfile | 18 ----- seednode/docker/prod/Dockerfile | 16 ----- seednode/docker/setup.sh | 5 -- seednode/docker/startSeedNode.sh | 31 --------- 10 files changed, 41 insertions(+), 240 deletions(-) delete mode 100644 seednode/bitcoin.conf delete mode 100644 seednode/bitcoin.service delete mode 100644 seednode/docker-compose.yml create mode 100644 seednode/docker/Dockerfile delete mode 100644 seednode/docker/README.md delete mode 100644 seednode/docker/development/Dockerfile delete mode 100644 seednode/docker/prod/Dockerfile delete mode 100755 seednode/docker/setup.sh delete mode 100755 seednode/docker/startSeedNode.sh diff --git a/seednode/README.md b/seednode/README.md index a126b416bd..ac0637ac02 100644 --- a/seednode/README.md +++ b/seednode/README.md @@ -1,95 +1,23 @@ -# Bisq Seed Node +# Haveno Seednode -## Hardware +Currently a seednode can be deployed using the Dockerfile in the `docker/` folder. -Highly recommended to use SSD! Minimum specs: +Make sure you have Tor installed in your host environment (`apt install tor`), then navigate to the `docker` folder and from there build the Docker image: -* CPU: 4 cores -* RAM: 8 GB -* SSD: 512 GB (HDD is too slow) - -## Software - -The following OS's are known to work well: - -* Ubuntu 18.04 -* Ubuntu 20.04 -* FreeBSD 12 - -### Installation - -Start with a clean Ubuntu server installation, and run the script -```bash -curl -s https://raw.githubusercontent.com/bisq-network/bisq/master/seednode/install_seednode_debian.sh | sudo bash +``` +docker build -t haveno-seednode . ``` -This will install and configure Tor, Bitcoin, and Bisq-Seednode services to start on boot. +Then create a container from it: -### Firewall - -Next, configure your OS firewall to only allow SSH and Bitcoin P2P -```bash -ufw allow 22/tcp -ufw allow 8333/tcp -ufw enable +``` +docker run -it -p 9050 -p 2002 --restart unless-stopped --name haveno-seednode haveno-seednode ``` -### Syncing +After the seednode is deployed, you'll see a message similar to this in the log: -After installation, watch the Bitcoin blockchain sync progress -```bash -sudo tail -f /bitcoin/debug.log +``` +[TorControlParser] INFO o.b.n.tor.Tor: Hidden Service 3jrnfkgkoh463zic54csvntz5w62dm2zno54c3c6jgvusafosqrgmnqd.onion has been announced to the Tor network. ``` -After Bitcoin is fully synced, start the bisq service -```bash -sudo systemctl start bisq -sudo journalctl --unit bisq --follow -``` - -After Bisq is fully synced, check your Bitcoin and Bisq onion hostnames: -```bash -sudo -H -u bitcoin bitcoin-cli getnetworkinfo|grep address -sudo cat /bisq/bisq-seednode/btc_mainnet/tor/hiddenservice/hostname -``` - -### Testing - -After your Bisq seednode is ready, test it by connecting to your new btcnode and bisq! - -macOS: -```bash -/Applications/Bisq.app/Contents/MacOS/Bisq --seedNodes=foo.onion:8000 --btcNodes=foo.onion:8333 -``` - -### Monitoring - -If you run a main seednode, you also are obliged to activate the monitoring feed by running - -```bash -bash <(curl -s https://raw.githubusercontent.com/bisq-network/bisq/master/monitor/install_collectd_debian.sh) -``` -Follow the instruction given by the script and report your certificate to the seednode group! - -### Upgrading - -To upgrade your seednode to a new tag, for example v1.2.5 -```bash -sudo -u bisq -s -cd bisq -git fetch origin -git checkout v1.2.5 # new tag -./gradlew clean build -x test -exit -sudo service bisq restart -sudo journalctl --unit bisq --follow -``` - -### Uninstall - -If you need to start over, you can run the uninstall script in this repo -```bash -sudo ./delete_seednode_debian.sh -``` -WARNING: this script will delete all data! - +Note the onion address. It will be needed by the Haveno instances wanting to connect to your seednode. \ No newline at end of file diff --git a/seednode/bitcoin.conf b/seednode/bitcoin.conf deleted file mode 100644 index f1b685ec9c..0000000000 --- a/seednode/bitcoin.conf +++ /dev/null @@ -1,21 +0,0 @@ -server=1 -daemon=1 -listen=1 -discover=1 -txindex=1 -dbcache=1337 -maxconnections=1337 -peerbloomfilters=1 -onion=127.0.0.1:9050 -rpcallowip=127.0.0.1 -rpcuser=__BITCOIN_RPC_USER__ -rpcpassword=__BITCOIN_RPC_PASS__ -blocknotify=/bitcoin/blocknotify.sh %s - -[main] -bind=127.0.0.1:8333 -rpcbind=127.0.0.1:8332 - -[test] -bind=127.0.0.1:18333 -rpcbind=127.0.0.1:18332 diff --git a/seednode/bitcoin.service b/seednode/bitcoin.service deleted file mode 100644 index 162ba196e6..0000000000 --- a/seednode/bitcoin.service +++ /dev/null @@ -1,22 +0,0 @@ -[Unit] -Description=Bitcoind -After=network.target - -[Service] -ExecStart=/usr/local/bin/bitcoind -daemon -printtoconsole -pid=/bitcoin/bitcoind.pid -ExecStop=/usr/local/bin/bitcoin-cli stop - -Type=forking -PIDFile=/bitcoin/bitcoind.pid -Restart=on-failure - -User=bitcoin -Group=bitcoin - -PrivateTmp=true -ProtectSystem=full -NoNewPrivileges=true -PrivateDevices=true - -[Install] -WantedBy=multi-user.target diff --git a/seednode/docker-compose.yml b/seednode/docker-compose.yml deleted file mode 100644 index 7f7fc2ead7..0000000000 --- a/seednode/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '2.1' - -services: - seednode: - build: - context: . - dockerfile: docker/development/Dockerfile - image: bisq-seednode - ports: - - 8000:8000 - environment: - - NODE_PORT=8000 - - BASE_CURRENCY_NETWORK=XMR_STAGENET - - SEED_NODES=seednode:8000 - - MY_ADDRESS=seednode:8000 - - USE_LOCALHOST_FOR_P2P=true - volumes: - - m2:/root/.m2 - -volumes: - m2: - name: m2 diff --git a/seednode/docker/Dockerfile b/seednode/docker/Dockerfile new file mode 100644 index 0000000000..21bfaf2712 --- /dev/null +++ b/seednode/docker/Dockerfile @@ -0,0 +1,29 @@ +# docker run -it -p 9050 -p 2002 --restart-policy unless-stopped --name haveno-seednode haveno-seednode +# TODO: image very heavy, but it's hard to significantly reduce the size without bins + +FROM openjdk:11 + +RUN set -ex && \ + apt update && \ + apt --no-install-recommends --yes install \ + make \ + git \ + tor + +RUN set -ex && adduser --system --group --disabled-password haveno && \ + mkdir -p /home/haveno && \ + chown -R haveno:haveno /home/haveno + +USER haveno + +WORKDIR /home/haveno + +RUN set -ex && git clone https://github.com/haveno-dex/haveno.git && \ + cd haveno && \ + make skip-tests + +WORKDIR /home/haveno/haveno + +ENTRYPOINT [ "./haveno-seednode" ] + +CMD ["--baseCurrencyNetwork=XMR_STAGENET", "--useLocalhostForP2P=false", "--useDevPrivilegeKeys=false", "--nodePort=2002", "--appName=haveno-XMR_STAGENET_Seed_2002" ] diff --git a/seednode/docker/README.md b/seednode/docker/README.md deleted file mode 100644 index 887866ee94..0000000000 --- a/seednode/docker/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# bisq-seednode docker - -Both images use the same [startSeedNode.sh](startSeedNode.sh) script so inspect it to see what environment variables you can tweak. - -## Production image - -In order to build image: - - docker build . -f docker/prod/Dockerfile -t bisq/seednode - -Run: - - docker run bisq/seednode - -You might want to mount tor hidden service directory: - - docker run -v /your/tor/dir:/root/.local/share/seednode/btc_mainnet/tor/hiddenservice/ bisq/seednode - -## Development image - - docker-compose build diff --git a/seednode/docker/development/Dockerfile b/seednode/docker/development/Dockerfile deleted file mode 100644 index 9973cc4daa..0000000000 --- a/seednode/docker/development/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -### -# WARNING!!! THIS IMAGE IS FOR D E V E L O P M E N T USE ONLY! -### - -FROM openjdk:8-jdk - -RUN apt-get update && apt-get install -y --no-install-recommends \ - openjfx && rm -rf /var/lib/apt/lists/* - -WORKDIR /bisq-seednode -CMD ./docker/startSeedNode.sh - -ENV APP_NAME=seednode -ENV NODE_PORT=8000 - -EXPOSE 8000 - -COPY . . diff --git a/seednode/docker/prod/Dockerfile b/seednode/docker/prod/Dockerfile deleted file mode 100644 index 2832948138..0000000000 --- a/seednode/docker/prod/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM openjdk:8-jdk - -RUN apt-get update && apt-get install -y --no-install-recommends \ - openjfx && rm -rf /var/lib/apt/lists/* - -WORKDIR /bisq-seednode -CMD ./docker/startSeedNode.sh - -ENV APP_NAME=seednode -ENV NODE_PORT=8000 - -EXPOSE 8000 - -COPY . . -RUN ./docker/setup.sh -ENV SKIP_BUILD=true diff --git a/seednode/docker/setup.sh b/seednode/docker/setup.sh deleted file mode 100755 index 2b1afc7605..0000000000 --- a/seednode/docker/setup.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -if [ "$SKIP_BUILD" != "true" ]; then - ./gradlew build -fi diff --git a/seednode/docker/startSeedNode.sh b/seednode/docker/startSeedNode.sh deleted file mode 100755 index 14ae376496..0000000000 --- a/seednode/docker/startSeedNode.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) -SETUP_SCRIPT=${SCRIPT_DIR}/setup.sh -source ${SETUP_SCRIPT} - -ARGS="" - -if [ ! -z "$BASE_CURRENCY_NETWORK" ]; then - ARGS="$ARGS --baseCurrencyNetwork=$BASE_CURRENCY_NETWORK" -fi -if [ ! -z "$MAX_CONNECTIONS" ]; then - ARGS="$ARGS --maxConnections=$MAX_CONNECTIONS" -fi -if [ ! -z "$NODE_PORT" ]; then - ARGS="$ARGS --nodePort=$NODE_PORT" -fi -if [ ! -z "$APP_NAME" ]; then - ARGS="$ARGS --appName=$APP_NAME" -fi -if [ ! -z "$SEED_NODES" ]; then - ARGS="$ARGS --seedNodes=$SEED_NODES" -fi -if [ ! -z "$BTC_NODES" ]; then - ARGS="$ARGS --btcNodes=$BTC_NODES" -fi -if [ ! -z "$USE_LOCALHOST_FOR_P2P" ]; then - ARGS="$ARGS --useLocalhostForP2P=$USE_LOCALHOST_FOR_P2P" -fi - -JAVA_OPTS='-Xms1800m -Xmx1800m' ./build/app/bin/bisq-seednode $ARGS