Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements to seednode service / install scripts #3882

Merged
merged 9 commits into from Jan 29, 2020
6 changes: 6 additions & 0 deletions seednode/bisq-seednode.env
Expand Up @@ -11,8 +11,14 @@ JAVA_OPTS="-Xms4096M -Xmx4096M -Dcom.sun.management.jmxremote -Dcom.sun.manageme
BITCOIN_RPC_USERNAME=__BITCOIN_RPC_USER__
BITCOIN_RPC_PASSWORD=__BITCOIN_RPC_PASS__

# bitcoin p2p settings
BITCOIN_P2P_HOST=127.0.0.1
BITCOIN_P2P_PORT=8333

# bitcoind rpc ports
BITCOIN_RPC_HOST=127.0.0.1
BITCOIN_RPC_PORT=8332
BITCOIN_RPC_BLOCKNOTIFY_HOST=127.0.0.1
BITCOIN_RPC_BLOCKNOTIFY_PORT=5120

# bisq seednode pathnames
Expand Down
23 changes: 21 additions & 2 deletions seednode/bisq-seednode.service
Expand Up @@ -3,11 +3,30 @@
[Unit]
Description=Bisq Seed Node
After=bitcoin.service
Requires=bitcoin.service
BindsTo=bitcoin.service

[Service]
EnvironmentFile=/etc/default/bisq-seednode.env
ExecStart=__BISQ_HOME__/__BISQ_REPO_NAME__/bisq-seednode --appName=${BISQ_APP_NAME} --nodePort=${BISQ_NODE_PORT} --userDataDir=${BISQ_HOME} --maxConnections=${BISQ_MAX_CONNECTIONS} --maxMemory=${BISQ_MAX_MEMORY} --fullDaoNode=true --rpcUser=${BITCOIN_RPC_USERNAME} --rpcPassword=${BITCOIN_RPC_PASSWORD} --rpcPort=${BITCOIN_RPC_PORT} --rpcBlockNotificationPort=${BITCOIN_RPC_BLOCKNOTIFY_PORT} --baseCurrencyNetwork=${BISQ_BASE_CURRENCY} --dumpBlockchainData=${BISQ_DUMP_BLOCKCHAIN}
ExecStop=/bin/kill -TERM ${MAINPID}

ExecStart=__BISQ_HOME__/__BISQ_REPO_NAME__/bisq-seednode \
--fullDaoNode=true \
--userDataDir=${BISQ_HOME} \
--appName=${BISQ_APP_NAME} \
--baseCurrencyNetwork=${BISQ_BASE_CURRENCY} \
--maxConnections=${BISQ_MAX_CONNECTIONS} \
--maxMemory=${BISQ_MAX_MEMORY} \
--nodePort=${BISQ_NODE_PORT} \
--btcNodes=${BITCOIN_P2P_HOST}:${BITCOIN_P2P_PORT} \
--rpcBlockNotificationHost=${BITCOIN_RPC_BLOCKNOTIFY_HOST} \
--rpcBlockNotificationPort=${BITCOIN_RPC_BLOCKNOTIFY_PORT} \
--rpcHost=${BITCOIN_RPC_HOST} \
--rpcPort=${BITCOIN_RPC_PORT} \
--rpcUser=${BITCOIN_RPC_USERNAME} \
--rpcPassword=${BITCOIN_RPC_PASSWORD} \
--dumpBlockchainData=${BISQ_DUMP_BLOCKCHAIN} \

ExecStop=/bin/kill -9 ${MAINPID}
Restart=on-failure

ExecStartPre=+/bin/bash -c "if [ $BISQ_DUMP_BLOCKCHAIN = true ];then mount -t tmpfs none -o size=812M,uid=bisq,gid=bisq $BISQ_HOME/$BISQ_APP_NAME/$BISQ_BASE_CURRENCY/db/json;else true;fi"
Expand Down
12 changes: 8 additions & 4 deletions seednode/install_seednode_debian.sh
Expand Up @@ -15,7 +15,8 @@ SYSTEMD_ENV_HOME=/etc/default

BISQ_REPO_URL=https://github.com/bisq-network/bisq
BISQ_REPO_NAME=bisq
BISQ_REPO_TAG=$(curl -s https://api.github.com/repos/bisq-network/bisq/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
BISQ_REPO_TAG=master
BISQ_LATEST_RELEASE=$(curl -s https://api.github.com/repos/bisq-network/bisq/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
BISQ_HOME=/bisq
BISQ_USER=bisq

Expand Down Expand Up @@ -101,9 +102,6 @@ sudo -H -i -u "${ROOT_USER}" chown -R "${BISQ_USER}:${BISQ_GROUP}" "${BISQ_HOME}
echo "[*] Installing OpenJDK 10.0.2 from Bisq repo"
sudo -H -i -u "${ROOT_USER}" "${BISQ_HOME}/${BISQ_REPO_NAME}/scripts/install_java.sh"

echo "[*] Building Bisq from source"
sudo -H -i -u "${BISQ_USER}" sh -c "cd ${BISQ_HOME}/${BISQ_REPO_NAME} && ./gradlew build -x test < /dev/null" # redirect from /dev/null is necessary to workaround gradlew non-interactive shell hanging issue

echo "[*] Installing Bisq init script"
sudo -H -i -u "${ROOT_USER}" install -c -o "${ROOT_USER}" -g "${ROOT_GROUP}" -m 644 "${BISQ_HOME}/${BISQ_REPO_NAME}/seednode/bisq-seednode.service" "${SYSTEMD_SERVICE_HOME}/bisq-seednode.service"
sudo sed -i -e "s/__BISQ_REPO_NAME__/${BISQ_REPO_NAME}/" "${SYSTEMD_SERVICE_HOME}/bisq-seednode.service"
Expand All @@ -115,6 +113,12 @@ sudo sed -i -e "s/__BITCOIN_RPC_USER__/${BITCOIN_RPC_USER}/" "${SYSTEMD_ENV_HOME
sudo sed -i -e "s/__BITCOIN_RPC_PASS__/${BITCOIN_RPC_PASS}/" "${SYSTEMD_ENV_HOME}/bisq-seednode.env"
sudo sed -i -e "s!__BISQ_HOME__!${BISQ_HOME}!" "${SYSTEMD_ENV_HOME}/bisq-seednode.env"

echo "[*] Checking out Bisq ${BISQ_LATEST_RELEASE}"
sudo -H -i -u "${BISQ_USER}" sh -c "cd ${BISQ_HOME}/${BISQ_REPO_NAME} && git checkout ${BISQ_LATEST_RELEASE}"

echo "[*] Building Bisq from source"
sudo -H -i -u "${BISQ_USER}" sh -c "cd ${BISQ_HOME}/${BISQ_REPO_NAME} && ./gradlew build -x test < /dev/null" # redirect from /dev/null is necessary to workaround gradlew non-interactive shell hanging issue

echo "[*] Updating systemd daemon configuration"
sudo -H -i -u "${ROOT_USER}" systemctl daemon-reload
sudo -H -i -u "${ROOT_USER}" systemctl enable tor.service
Expand Down
16 changes: 13 additions & 3 deletions seednode/torrc
@@ -1,8 +1,18 @@
SOCKSPort 9050 # Default: Bind to localhost:9050 for local connections.
Log notice syslog
RunAsDaemon 1
SOCKSPort 9050
ControlPort 9051
Log notice syslog

CookieAuthentication 1
CookieAuthFileGroupReadable 1
DataDirectoryGroupReadable 1
KeepalivePeriod 42

SafeSocks 0
HiddenServiceStatistics 0
AvoidDiskWrites 1

MaxClientCircuitsPending 64
KeepalivePeriod 2
#CircuitBuildTimeout 5
#NewCircuitPeriod 15
#NumEntryGuards 8
wiz marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 3 additions & 4 deletions seednode/uninstall_seednode_debian.sh
@@ -1,12 +1,11 @@
#!/bin/sh
echo "[*] Uninstalling Bitcoin and Bisq, will delete all data!!"
sleep 10
sudo rm -rf /root/bisq
sudo systemctl stop bitcoin
sudo systemctl stop bisq
sudo systemctl stop bisq-seednode
sudo systemctl disable bitcoin
sudo systemctl disable bisq
sleep 10
sudo systemctl disable bisq-seednode
sudo userdel -f -r bisq
sleep 10
sudo userdel -f -r bitcoin
echo "[*] Done!"