Bitcoin Forum
May 21, 2024, 12:54:25 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Getting BTCPayServer to run on Docker  (Read 142 times)
NotATether (OP)
Legendary
*
Online Online

Activity: 1610
Merit: 6752


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 06, 2022, 10:20:46 PM
Merited by ABCbits (4), hugeblack (4)
 #1

I am planning to host BTCPayServer on my Kubernetes cluster, but I am trying to get it running on one of the nodes using just Docker as a test first. I am unable to get the Docker image to start:

Command is docker run -it --rm  btcpayserver/btcpayserver:1.4.7 (I am trying to spawn btcpayserver in an interactive container shell to make sure that everything's working inside of it).

Code:
[root@api3 ~]# docker run -it --rm  btcpayserver/btcpayserver:1.4.7
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
info: Configuration:  Data Directory: /datadir
info: Configuration:  Configuration File: /datadir/Main/settings.config
info: Configuration:  Creating configuration file
info: BTCPayServer.Plugins.PluginManager: Loading plugins from /root/.btcpayserver/Plugins
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer - 1.4.7.0
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.Shopify - 1.4.7.0
info: Configuration:  Supported chains: BTC
Unhandled exception. System.InvalidOperationException: No database option was configured.
   at BTCPayServer.Hosting.BTCPayServerServices.<>c__DisplayClass1_0.<AddBTCPayServer>b__8(DatabaseOptions options, IOptions`1 datadirs) in /source/BTCPayServer/Hosting/BTCPayServerServices.cs:line 158
   at Microsoft.Extensions.Options.ConfigureNamedOptions`2.Configure(String name, TOptions options)
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
   at BTCPayServer.Abstractions.Contracts.BaseDbContextFactory`1.ConfigureBuilder(DbContextOptionsBuilder builder) in /source/BTCPayServer.Abstractions/Contracts/BaseDbContextFactory.cs:line 71
   at BTCPayServer.Hosting.BTCPayServerServices.<>c.<AddBTCPayServer>b__1_1(IServiceProvider provider, DbContextOptionsBuilder o) in /source/BTCPayServer/Hosting/BTCPayServerServices.cs:line 79
   at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.CreateDbContextOptions[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
   at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass17_0`1.<AddCoreServices>b__0(IServiceProvider p)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetServices[T](IServiceProvider provider)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.StartWithTasksAsync(IWebHost webHost, CancellationToken cancellationToken)
   at BTCPayServer.Program.Main(String[] args) in /source/BTCPayServer/Program.cs:line 70

As you can see, there is something about "No database option was configured", but I don't know how to set DB options because it's either not in the docs or it's buried somewhere deep I haven't seen yet.

Annoyingly there are guides for deployment on Azure, GCP and random 3rd parties but for something as simple as running it inside your own container, the only instructions are for a destructive install on bare metal.

I really, really don't want to do the manual installation on my nodes because it's nigh impossible to revert the changes as installation is just a shell script. And the nodes must not be restarted otherwise my K8s pods running on them are lost and it takes too much work recreating the cluster again.

They said it's most simple to just deploy the Docker container so that's what I'm trying to do.



PS. Is there a way to access the BTCPayServer only by IP address because domain names are not going to be visible from my K8s pod. With IP addresses I can just do port forwarding and then use the hostname of one of my nodes as the domain name.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Chlotide
Full Member
***
Offline Offline

Activity: 305
Merit: 106



View Profile
March 07, 2022, 11:44:08 AM
 #2

does this help ? https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended/#2-create-postgresql-database

PS. Is there a way to access the BTCPayServer only by IP address because domain names are not going to be visible from my K8s pod. With IP addresses I can just do port forwarding and then use the hostname of one of my nodes as the domain name.

If you plan to access it only from your home network than should work. https://docs.btcpayserver.org/Deployment/DynamicDNS/
NotATether (OP)
Legendary
*
Online Online

Activity: 1610
Merit: 6752


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 07, 2022, 07:26:11 PM
 #3

For the database part, I eventually found the configuration file that includes an example on how to specify the database options, so I took care of that part (MySQL - I already had it running in a container).

PS. Is there a way to access the BTCPayServer only by IP address because domain names are not going to be visible from my K8s pod. With IP addresses I can just do port forwarding and then use the hostname of one of my nodes as the domain name.

If you plan to access it only from your home network than should work. https://docs.btcpayserver.org/Deployment/DynamicDNS/

It's going to process payments for my website https://notatether.com . Definitely not for home use.

I just realized that BTCPayServer doesn't even let you log in on HTTP connections so my idea wouldn't work out anyway. I ended up hosting it directly on the metal with an Nginx reverse proxy and Certbot for HTTPS certificates.

Have you tried btcpay-setup.sh script which supposed to setup everything it needed to start BTCPay server[1]? Based on it's dockerfile, it already include postgres[2].

I was trying to avoid the setup script for as long as possible because it was going to configure a lot of stuff I didn't want - eg. Systemd services, exposing random stuff - by my definition - directly on the host with nginx and localhost ports, and extra containers on my system I don't want (because the ultimate goal was to host this on K8s - The cluster only runs stuff inside it) with no undo option.

I ideally wanted a single container where all of the full nodes, Lightning, NBXplorer and BTCPay stuff shared the same image, because I could not resolve the errors of "service ports not accessible from different containers" issue without the setup script - which as I mentioned is irreversible and installs additional stuff which I was not comfortable with it automatically doing.

I eventually had to compromise by running the nodes, NBXplorer, BTCPayServer and Nginx separately - without containers (result). True, I don't have autoupdate, but the more I think about it, I really don't want to give random software my SSH login details.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether (OP)
Legendary
*
Online Online

Activity: 1610
Merit: 6752


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 08, 2022, 02:39:16 PM
 #4

I eventually had to compromise by running the nodes, NBXplorer, BTCPayServer and Nginx separately - without containers (result). True, I don't have autoupdate, but the more I think about it, I really don't want to give random software my SSH login details.

If you priotize isolation and have lots of resource/time, have you consider KVM or manually setup everything[1] on docker?

[1] https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended/

I'm pretty sure that any type of hypervisor would not work well with running full nodes inside it. Specifically, constantly having to resize disk space.

As for manual docker setup, I had already tried that - but I gave up after I was unable to make NBXplorer talk to the full nodes running on the host. I'm pretty sure the experience would've been similar had the nodes been running inside a container instead.

Besides auto-update, exactly what important features am I missing out on with a manual setup (note that HTTPS has already been configured)?

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!