btcpayserver / btcpayserver-docker

Docker resources for hosting BTCPayServer easily
MIT License
588 stars 362 forks source link

Question: Running multiple installs on 1 machine #250

Open woutersamaey opened 4 years ago

woutersamaey commented 4 years ago

Question: Can I run multiple docker installs on the same machine, for example 1 BTCPay Server with LND and another identical one with C-lightning?

If not, what would be required or what would be the path to building this?

NicolasDorier commented 4 years ago

No you can't. If you figure out how let us know. But there is many problems with it:

  1. Make sure two instances don't save at same place
  2. Make sure they don't have port conflicts (I don't know how)
  3. Make sure you have different user for running docker as it relies on env variable in the user profile

I would say this is not worth it trying to do.

There is an alternative: Using Virtual Machines, but you need to know how to configure network and VMs correctly, which is not obvious either.

woutersamaey commented 4 years ago

Doesn’t Kubernetes or Docker Swarm handle (most) of these issues? I’m not up to speed, but looking to learn more on these topics.

Another use case could be a cloud hoster offering BTCPayServer installs for rent (backed by Kunernetes for example).

NicolasDorier commented 4 years ago

no idea. Maybe Docker Swarm would work, maybe not. I don't know.

ramontayag commented 4 years ago

Yes you can do this with Kubernetes. Currently looking for resources to speed up this process

Edit: one snag I've run into is that the same volume is mounted in different containers, and this capability isn't widely available in Kubernetes, especially if it's ReadWriteMany (mounted in multiple containers, and they can all write into the same volume) that is required.

woutersamaey commented 4 years ago

@ramontayag it would also be great if some containers could be created once, and re-used by all instances. The bitcoin core node for example takes up a lot of disk space and would not make sense to duplicate for every tenant (if I’m not mistaken). I guess we should make a list of containers that contain customer data and containers that are the same for all. @NicolasDorier could you confirm and/or provide a list?

NicolasDorier commented 4 years ago

I really can't there is many volume folder and this is a case by case.

ramontayag commented 4 years ago

Without diving into the btcpayserver code but having deployed bitcoind on production before, my guess is that bitcoind and nbxplorer can be used by whatever client. When it comes to btcpayserver itself, I don't know.

NicolasDorier commented 4 years ago

@ramontayag well. Except we introduced the hotwallet feature recently in btcpay.

The hot wallet feature allow an admin to have NBXplorer and optionally Bitcoin Core aware of private keys

rudygodoy commented 4 years ago

@ramontayag I believe for k8s, you can do it in different cluster with no issues. In general k8s handles resources and you tell your app which ones it needs to be at certain state. In any case, I believe an additional layer of k8s config is required either for separate or same cluster deployments.

ramontayag commented 4 years ago

@rudygodoy The issue is that, at least at the time I wrote this, multiple apps need access to the same volume. If the access needs to be read and write, then you'll run into issues because that feature isn't made widely available by the cloud providers you're probably running on (Google Cloud, AWS, DigitalOcean). I understand that AWS supports ReadWriteMany but I haven't tried it in a long time. See EFS on AWS.