From eb6fa9271e41e7020df9bd4adbe742e142bdc7a5 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Mon, 1 Oct 2018 01:13:38 +0900 Subject: [PATCH 01/19] Remove not found fragment --- docker-compose-generator/src/DockerComposeDefinition.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose-generator/src/DockerComposeDefinition.cs b/docker-compose-generator/src/DockerComposeDefinition.cs index bf197f4..3e8ad95 100644 --- a/docker-compose-generator/src/DockerComposeDefinition.cs +++ b/docker-compose-generator/src/DockerComposeDefinition.cs @@ -42,12 +42,13 @@ namespace DockerGenerator var serializer = new SerializerBuilder().Build(); Console.WriteLine($"With fragments:"); - foreach (var fragment in Fragments) + foreach (var fragment in Fragments.ToList()) { var fragmentPath = GetFragmentLocation(fragment); if (!File.Exists(fragmentPath)) { Console.WriteLine($"\t{fragment} not found in {fragmentPath}, ignoring..."); + Fragments.Remove(fragment); } else { From 5dd49ad9d3db371926c17341c9d1b8a04f93e7c5 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 31 Oct 2018 13:19:23 +0900 Subject: [PATCH 02/19] bump .net --- docker-compose-generator/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-generator/Dockerfile b/docker-compose-generator/Dockerfile index 162d94e..49e8be0 100644 --- a/docker-compose-generator/Dockerfile +++ b/docker-compose-generator/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:2.1.402-sdk-alpine3.7 AS builder +FROM microsoft/dotnet:2.1.403-sdk-alpine3.7 AS builder WORKDIR /source COPY src/docker-compose-generator.csproj docker-compose-generator.csproj # Cache some dependencies @@ -6,7 +6,7 @@ RUN dotnet restore COPY src/. . RUN dotnet publish --output /app/ --configuration Release -FROM microsoft/dotnet:2.1.4-runtime-alpine3.7 +FROM microsoft/dotnet:2.1.5-runtime-alpine3.7 WORKDIR /app RUN mkdir /datadir From e17de97c93aaea51cd4cfc97f8bfbff7423efc0b Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Tue, 4 Dec 2018 14:54:04 +0100 Subject: [PATCH 03/19] Isolate postgres and enable mysql & sqlite through docker --- .../docker-fragments/btcpayserver.yml | 2 -- .../docker-fragments/mysql.yml | 19 +++++++++++++++++++ .../docker-fragments/postgres.yml | 5 +++++ .../src/DockerComposition.cs | 7 +++++++ docker-compose-generator/src/Program.cs | 4 +++- 5 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 docker-compose-generator/docker-fragments/mysql.yml diff --git a/docker-compose-generator/docker-fragments/btcpayserver.yml b/docker-compose-generator/docker-fragments/btcpayserver.yml index 9309a8b..8e34946 100644 --- a/docker-compose-generator/docker-fragments/btcpayserver.yml +++ b/docker-compose-generator/docker-fragments/btcpayserver.yml @@ -9,7 +9,6 @@ services: - "49392" environment: # BTCPay settings - BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver${NBITCOIN_NETWORK:-regtest} BTCPAY_NETWORK: ${NBITCOIN_NETWORK:-regtest} BTCPAY_BIND: 0.0.0.0:49392 BTCPAY_EXTERNALURL: ${BTCPAY_PROTOCOL:-https}://${BTCPAY_HOST}/ @@ -19,7 +18,6 @@ services: BTCPAY_DEBUGLOG: btcpay.log links: - nbxplorer - - postgres volumes: - "btcpay_datadir:/datadir" - "nbxplorer_datadir:/root/.nbxplorer" diff --git a/docker-compose-generator/docker-fragments/mysql.yml b/docker-compose-generator/docker-fragments/mysql.yml new file mode 100644 index 0000000..0fde6c9 --- /dev/null +++ b/docker-compose-generator/docker-fragments/mysql.yml @@ -0,0 +1,19 @@ +version: "3" + +services: + mysql: + restart: unless-stopped + image: mysql:8.0 + volumes: + - "mysql_datadir:/var/lib/mysql" + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + + btcpayserver: + environment: + BTCPAY_POSTGRES: Server=mysql;Database=btcpayserver${NBITCOIN_NETWORK:-regtest};Uid=root;Pwd=;Port=3306; + links: + - mysql + +volumes: + mysql_datadir: \ No newline at end of file diff --git a/docker-compose-generator/docker-fragments/postgres.yml b/docker-compose-generator/docker-fragments/postgres.yml index d558564..49563b9 100644 --- a/docker-compose-generator/docker-fragments/postgres.yml +++ b/docker-compose-generator/docker-fragments/postgres.yml @@ -6,6 +6,11 @@ services: image: postgres:9.6.5 volumes: - "postgres_datadir:/var/lib/postgresql/data" + btcpayserver: + environment: + BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver${NBITCOIN_NETWORK:-regtest} + links: + - postgres volumes: postgres_datadir: \ No newline at end of file diff --git a/docker-compose-generator/src/DockerComposition.cs b/docker-compose-generator/src/DockerComposition.cs index 8a924ed..050e39b 100644 --- a/docker-compose-generator/src/DockerComposition.cs +++ b/docker-compose-generator/src/DockerComposition.cs @@ -17,6 +17,12 @@ namespace DockerGenerator get; set; } + + public string SelectedDatabase + { + get; + set; + } public string SelectedLN { get; @@ -39,6 +45,7 @@ namespace DockerGenerator continue; composition.SelectedCryptos.Add(selectedCrypto.ToLowerInvariant()); } + composition.SelectedDatabase = (Environment.GetEnvironmentVariable("BTCPAYGEN_DATABASE") ?? "postgtres").ToLowerInvariant(); composition.SelectedProxy = (Environment.GetEnvironmentVariable("BTCPAYGEN_REVERSEPROXY") ?? "").ToLowerInvariant(); composition.SelectedLN = (Environment.GetEnvironmentVariable("BTCPAYGEN_LIGHTNING") ?? "").ToLowerInvariant(); composition.AdditionalFragments = (Environment.GetEnvironmentVariable("BTCPAYGEN_ADDITIONAL_FRAGMENTS") ?? "").ToLowerInvariant() diff --git a/docker-compose-generator/src/Program.cs b/docker-compose-generator/src/Program.cs index df4c0ad..8161fd4 100644 --- a/docker-compose-generator/src/Program.cs +++ b/docker-compose-generator/src/Program.cs @@ -51,7 +51,9 @@ namespace DockerGenerator } fragments.Add("btcpayserver"); fragments.Add("nbxplorer"); - fragments.Add("postgres"); + if(composition.SelectedDatabase != "sqlite"){ + fragments.Add(composition.SelectedDatabase); + } foreach (var crypto in CryptoDefinition.GetDefinitions()) { if (!composition.SelectedCryptos.Contains(crypto.Crypto)) From db341e5c5b79c66f45ed29f93c94693788ea8606 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Tue, 4 Dec 2018 15:02:01 +0100 Subject: [PATCH 04/19] integrate into build scripts --- README.md | 1 + btcpay-setup.sh | 4 ++++ build.ps1 | 1 + build.sh | 1 + docker-compose-generator/src/Properties/launchSettings.json | 3 ++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cf572f1..ee06db5 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ You can read [the article](https://medium.com/@BtcpayServer/hosting-btcpay-serve * `BTCPAYGEN_CRYPTON`: N'th supported crypto currency where N is 9 at maximum. (eg. `btc`, `ltc`. Default: `(empty)`) * `BTCPAYGEN_REVERSEPROXY`: Specify reverse proxy to use; NGinx has HTTPS support. (eg. `nginx`, `traefik`, `(empty)`. Default: `nginx`) * `BTCPAYGEN_LIGHTNING`: Lightning network implementation to use (eg. `clightning`, `(empty)`) +* `BTCPAYGEN_DATABASE`: Database Engine to use(eg. `postgres`, `mysql`, `sqlite`. Default: `postgres`) * `BTCPAYGEN_SUBNAME`: The subname of the generated docker-compose file, where the full name is `Generated/docker-compose.SUBNAME.yml` (Default: `generated`) * `BTCPAYGEN_ADDITIONAL_FRAGMENTS`: Semicolon-separated list of additional fragments you want to use (eg. `opt-save-storage`) * `LETSENCRYPT_EMAIL`: An email will be sent to this address if certificate expires and fails to renew automatically (eg. `me@example.com`) diff --git a/btcpay-setup.sh b/btcpay-setup.sh index 776faae..ea11ed0 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -57,6 +57,7 @@ Environment variables: BTCPAYGEN_CRYPTON: N th supported crypto currency where N is maximum at maximum 9. (Default: none) BTCPAYGEN_REVERSEPROXY: Whether to use or not a reverse proxy. NGinx setup HTTPS for you. (eg. nginx, traefik, none. Default: nginx) BTCPAYGEN_LIGHTNING: Lightning network implementation to use (eg. clightning, lnd, none) + BTCPAYGEN_DATABASE: Database Engine to use(eg. postgres, mysql, sqlite. Default: postgres) BTCPAYGEN_ADDITIONAL_FRAGMENTS: Semi colon separated list of additional fragments you want to use (eg. opt-save-storage) ACME_CA_URI: The API endpoint to ask for HTTPS certificate (default: https://acme-v01.api.letsencrypt.org/directory) BTCPAY_HOST_SSHKEYFILE: Optional, SSH private key that BTCPay can use to connect to this VM's SSH server. This key will be copied on BTCPay's data directory @@ -85,6 +86,7 @@ fi : "${BTCPAYGEN_CRYPTO1:=btc}" : "${BTCPAYGEN_REVERSEPROXY:=nginx}" : "${BTCPAYGEN_LIGHTNING:=none}" +: "${BTCPAYGEN_DATABASE:=postgres}" : "${ACME_CA_URI:=https://acme-v01.api.letsencrypt.org/directory}" OLD_BTCPAY_DOCKER_COMPOSE=$BTCPAY_DOCKER_COMPOSE @@ -143,6 +145,7 @@ BTCPAYGEN_CRYPTO8:$BTCPAYGEN_CRYPTO8 BTCPAYGEN_CRYPTO9:$BTCPAYGEN_CRYPTO9 BTCPAYGEN_REVERSEPROXY:$BTCPAYGEN_REVERSEPROXY BTCPAYGEN_LIGHTNING:$BTCPAYGEN_LIGHTNING +BTCPAYGEN_DATABASE:$BTCPAYGEN_DATABASE BTCPAYGEN_ADDITIONAL_FRAGMENTS:$BTCPAYGEN_ADDITIONAL_FRAGMENTS BTCPAY_IMAGE:$BTCPAY_IMAGE ACME_CA_URI:$ACME_CA_URI @@ -186,6 +189,7 @@ export BTCPAYGEN_CRYPTO7=\"$BTCPAYGEN_CRYPTO7\" export BTCPAYGEN_CRYPTO8=\"$BTCPAYGEN_CRYPTO8\" export BTCPAYGEN_CRYPTO9=\"$BTCPAYGEN_CRYPTO9\" export BTCPAYGEN_LIGHTNING=\"$BTCPAYGEN_LIGHTNING\" +export BTCPAYGEN_DATABASE=\"$BTCPAYGEN_DATABASE\" export BTCPAYGEN_REVERSEPROXY=\"$BTCPAYGEN_REVERSEPROXY\" export BTCPAYGEN_ADDITIONAL_FRAGMENTS=\"$BTCPAYGEN_ADDITIONAL_FRAGMENTS\" export BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\" diff --git a/build.ps1 b/build.ps1 index 2bafc9e..0b1baed 100755 --- a/build.ps1 +++ b/build.ps1 @@ -22,6 +22,7 @@ docker run -v "$(Get-Location)\Generated:/app/Generated" ` -e "BTCPAYGEN_REVERSEPROXY=$BTCPAYGEN_REVERSEPROXY" ` -e "BTCPAYGEN_ADDITIONAL_FRAGMENTS=$BTCPAYGEN_ADDITIONAL_FRAGMENTS" ` -e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" ` + -e "BTCPAYGEN_DATABASE=$BTCPAYGEN_DATABASE" ` -e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" ` --rm $BTCPAYGEN_DOCKER_IMAGE diff --git a/build.sh b/build.sh index 09f9a4a..dcb3588 100755 --- a/build.sh +++ b/build.sh @@ -23,6 +23,7 @@ docker run -v "$(pwd)/Generated:/app/Generated" \ -e "BTCPAYGEN_REVERSEPROXY=$BTCPAYGEN_REVERSEPROXY" \ -e "BTCPAYGEN_ADDITIONAL_FRAGMENTS=$BTCPAYGEN_ADDITIONAL_FRAGMENTS" \ -e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" \ + -e "BTCPAYGEN_DATABASE=$BTCPAYGEN_DATABASE" \ -e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" \ --rm $BTCPAYGEN_DOCKER_IMAGE diff --git a/docker-compose-generator/src/Properties/launchSettings.json b/docker-compose-generator/src/Properties/launchSettings.json index b29a0ab..eebb423 100644 --- a/docker-compose-generator/src/Properties/launchSettings.json +++ b/docker-compose-generator/src/Properties/launchSettings.json @@ -9,7 +9,8 @@ "BTCPAYGEN_CRYPTO3": "btg", "BTCPAYGEN_CRYPTO2": "ltc", "BTCPAYGEN_CRYPTO1": "btc", - "BTCPAYGEN_REVERSEPROXY": "nginx" + "BTCPAYGEN_REVERSEPROXY": "nginx", + "BTCPAYGEN_DATABASE": "postgres" } } } From 5d4cd5427f72c824a69fbb3965350bd7da7c1939 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Wed, 5 Dec 2018 14:03:36 +0100 Subject: [PATCH 05/19] Update mysql.yml --- docker-compose-generator/docker-fragments/mysql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-generator/docker-fragments/mysql.yml b/docker-compose-generator/docker-fragments/mysql.yml index 0fde6c9..80c844b 100644 --- a/docker-compose-generator/docker-fragments/mysql.yml +++ b/docker-compose-generator/docker-fragments/mysql.yml @@ -11,9 +11,9 @@ services: btcpayserver: environment: - BTCPAY_POSTGRES: Server=mysql;Database=btcpayserver${NBITCOIN_NETWORK:-regtest};Uid=root;Pwd=;Port=3306; + BTCPAY_MYSQL: Server=mysql;Database=btcpayserver${NBITCOIN_NETWORK:-regtest};Uid=root;Pwd=;Port=3306; links: - mysql volumes: - mysql_datadir: \ No newline at end of file + mysql_datadir: From b6c4948d5633d955f68f171e29f45991ace943ec Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Thu, 6 Dec 2018 11:03:11 +0100 Subject: [PATCH 06/19] text env var fix --- docker-compose-generator/docker-fragments/mysql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose-generator/docker-fragments/mysql.yml b/docker-compose-generator/docker-fragments/mysql.yml index 80c844b..fbf9ebe 100644 --- a/docker-compose-generator/docker-fragments/mysql.yml +++ b/docker-compose-generator/docker-fragments/mysql.yml @@ -7,7 +7,7 @@ services: volumes: - "mysql_datadir:/var/lib/mysql" environment: - MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_ALLOW_EMPTY_PASSWORD:"yes" btcpayserver: environment: From 21592b82fab488e17d8628529346ea98651ca0c6 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Thu, 6 Dec 2018 11:04:26 +0100 Subject: [PATCH 07/19] yml fix --- docker-compose-generator/docker-fragments/mysql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose-generator/docker-fragments/mysql.yml b/docker-compose-generator/docker-fragments/mysql.yml index fbf9ebe..739ee72 100644 --- a/docker-compose-generator/docker-fragments/mysql.yml +++ b/docker-compose-generator/docker-fragments/mysql.yml @@ -7,7 +7,7 @@ services: volumes: - "mysql_datadir:/var/lib/mysql" environment: - MYSQL_ALLOW_EMPTY_PASSWORD:"yes" + - MYSQL_ALLOW_EMPTY_PASSWORD="true" btcpayserver: environment: From 8c734d28c9adf7e4402d630767ebaf2e579a6ad0 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Thu, 6 Dec 2018 11:54:50 +0100 Subject: [PATCH 08/19] format file --- docker-compose-generator/src/Program.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docker-compose-generator/src/Program.cs b/docker-compose-generator/src/Program.cs index 8161fd4..4bf6e32 100644 --- a/docker-compose-generator/src/Program.cs +++ b/docker-compose-generator/src/Program.cs @@ -8,10 +8,10 @@ namespace DockerGenerator { class Program { - static void Main(string[] args) { - var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? FindRoot("app") + var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" + ? FindRoot("app") : Path.GetFullPath(Path.Combine(FindRoot("docker-compose-generator"), "..")); var composition = DockerComposition.FromEnvironmentVariables(); @@ -27,7 +27,9 @@ namespace DockerGenerator private void Run(DockerComposition composition, string name, string output) { - var fragmentLocation = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? "app" : "docker-compose-generator"; + var fragmentLocation = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" + ? "app" + : "docker-compose-generator"; fragmentLocation = FindRoot(fragmentLocation); fragmentLocation = Path.GetFullPath(Path.Combine(fragmentLocation, "docker-fragments")); @@ -49,11 +51,14 @@ namespace DockerGenerator fragments.Add("btcpayserver-noreverseproxy"); break; } + fragments.Add("btcpayserver"); fragments.Add("nbxplorer"); - if(composition.SelectedDatabase != "sqlite"){ + if (composition.SelectedDatabase != "sqlite") + { fragments.Add(composition.SelectedDatabase); } + foreach (var crypto in CryptoDefinition.GetDefinitions()) { if (!composition.SelectedCryptos.Contains(crypto.Crypto)) @@ -64,6 +69,7 @@ namespace DockerGenerator { fragments.Add(crypto.CLightningFragment); } + if (composition.SelectedLN == "lnd" && crypto.LNDFragment != null) { fragments.Add(crypto.LNDFragment); @@ -96,4 +102,4 @@ namespace DockerGenerator } } } -} +} \ No newline at end of file From aea03efd64eda1f210874e5837c7ca83f136c2c2 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 6 Dec 2018 22:09:52 +0900 Subject: [PATCH 09/19] Limit log file size of docker --- btcpay-setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/btcpay-setup.sh b/btcpay-setup.sh index 7af3133..4305350 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -295,6 +295,14 @@ ExecReload=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd \"\$(dirname \$BTC [Install] WantedBy=multi-user.target" > /etc/systemd/system/btcpayserver.service +if ! [ -f "/etc/docker/daemon.json" ]; then +echo "{ +\"log-driver\": \"json-file\", +\"log-opts\": {\"max-size\": \"5m\", \"max-file\": \"3\"} +}" > /etc/docker/daemon.json +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 From 285b69ed8ff586d354fd7994cb0704da4de4514c Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 6 Dec 2018 22:19:11 +0900 Subject: [PATCH 10/19] Add logs about daemon.json --- btcpay-setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/btcpay-setup.sh b/btcpay-setup.sh index 4305350..859cff6 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -300,6 +300,7 @@ echo "{ \"log-driver\": \"json-file\", \"log-opts\": {\"max-size\": \"5m\", \"max-file\": \"3\"} }" > /etc/docker/daemon.json +echo "Setting limited log files in /etc/docker/daemon.json" systemctl restart docker fi From b0877392c563b24678bffd1cb40b5485c728854f Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 6 Dec 2018 23:16:17 +0900 Subject: [PATCH 11/19] limit logs at next update --- btcpay-update.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/btcpay-update.sh b/btcpay-update.sh index 9aeb146..759935b 100755 --- a/btcpay-update.sh +++ b/btcpay-update.sh @@ -17,6 +17,15 @@ fi cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker" git pull --force +if ! [ -f "/etc/docker/daemon.json" ]; then +echo "{ +\"log-driver\": \"json-file\", +\"log-opts\": {\"max-size\": \"5m\", \"max-file\": \"3\"} +}" > /etc/docker/daemon.json +echo "Setting limited log files in /etc/docker/daemon.json" +[ -x "$(command -v systemctl)" ] && systemctl restart docker +fi + . ./build.sh if [ "$BTCPAYGEN_OLD_PREGEN" == "true" ]; then cp Generated/docker-compose.generated.yml $BTCPAY_DOCKER_COMPOSE From 49a759943cb53189011c5ea0ef21d513371d82ff Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 6 Dec 2018 23:18:06 +0900 Subject: [PATCH 12/19] Do not restart docker --- btcpay-update.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/btcpay-update.sh b/btcpay-update.sh index 759935b..56db6be 100755 --- a/btcpay-update.sh +++ b/btcpay-update.sh @@ -23,7 +23,6 @@ echo "{ \"log-opts\": {\"max-size\": \"5m\", \"max-file\": \"3\"} }" > /etc/docker/daemon.json echo "Setting limited log files in /etc/docker/daemon.json" -[ -x "$(command -v systemctl)" ] && systemctl restart docker fi . ./build.sh From e7017ae9efbeab39daad29df2123ece56f21dcee Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 7 Dec 2018 11:52:31 +0900 Subject: [PATCH 13/19] bump btcqbo --- docker-compose-generator/docker-fragments/opt-add-btcqbo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml b/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml index a862a79..dfc46f2 100644 --- a/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml +++ b/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml @@ -2,7 +2,7 @@ version: "3" services: btcqbo: - image: jvandrew/btcqbo:0.1.1 + image: jvandrew/btcqbo:0.1.2 environment: REDIS_URL: "redis://redis:6379/0" BTCPAY_HOST: ${BTCPAY_PROTOCOL:-https}://${BTCPAY_HOST} @@ -12,7 +12,7 @@ services: links: - redis rq-worker: - image: jvandrew/btcqbo:0.1.1 + image: jvandrew/btcqbo:0.1.2 entrypoint: /usr/local/bin/rq command: worker -u redis://redis:6379/0 btcqbo environment: From d7241f0d0fba7017d43696cb0cc2aa11c9cb0323 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 7 Dec 2018 12:43:04 +0900 Subject: [PATCH 14/19] bump lnd --- docker-compose-generator/docker-fragments/bitcoin-lnd.yml | 2 +- docker-compose-generator/docker-fragments/litecoin-lnd.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-generator/docker-fragments/bitcoin-lnd.yml b/docker-compose-generator/docker-fragments/bitcoin-lnd.yml index 432eeb9..529e788 100644 --- a/docker-compose-generator/docker-fragments/bitcoin-lnd.yml +++ b/docker-compose-generator/docker-fragments/bitcoin-lnd.yml @@ -2,7 +2,7 @@ version: "3" services: lnd_bitcoin: - image: btcpayserver/lnd:v0.5-beta-3 + image: btcpayserver/lnd:v0.5.1-beta container_name: btcpayserver_lnd_bitcoin restart: unless-stopped environment: diff --git a/docker-compose-generator/docker-fragments/litecoin-lnd.yml b/docker-compose-generator/docker-fragments/litecoin-lnd.yml index 8f88c5a..621138a 100644 --- a/docker-compose-generator/docker-fragments/litecoin-lnd.yml +++ b/docker-compose-generator/docker-fragments/litecoin-lnd.yml @@ -2,7 +2,7 @@ version: "3" services: lnd_litecoin: - image: btcpayserver/lnd:v0.5-beta-3 + image: btcpayserver/lnd:v0.5.1-beta container_name: btcpayserver_lnd_litecoin restart: unless-stopped environment: From 4302a62714ead4f0dd5ca5ff7c8e9f9e769cc166 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 7 Dec 2018 12:59:50 +0900 Subject: [PATCH 15/19] export postgres --- btcpay-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btcpay-update.sh b/btcpay-update.sh index 56db6be..a56b517 100755 --- a/btcpay-update.sh +++ b/btcpay-update.sh @@ -16,7 +16,7 @@ fi cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker" git pull --force - +export BTCPAYGEN_DATABASE="postgres" if ! [ -f "/etc/docker/daemon.json" ]; then echo "{ \"log-driver\": \"json-file\", From ee6f9fba9aae9889f3031b63064bef57a40b4fe0 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 7 Dec 2018 13:00:32 +0900 Subject: [PATCH 16/19] Revert "export postgres" This reverts commit 4302a62714ead4f0dd5ca5ff7c8e9f9e769cc166. --- btcpay-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btcpay-update.sh b/btcpay-update.sh index a56b517..56db6be 100755 --- a/btcpay-update.sh +++ b/btcpay-update.sh @@ -16,7 +16,7 @@ fi cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker" git pull --force -export BTCPAYGEN_DATABASE="postgres" + if ! [ -f "/etc/docker/daemon.json" ]; then echo "{ \"log-driver\": \"json-file\", From 43c8443f3afa27aa9c8093a03e21f7cb66ba6aed Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 7 Dec 2018 13:08:17 +0900 Subject: [PATCH 17/19] Revert "Merge pull request #72 from Kukks/feature/mysql" This reverts commit a1878999450872ec0b3e12703330c186851de35d, reversing changes made to d7241f0d0fba7017d43696cb0cc2aa11c9cb0323. --- README.md | 1 - btcpay-setup.sh | 4 ---- build.ps1 | 1 - build.sh | 1 - .../docker-fragments/btcpayserver.yml | 2 ++ .../docker-fragments/mysql.yml | 19 ------------------- .../docker-fragments/postgres.yml | 5 ----- .../src/DockerComposition.cs | 7 ------- docker-compose-generator/src/Program.cs | 18 +++++------------- .../src/Properties/launchSettings.json | 3 +-- 10 files changed, 8 insertions(+), 53 deletions(-) delete mode 100644 docker-compose-generator/docker-fragments/mysql.yml diff --git a/README.md b/README.md index efcbf0d..fac68e0 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,6 @@ You can read [the article](https://medium.com/@BtcpayServer/hosting-btcpay-serve * `BTCPAYGEN_CRYPTON`: N'th supported crypto currency where N is 9 at maximum. (eg. `btc`, `ltc`. Default: `(empty)`) * `BTCPAYGEN_REVERSEPROXY`: Specify reverse proxy to use; NGinx has HTTPS support. (eg. `nginx`, `traefik`, `(empty)`. Default: `nginx`) * `BTCPAYGEN_LIGHTNING`: Lightning network implementation to use (eg. `clightning`, `(empty)`) -* `BTCPAYGEN_DATABASE`: Database Engine to use(eg. `postgres`, `mysql`, `sqlite`. Default: `postgres`) * `BTCPAYGEN_SUBNAME`: The subname of the generated docker-compose file, where the full name is `Generated/docker-compose.SUBNAME.yml` (Default: `generated`) * `BTCPAYGEN_ADDITIONAL_FRAGMENTS`: Semicolon-separated list of additional fragments you want to use (eg. `opt-save-storage`) * `LETSENCRYPT_EMAIL`: An email will be sent to this address if certificate expires and fails to renew automatically (eg. `me@example.com`) diff --git a/btcpay-setup.sh b/btcpay-setup.sh index b69333a..859cff6 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -57,7 +57,6 @@ Environment variables: BTCPAYGEN_CRYPTON: N th supported crypto currency where N is maximum at maximum 9. (Default: none) BTCPAYGEN_REVERSEPROXY: Whether to use or not a reverse proxy. NGinx setup HTTPS for you. (eg. nginx, traefik, none. Default: nginx) BTCPAYGEN_LIGHTNING: Lightning network implementation to use (eg. clightning, lnd, none) - BTCPAYGEN_DATABASE: Database Engine to use(eg. postgres, mysql, sqlite. Default: postgres) BTCPAYGEN_ADDITIONAL_FRAGMENTS: Semi colon separated list of additional fragments you want to use (eg. opt-save-storage) ACME_CA_URI: The API endpoint to ask for HTTPS certificate (default: https://acme-v01.api.letsencrypt.org/directory) BTCPAY_HOST_SSHKEYFILE: Optional, SSH private key that BTCPay can use to connect to this VM's SSH server. This key will be copied on BTCPay's data directory @@ -95,7 +94,6 @@ fi : "${BTCPAYGEN_CRYPTO1:=btc}" : "${BTCPAYGEN_REVERSEPROXY:=nginx}" : "${BTCPAYGEN_LIGHTNING:=none}" -: "${BTCPAYGEN_DATABASE:=postgres}" : "${ACME_CA_URI:=https://acme-v01.api.letsencrypt.org/directory}" OLD_BTCPAY_DOCKER_COMPOSE=$BTCPAY_DOCKER_COMPOSE @@ -154,7 +152,6 @@ BTCPAYGEN_CRYPTO8:$BTCPAYGEN_CRYPTO8 BTCPAYGEN_CRYPTO9:$BTCPAYGEN_CRYPTO9 BTCPAYGEN_REVERSEPROXY:$BTCPAYGEN_REVERSEPROXY BTCPAYGEN_LIGHTNING:$BTCPAYGEN_LIGHTNING -BTCPAYGEN_DATABASE:$BTCPAYGEN_DATABASE BTCPAYGEN_ADDITIONAL_FRAGMENTS:$BTCPAYGEN_ADDITIONAL_FRAGMENTS BTCPAY_IMAGE:$BTCPAY_IMAGE ACME_CA_URI:$ACME_CA_URI @@ -193,7 +190,6 @@ export BTCPAYGEN_CRYPTO7=\"$BTCPAYGEN_CRYPTO7\" export BTCPAYGEN_CRYPTO8=\"$BTCPAYGEN_CRYPTO8\" export BTCPAYGEN_CRYPTO9=\"$BTCPAYGEN_CRYPTO9\" export BTCPAYGEN_LIGHTNING=\"$BTCPAYGEN_LIGHTNING\" -export BTCPAYGEN_DATABASE=\"$BTCPAYGEN_DATABASE\" export BTCPAYGEN_REVERSEPROXY=\"$BTCPAYGEN_REVERSEPROXY\" export BTCPAYGEN_ADDITIONAL_FRAGMENTS=\"$BTCPAYGEN_ADDITIONAL_FRAGMENTS\" export BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\" diff --git a/build.ps1 b/build.ps1 index 0b1baed..2bafc9e 100755 --- a/build.ps1 +++ b/build.ps1 @@ -22,7 +22,6 @@ docker run -v "$(Get-Location)\Generated:/app/Generated" ` -e "BTCPAYGEN_REVERSEPROXY=$BTCPAYGEN_REVERSEPROXY" ` -e "BTCPAYGEN_ADDITIONAL_FRAGMENTS=$BTCPAYGEN_ADDITIONAL_FRAGMENTS" ` -e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" ` - -e "BTCPAYGEN_DATABASE=$BTCPAYGEN_DATABASE" ` -e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" ` --rm $BTCPAYGEN_DOCKER_IMAGE diff --git a/build.sh b/build.sh index dcb3588..09f9a4a 100755 --- a/build.sh +++ b/build.sh @@ -23,7 +23,6 @@ docker run -v "$(pwd)/Generated:/app/Generated" \ -e "BTCPAYGEN_REVERSEPROXY=$BTCPAYGEN_REVERSEPROXY" \ -e "BTCPAYGEN_ADDITIONAL_FRAGMENTS=$BTCPAYGEN_ADDITIONAL_FRAGMENTS" \ -e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" \ - -e "BTCPAYGEN_DATABASE=$BTCPAYGEN_DATABASE" \ -e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" \ --rm $BTCPAYGEN_DOCKER_IMAGE diff --git a/docker-compose-generator/docker-fragments/btcpayserver.yml b/docker-compose-generator/docker-fragments/btcpayserver.yml index 4ae1fa0..59790ce 100644 --- a/docker-compose-generator/docker-fragments/btcpayserver.yml +++ b/docker-compose-generator/docker-fragments/btcpayserver.yml @@ -9,6 +9,7 @@ services: - "49392" environment: # BTCPay settings + BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver${NBITCOIN_NETWORK:-regtest} BTCPAY_NETWORK: ${NBITCOIN_NETWORK:-regtest} BTCPAY_BIND: 0.0.0.0:49392 BTCPAY_EXTERNALURL: ${BTCPAY_PROTOCOL:-https}://${BTCPAY_HOST}/ @@ -18,6 +19,7 @@ services: BTCPAY_DEBUGLOG: btcpay.log links: - nbxplorer + - postgres volumes: - "btcpay_datadir:/datadir" - "nbxplorer_datadir:/root/.nbxplorer" diff --git a/docker-compose-generator/docker-fragments/mysql.yml b/docker-compose-generator/docker-fragments/mysql.yml deleted file mode 100644 index 739ee72..0000000 --- a/docker-compose-generator/docker-fragments/mysql.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: "3" - -services: - mysql: - restart: unless-stopped - image: mysql:8.0 - volumes: - - "mysql_datadir:/var/lib/mysql" - environment: - - MYSQL_ALLOW_EMPTY_PASSWORD="true" - - btcpayserver: - environment: - BTCPAY_MYSQL: Server=mysql;Database=btcpayserver${NBITCOIN_NETWORK:-regtest};Uid=root;Pwd=;Port=3306; - links: - - mysql - -volumes: - mysql_datadir: diff --git a/docker-compose-generator/docker-fragments/postgres.yml b/docker-compose-generator/docker-fragments/postgres.yml index 49563b9..d558564 100644 --- a/docker-compose-generator/docker-fragments/postgres.yml +++ b/docker-compose-generator/docker-fragments/postgres.yml @@ -6,11 +6,6 @@ services: image: postgres:9.6.5 volumes: - "postgres_datadir:/var/lib/postgresql/data" - btcpayserver: - environment: - BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver${NBITCOIN_NETWORK:-regtest} - links: - - postgres volumes: postgres_datadir: \ No newline at end of file diff --git a/docker-compose-generator/src/DockerComposition.cs b/docker-compose-generator/src/DockerComposition.cs index 050e39b..8a924ed 100644 --- a/docker-compose-generator/src/DockerComposition.cs +++ b/docker-compose-generator/src/DockerComposition.cs @@ -17,12 +17,6 @@ namespace DockerGenerator get; set; } - - public string SelectedDatabase - { - get; - set; - } public string SelectedLN { get; @@ -45,7 +39,6 @@ namespace DockerGenerator continue; composition.SelectedCryptos.Add(selectedCrypto.ToLowerInvariant()); } - composition.SelectedDatabase = (Environment.GetEnvironmentVariable("BTCPAYGEN_DATABASE") ?? "postgtres").ToLowerInvariant(); composition.SelectedProxy = (Environment.GetEnvironmentVariable("BTCPAYGEN_REVERSEPROXY") ?? "").ToLowerInvariant(); composition.SelectedLN = (Environment.GetEnvironmentVariable("BTCPAYGEN_LIGHTNING") ?? "").ToLowerInvariant(); composition.AdditionalFragments = (Environment.GetEnvironmentVariable("BTCPAYGEN_ADDITIONAL_FRAGMENTS") ?? "").ToLowerInvariant() diff --git a/docker-compose-generator/src/Program.cs b/docker-compose-generator/src/Program.cs index 4bf6e32..df4c0ad 100644 --- a/docker-compose-generator/src/Program.cs +++ b/docker-compose-generator/src/Program.cs @@ -8,10 +8,10 @@ namespace DockerGenerator { class Program { + static void Main(string[] args) { - var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" - ? FindRoot("app") + var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? FindRoot("app") : Path.GetFullPath(Path.Combine(FindRoot("docker-compose-generator"), "..")); var composition = DockerComposition.FromEnvironmentVariables(); @@ -27,9 +27,7 @@ namespace DockerGenerator private void Run(DockerComposition composition, string name, string output) { - var fragmentLocation = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" - ? "app" - : "docker-compose-generator"; + var fragmentLocation = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? "app" : "docker-compose-generator"; fragmentLocation = FindRoot(fragmentLocation); fragmentLocation = Path.GetFullPath(Path.Combine(fragmentLocation, "docker-fragments")); @@ -51,14 +49,9 @@ namespace DockerGenerator fragments.Add("btcpayserver-noreverseproxy"); break; } - fragments.Add("btcpayserver"); fragments.Add("nbxplorer"); - if (composition.SelectedDatabase != "sqlite") - { - fragments.Add(composition.SelectedDatabase); - } - + fragments.Add("postgres"); foreach (var crypto in CryptoDefinition.GetDefinitions()) { if (!composition.SelectedCryptos.Contains(crypto.Crypto)) @@ -69,7 +62,6 @@ namespace DockerGenerator { fragments.Add(crypto.CLightningFragment); } - if (composition.SelectedLN == "lnd" && crypto.LNDFragment != null) { fragments.Add(crypto.LNDFragment); @@ -102,4 +94,4 @@ namespace DockerGenerator } } } -} \ No newline at end of file +} diff --git a/docker-compose-generator/src/Properties/launchSettings.json b/docker-compose-generator/src/Properties/launchSettings.json index eebb423..b29a0ab 100644 --- a/docker-compose-generator/src/Properties/launchSettings.json +++ b/docker-compose-generator/src/Properties/launchSettings.json @@ -9,8 +9,7 @@ "BTCPAYGEN_CRYPTO3": "btg", "BTCPAYGEN_CRYPTO2": "ltc", "BTCPAYGEN_CRYPTO1": "btc", - "BTCPAYGEN_REVERSEPROXY": "nginx", - "BTCPAYGEN_DATABASE": "postgres" + "BTCPAYGEN_REVERSEPROXY": "nginx" } } } From 9574e87d606ffb3fc87af8f999ff6aefb708bcf7 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 7 Dec 2018 15:00:30 +0900 Subject: [PATCH 18/19] bump --- docker-compose-generator/docker-fragments/opt-add-btcqbo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml b/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml index dfc46f2..857bce2 100644 --- a/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml +++ b/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml @@ -2,7 +2,7 @@ version: "3" services: btcqbo: - image: jvandrew/btcqbo:0.1.2 + image: jvandrew/btcqbo:0.1.3 environment: REDIS_URL: "redis://redis:6379/0" BTCPAY_HOST: ${BTCPAY_PROTOCOL:-https}://${BTCPAY_HOST} @@ -12,7 +12,7 @@ services: links: - redis rq-worker: - image: jvandrew/btcqbo:0.1.2 + image: jvandrew/btcqbo:0.1.3 entrypoint: /usr/local/bin/rq command: worker -u redis://redis:6379/0 btcqbo environment: From 2fb50a68c4d52bb16e07485154dcebea20b79b83 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 7 Dec 2018 16:21:12 +0900 Subject: [PATCH 19/19] bump btcqbo --- docker-compose-generator/docker-fragments/opt-add-btcqbo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml b/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml index 857bce2..7c00ec4 100644 --- a/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml +++ b/docker-compose-generator/docker-fragments/opt-add-btcqbo.yml @@ -2,7 +2,7 @@ version: "3" services: btcqbo: - image: jvandrew/btcqbo:0.1.3 + image: jvandrew/btcqbo:0.1.8 environment: REDIS_URL: "redis://redis:6379/0" BTCPAY_HOST: ${BTCPAY_PROTOCOL:-https}://${BTCPAY_HOST} @@ -12,7 +12,7 @@ services: links: - redis rq-worker: - image: jvandrew/btcqbo:0.1.3 + image: jvandrew/btcqbo:0.1.8 entrypoint: /usr/local/bin/rq command: worker -u redis://redis:6379/0 btcqbo environment: