bitcoin-dev-project / warnet

Monitor and analyze the emergent behaviors of Bitcoin networks
https://warnet.dev
MIT License
63 stars 28 forks source link

Add option to run Circuitbreaker for each LND Node #228

Closed carlaKC closed 2 months ago

carlaKC commented 4 months ago

Add the ability to run a custom version of circuitbreaker alongside each LND node in warnet. Circuitbreaker can be run using the following command: circuitbreaker --network=regtest --rpcserver={lnd host:lnd port} --tlscertpath={path to LND cert} --macaroonpath={path to LND admin.macaroon}

For my purposes, I'll need to be able to copy in pre-populated databases into the circuitbreaker containers, so it would be very helpful to be able to provide a path to the database that needs to be mounted. This database needs to be in place before circuitbreaker starts (otherwise it'll create its own, empty database), not sure how that works in a kubernetes world.

The database is located at ~/circuitbreaker/circuitbreaker.db in the using AppDataDir to determine the home directory. This base directory can also be customized with --configdir if required.

willcl-ark commented 4 months ago

Seems pretty handy that this is already dockerised. Should make it nice and simple to run as another container in the same pod as Bitcoin Core and LND.

If I understand k8s correctly, the way we should be looking to approach this is to run an initContainer in each pod. This can contain the various config files/databases, and can mount them to file(s) which are mounted and shared with the main container(s) (Core, LND, Circuitbreaker) before they start up.

willcl-ark commented 3 months ago

Hey @carlaKC can you confirm that this linked circuitbreaker the exact version you want to be running in warnet?

carlaKC commented 3 months ago

Hey @carlaKC can you confirm that this linked circuitbreaker the exact version you want to be running in warnet?

This is the version I'd like to run, but will it be difficult to update? Totally possible that I need to do a bugfix between now and running the simulations as we test things out.

willcl-ark commented 3 months ago

Ah no that will be fine.

I was just more wondering "are they using some custom patched version of this, that we need to build docker images for dynamically, or can I rely on the existing images". It sounds like we should be able to rely on pulling a pre-built image from a registry though.

carlaKC commented 3 months ago

Gotcha, you pull from carlakirkcohen/circuitbreaker:endorsement-experiment. Definitely don't need to worry about building docker images.