diff --git a/.circleci/config.yml b/.circleci/config.yml index 89778d6..0d8412e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,10 +11,10 @@ jobs: command: | cd docker-compose-generator sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS - sudo docker build --pull -t $DOCKERHUB_REPO:latest-amd64 -f Dockerfile.linuxamd64 . + sudo docker build --pull -t $DOCKERHUB_REPO:latest-amd64 -f linuxamd64.Dockerfile . sudo docker push $DOCKERHUB_REPO:latest-amd64 - publish_docker_linuxarm: + publish_docker_linuxarm32v7: machine: docker_layer_caching: true steps: @@ -25,7 +25,7 @@ jobs: # cd docker-compose-generator sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS - sudo docker build --pull -t $DOCKERHUB_REPO:latest-arm32v7 -f Dockerfile.linuxarm32v7 . + sudo docker build --pull -t $DOCKERHUB_REPO:latest-arm32v7 -f linuxarm32v7.Dockerfile . sudo docker push $DOCKERHUB_REPO:latest-arm32v7 publish_docker_multiarch: @@ -54,14 +54,14 @@ workflows: filters: branches: only: dcg-latest - - publish_docker_linuxarm: + - publish_docker_linuxarm32v7: filters: branches: only: dcg-latest - publish_docker_multiarch: requires: - publish_docker_linuxamd64 - - publish_docker_linuxarm + - publish_docker_linuxarm32v7 filters: branches: only: dcg-latest diff --git a/README.md b/README.md index 881f1df..cf572f1 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ Available `BTCPAYGEN_ADDITIONAL_FRAGMENTS` currently are: * [opt-save-storage-xs](docker-compose-generator/docker-fragments/opt-save-storage-xs.yml) will keep around 3 months of blocks (prune BTC for 25 GB) * [opt-save-storage-xxs](docker-compose-generator/docker-fragments/opt-save-storage-xxs.yml) will keep around 2 weeks of blocks (prune BTC for 5 GB) (lightning not supported) * [opt-lnd-autopilot](docker-compose-generator/docker-fragments/opt-lnd-autopilot.yml) will activate auto pilot on LND. (5 channels, 60% of allocation) +* [opt-save-memory](docker-compose-generator/docker-fragments/opt-save-memory.yml) will decrease the default dbcache at the expense of longer synchronization time (Useful if your machine is less than 2GB) You can also create your own [custom fragments](#how-can-i-customize-the-generated-docker-compose-file). diff --git a/btcpay-setup.sh b/btcpay-setup.sh index d62a88d..026c846 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -192,15 +192,8 @@ export BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\" export BTCPAY_BASE_DIRECTORY=\"$BTCPAY_BASE_DIRECTORY\" export BTCPAY_ENV_FILE=\"$BTCPAY_ENV_FILE\" export BTCPAY_HOST_SSHKEYFILE=\"$BTCPAY_HOST_SSHKEYFILE\" -if cat \$BTCPAY_ENV_FILE &> /dev/null; then -export BTCPAY_HOST=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_HOST=\(.*\)$/\1/p')\" -export BTCPAY_IMAGE=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_IMAGE=\(.*\)$/\1/p')\" -export LETSENCRYPT_EMAIL=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^LETSENCRYPT_EMAIL=\(.*\)$/\1/p')\" -export NBITCOIN_NETWORK=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^NBITCOIN_NETWORK=\(.*\)$/\1/p')\" -export LIGHTNING_ALIAS=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^LIGHTNING_ALIAS=\(.*\)$/\1/p')\" -export ACME_CA_URI=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^ACME_CA_URI=\(.*\)$/\1/p')\" -export BTCPAY_SSHKEYFILE=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_SSHKEYFILE=\(.*\)$/\1/p')\" -export BTCPAY_SSHTRUSTEDFINGERPRINTS=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_SSHTRUSTEDFINGERPRINTS=\(.*\)$/\1/p')\" +if cat \"\$BTCPAY_ENV_FILE\" &> /dev/null; then + export \$(grep -v '^#' \"\$BTCPAY_ENV_FILE\" | xargs) fi " > /etc/profile.d/btcpay-env.sh chmod +x /etc/profile.d/btcpay-env.sh @@ -223,40 +216,47 @@ echo -e "BTCPay Server docker-compose parameters saved in $BTCPAY_ENV_FILE\n" . /etc/profile.d/btcpay-env.sh if ! [ -x "$(command -v docker)" ] || ! [ -x "$(command -v docker-compose)" ]; then - apt-get update 2>error - apt-get install -y \ - curl \ - apt-transport-https \ - ca-certificates \ - software-properties-common \ - 2>error - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - - if [ $(lsb_release -cs) == "bionic" ]; then - # Bionic not in the repo yet, see https://linuxconfig.org/how-to-install-docker-on-ubuntu-18-04-bionic-beaver - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable" - else - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + if ! [ -x "$(command -v curl)" ]; then + apt-get update 2>error + apt-get install -y \ + curl \ + apt-transport-https \ + ca-certificates \ + software-properties-common \ + 2>error + fi + if ! [ -x "$(command -v docker)" ]; then + echo "Trying to install docker..." + curl -fsSL https://get.docker.com -o get-docker.sh + chmod +x get-docker.sh + sh get-docker.sh + rm get-docker.sh + fi + if ! [ -x "$(command -v docker-compose)" ]; then + if [[ "$(uname -m)" == "x86_64" ]]; then + DOCKER_COMPOSE_DOWNLOAD="https://github.com/docker/compose/releases/download/1.17.1/docker-compose-$(uname -s)-$(uname -m)" + echo "Trying to install docker-compose by downloading on $DOCKER_COMPOSE_DOWNLOAD ($(uname -m))" + curl -L "$DOCKER_COMPOSE_DOWNLOAD" -o /usr/local/bin/docker-compose + chmod +x /usr/local/bin/docker-compose + else + echo "Trying to install docker-compose by using the docker-compose-builder ($(uname -m))" + ! [ -d "dist" ] && mkdir dist + docker run --rm -ti -v "$(pwd)/dist:/dist" btcpayserver/docker-compose-builder:1.22.0 + mv dist/docker-compose /usr/local/bin/docker-compose + chmod +x /usr/local/bin/docker-compose + rm -rf "dist" + fi fi - apt-get update 2>error fi if ! [ -x "$(command -v docker)" ]; then - if apt-get install -y docker-ce ; then - echo "Docker installed" - else - echo "Failed to install docker" - return - fi -else - echo -e "docker is already installed\n" + echo "Failed to install docker" + return fi -# Install docker-compose if ! [ -x "$(command -v docker-compose)" ]; then - curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose - chmod +x /usr/local/bin/docker-compose -else - echo -e "docker-compose is already installed\n" + echo "Failed to install docker-compose" + return fi # Generate the docker compose in BTCPAY_DOCKER_COMPOSE @@ -292,6 +292,7 @@ ExecReload=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd \"\$(dirname \$BTC WantedBy=multi-user.target" > /etc/systemd/system/btcpayserver.service 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 diff --git a/docker-compose-generator/docker-compose-generator.sln b/docker-compose-generator/docker-compose-generator.sln index 2cd718a..30e85e0 100644 --- a/docker-compose-generator/docker-compose-generator.sln +++ b/docker-compose-generator/docker-compose-generator.sln @@ -8,8 +8,8 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{8C1C711D-DEF1-474C-A9F6-AAE142412528}" ProjectSection(SolutionItems) = preProject ..\.circleci\config.yml = ..\.circleci\config.yml - Dockerfile.linuxamd64 = Dockerfile.linuxamd64 - Dockerfile.linuxarm32v7 = Dockerfile.linuxarm32v7 + linuxamd64.Dockerfile = linuxamd64.Dockerfile + linuxarm32v7.Dockerfile = linuxarm32v7.Dockerfile EndProjectSection EndProject Global diff --git a/docker-compose-generator/docker-fragments/bitcoin.yml b/docker-compose-generator/docker-fragments/bitcoin.yml index b41f881..84a10ea 100644 --- a/docker-compose-generator/docker-fragments/bitcoin.yml +++ b/docker-compose-generator/docker-fragments/bitcoin.yml @@ -4,7 +4,7 @@ services: bitcoind: restart: unless-stopped container_name: btcpayserver_bitcoind - image: nicolasdorier/docker-bitcoin:0.17.0 + image: btcpayserver/bitcoin:0.17.0 environment: BITCOIN_NETWORK: ${NBITCOIN_NETWORK:-regtest} BITCOIN_EXTRA_ARGS: | diff --git a/docker-compose-generator/docker-fragments/btcpayserver.yml b/docker-compose-generator/docker-fragments/btcpayserver.yml index 59397a7..293effb 100644 --- a/docker-compose-generator/docker-fragments/btcpayserver.yml +++ b/docker-compose-generator/docker-fragments/btcpayserver.yml @@ -4,7 +4,7 @@ services: btcpayserver: restart: unless-stopped - image: ${BTCPAY_IMAGE:-nicolasdorier/btcpayserver:1.0.3.16} + image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.0.3.17} expose: - "49392" environment: diff --git a/docker-compose-generator/docker-fragments/dogecoin.yml b/docker-compose-generator/docker-fragments/dogecoin.yml new file mode 100644 index 0000000..b5777bf --- /dev/null +++ b/docker-compose-generator/docker-fragments/dogecoin.yml @@ -0,0 +1,43 @@ +version: "3" + +services: + dogecoind: + restart: unless-stopped + container_name: btcpayserver_dogecoind + image: rockstardev/dogecoin:1.10.0 + environment: + DOGECOIN_EXTRA_ARGS: | + rpcuser=ceiwHEbqWI83 + rpcpassword=DwubwWsoo3 + ${NBITCOIN_NETWORK:-regtest}=1 + server=1 + rpcport=22555 + port=22556 + whitelist=0.0.0.0/0 + # Reducing memory usage of dogecoind. Don't try running this container without at least 2 GB of memory + # https://www.reddit.com/r/dogecoin/comments/5wynqe/reducing_memory_usage_of_dogecoind/ + dbcache=50 + ports: + - "22555:22555" + expose: + - "22555" # RPC + - "22556" # P2P + volumes: + - "dogecoin_datadir:/data" + nbxplorer: + environment: + NBXPLORER_CHAINS: "doge" + NBXPLORER_VIARPCURL: http://dogecoind:22555/ + NBXPLORER_VIANODEENDPOINT: dogecoind:22556 + NBXPLORER_DOGERPCUSER: ceiwHEbqWI83 + NBXPLORER_DOGERPCPASSWORD: DwubwWsoo3 + links: + - dogecoind + volumes: + - "dogecoin_datadir:/root/.dogecoin" + btcpayserver: + environment: + BTCPAY_CHAINS: "doge" + BTCPAY_DOGEEXPLORERURL: http://nbxplorer:32838/ +volumes: + dogecoin_datadir: diff --git a/docker-compose-generator/docker-fragments/nbxplorer.yml b/docker-compose-generator/docker-fragments/nbxplorer.yml index ca5f5a1..511d1af 100644 --- a/docker-compose-generator/docker-fragments/nbxplorer.yml +++ b/docker-compose-generator/docker-fragments/nbxplorer.yml @@ -4,7 +4,7 @@ services: nbxplorer: restart: unless-stopped - image: nicolasdorier/nbxplorer:1.1.0.18 + image: nicolasdorier/nbxplorer:2.0.0.1 expose: - "32838" environment: diff --git a/docker-compose-generator/docker-fragments/nginx.yml b/docker-compose-generator/docker-fragments/nginx.yml index d8e1081..9084d5a 100644 --- a/docker-compose-generator/docker-fragments/nginx.yml +++ b/docker-compose-generator/docker-fragments/nginx.yml @@ -18,7 +18,7 @@ services: nginx-gen: restart: unless-stopped - image: jwilder/docker-gen + image: btcpayserver/docker-gen:0.7.4 container_name: nginx-gen volumes: - "/var/run/docker.sock:/tmp/docker.sock:ro" @@ -33,7 +33,7 @@ services: letsencrypt-nginx-proxy-companion: restart: unless-stopped - image: jrcs/letsencrypt-nginx-proxy-companion + image: btcpayserver/letsencrypt-nginx-proxy-companion:1.10.0 container_name: letsencrypt-nginx-proxy-companion volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" diff --git a/docker-compose-generator/docker-fragments/opt-save-memory.yml b/docker-compose-generator/docker-fragments/opt-save-memory.yml new file mode 100644 index 0000000..90a4479 --- /dev/null +++ b/docker-compose-generator/docker-fragments/opt-save-memory.yml @@ -0,0 +1,34 @@ +version: "3" +# If your machine has less than 1GB of memory, use this + +services: + bitcoind: + environment: + BITCOIN_EXTRA_ARGS: | + dbcache=150 + maxmempool=100 + bgoldd: + environment: + BITCOIN_EXTRA_ARGS: | + dbcache=150 + maxmempool=100 + feathercoind: + environment: + BITCOIN_EXTRA_ARGS: | + dbcache=150 + maxmempool=100 + groestlcoind: + environment: + BITCOIN_EXTRA_ARGS: | + dbcache=150 + maxmempool=100 + litecoind: + environment: + BITCOIN_EXTRA_ARGS: | + dbcache=150 + maxmempool=100 + viacoind: + environment: + BITCOIN_EXTRA_ARGS: | + dbcache=150 + maxmempool=100 \ No newline at end of file diff --git a/docker-compose-generator/Dockerfile.linuxamd64 b/docker-compose-generator/linuxamd64.Dockerfile similarity index 100% rename from docker-compose-generator/Dockerfile.linuxamd64 rename to docker-compose-generator/linuxamd64.Dockerfile diff --git a/docker-compose-generator/Dockerfile.linuxarm32v7 b/docker-compose-generator/linuxarm32v7.Dockerfile similarity index 100% rename from docker-compose-generator/Dockerfile.linuxarm32v7 rename to docker-compose-generator/linuxarm32v7.Dockerfile diff --git a/docker-compose-generator/src/CryptoDefinition.cs b/docker-compose-generator/src/CryptoDefinition.cs index 27c638e..4798b56 100644 --- a/docker-compose-generator/src/CryptoDefinition.cs +++ b/docker-compose-generator/src/CryptoDefinition.cs @@ -65,6 +65,11 @@ namespace DockerGenerator { Crypto = "via", CryptoFragment = "viacoin" + }, + new CryptoDefinition() + { + Crypto = "doge", + CryptoFragment = "dogecoin" } }; } diff --git a/dogecoin-cli.ps1 b/dogecoin-cli.ps1 new file mode 100755 index 0000000..7d49051 --- /dev/null +++ b/dogecoin-cli.ps1 @@ -0,0 +1 @@ +docker exec -ti btcpayserver_dogecoind dogecoin-cli -datadir="/data" $args diff --git a/dogecoin-cli.sh b/dogecoin-cli.sh new file mode 100755 index 0000000..733ea87 --- /dev/null +++ b/dogecoin-cli.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker exec -ti btcpayserver_dogecoind dogecoin-cli -datadir="/data" "$@"