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

Solution to run master branch on docker #560

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions contrib/UsingMasterBranch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Using the `master` branch on your Docker deployment.

## How to use?
Simply run the script `switch-to-master-and-pull.sh` and everything will be configured for you.
This script can be put in a cronjob, so your deployment is always on the latest commit from master.
6 changes: 6 additions & 0 deletions contrib/UsingMasterBranch/opt-add-cheatmode.custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3"

services:
btcpayserver:
environment:
BTCPAY_CHEATMODE: 1
10 changes: 10 additions & 0 deletions contrib/UsingMasterBranch/opt-master-branch.custom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"

services:
nbxplorer:
environment:
NBXPLORER_EXPOSERPC: 1
bitcoind:
environment:
BITCOIN_EXTRA_ARGS: |
fallbackfee=0.0002
56 changes: 56 additions & 0 deletions contrib/UsingMasterBranch/switch-to-master-and-pull.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

############################################################################################################
# HINT: You can put this script in a cronjob so your deployment can automatically stay current with master #
############################################################################################################

# TODO This script was only tested on Linux. Other OSes may need adjustments.

# Stop on errors
set -e


if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root after running \"sudo su -\""
exit 1
fi

# Navigate to the dir this file is at
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"

# Go to the parent dir of btcpayserver-docker
cd ../../..

echo "Resetting after a potential previous run..."
rm -rf btcpayserver

echo "Cloning using HTTPS so we fetch anonymously and don't run into any potential SSH/pubkey issues..."
git clone https://github.com/btcpayserver/btcpayserver.git --depth=1

cd btcpayserver

echo "Building a new docker image from source..."
docker build -f amd64.Dockerfile -t btcpayserver/btcpayserver:master .

echo "Moving on to the docker stuff..."
cd ../btcpayserver-docker

echo "Copying the 2 fragment YMLs..."
cp ./contrib/UsingMasterBranch/*.custom.yml ./docker-compose-generator/docker-fragments/

echo "Enabling the 2 fragments..."
[[ $BTCPAYGEN_ADDITIONAL_FRAGMENTS =~ .*opt-add-cheatmode.custom.* ]] && echo "Fragment 'opt-add-cheatmode.custom' was already added." || export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-cheatmode.custom"
[[ $BTCPAYGEN_ADDITIONAL_FRAGMENTS =~ .*opt-master-branch.custom.* ]] && echo "Fragment 'opt-master-branch.custom' was already added." || export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-master-branch.custom"

echo "Setting the image to the one we just built..."
export BTCPAY_IMAGE="btcpayserver/btcpayserver:master"

echo "Updating BTCPay deployment to the latest version (might be needed to work with the master branch)..."
./btcpay-update.sh

echo "Applying the new config..."
. btcpay-setup.sh -i

echo "Making sure we're up and running..."
./btcpay-up.sh