From b1f4abcb0a592808673f92a851ec557aeb22c506 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 5 Jun 2019 16:48:53 +0900 Subject: [PATCH 1/2] Can run btcpay-setup without starting the containers --- btcpay-setup.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/btcpay-setup.sh b/btcpay-setup.sh index c9c0643..63e21aa 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -30,7 +30,8 @@ Usage: Install BTCPay on this server This script must be run as root - -i : Run install + -i : Run install and start BTCPay Server + --install-only : Run install only This script will: @@ -71,11 +72,16 @@ Add-on specific variables: END } -if [ "$1" != "-i" ]; then +if [ "$1" != "-i" ] && [ "$1" != "--install-only" ]; then display_help return fi +START=true +if [ "$1" == "--install-only" ]; then + START=false +fi + if [ -z "$BTCPAYGEN_CRYPTO1" ]; then if [ -f "/etc/profile.d/btcpay-env.sh" ]; then echo "This script must be run as root after running \"sudo su -\"" @@ -351,11 +357,13 @@ systemctl restart docker fi echo -e "BTCPay Server systemd configured in /etc/systemd/system/btcpayserver.service\n" -echo "BTCPay Server starting... this can take 5 to 10 minutes..." systemctl daemon-reload systemctl enable btcpayserver -systemctl start btcpayserver -echo "BTCPay Server started" +if START; then + echo "BTCPay Server starting... this can take 5 to 10 minutes..." + systemctl start btcpayserver + echo "BTCPay Server started" +fi else # Use upstart echo "Using upstart" echo " @@ -376,9 +384,11 @@ script docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" up -d end script" > /etc/init/start_containers.conf echo -e "BTCPay Server upstart configured in /etc/init/start_containers.conf\n" +if START; then initctl reload-configuration echo "BTCPay Server started" fi +fi cd "$(dirname $BTCPAY_ENV_FILE)" @@ -387,7 +397,8 @@ if [ ! -z "$OLD_BTCPAY_DOCKER_COMPOSE" ] && [ "$OLD_BTCPAY_DOCKER_COMPOSE" != "$ docker-compose -f "$OLD_BTCPAY_DOCKER_COMPOSE" down -t "${COMPOSE_HTTP_TIMEOUT:-180}" fi -docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d --remove-orphans -t "${COMPOSE_HTTP_TIMEOUT:-180}" +START && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d --remove-orphans -t "${COMPOSE_HTTP_TIMEOUT:-180}" +! START && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" pull # Give SSH key to BTCPay if [[ -f "$BTCPAY_HOST_SSHKEYFILE" ]]; then From d6e19a1b4a8e6dd017dc5c6573b0ce6787ed4462 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 5 Jun 2019 16:50:11 +0900 Subject: [PATCH 2/2] fix script --- btcpay-setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/btcpay-setup.sh b/btcpay-setup.sh index 63e21aa..b200781 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -359,7 +359,7 @@ fi echo -e "BTCPay Server systemd configured in /etc/systemd/system/btcpayserver.service\n" systemctl daemon-reload systemctl enable btcpayserver -if START; then +if $START; then echo "BTCPay Server starting... this can take 5 to 10 minutes..." systemctl start btcpayserver echo "BTCPay Server started" @@ -384,7 +384,7 @@ script docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" up -d end script" > /etc/init/start_containers.conf echo -e "BTCPay Server upstart configured in /etc/init/start_containers.conf\n" -if START; then +if $START; then initctl reload-configuration echo "BTCPay Server started" fi @@ -397,8 +397,8 @@ if [ ! -z "$OLD_BTCPAY_DOCKER_COMPOSE" ] && [ "$OLD_BTCPAY_DOCKER_COMPOSE" != "$ docker-compose -f "$OLD_BTCPAY_DOCKER_COMPOSE" down -t "${COMPOSE_HTTP_TIMEOUT:-180}" fi -START && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d --remove-orphans -t "${COMPOSE_HTTP_TIMEOUT:-180}" -! START && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" pull +$START && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d --remove-orphans -t "${COMPOSE_HTTP_TIMEOUT:-180}" +! $START && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" pull # Give SSH key to BTCPay if [[ -f "$BTCPAY_HOST_SSHKEYFILE" ]]; then