counterweight_v2/README.md

96 lines
3 KiB
Markdown
Raw Normal View History

2023-02-18 19:48:04 +01:00
# Counterweight V2
2023-02-19 19:18:19 +01:00
Release: v1
2023-02-18 19:48:04 +01:00
This is the repo where I store everything necessary to spin up my
Bitcoin-related node.
It currently includes:
- Bitcoin core
- electrs
- mempool block explorer
- lnbits
## How to deploy
### Requirements
These instructions assume you are on a debian/ubuntu machine with docker,
docker compose and git installed.
### Cloning
First, clone this repo where you would like to run your node.
### Building electrs
2023-02-18 22:58:26 +01:00
Since there is no good `electrs` docker image out there, we roll our own one
2023-02-18 23:14:48 +01:00
for this project. The file is `electrs-docker/Dockerfile`. To build the image,
run the following command:
2023-02-18 22:58:26 +01:00
```bash
2023-02-18 23:02:14 +01:00
cd electrs-docker
docker build -t my-electrs:latest -f Dockerfile .
2023-02-18 22:58:26 +01:00
```
2023-02-18 19:48:04 +01:00
### Environment and configuration files
Now, you need to build a `.env` file. You can start by making a copy of
`.env-example` and filling it.
Afterwards, create the `data` folder in the root of the cloned repo. Inside,
create the folders `bitcoin`, `electrs`, `mempool` and `lnbits`.
Inside `data/bitcoin`, you will need to place a `bitcoin.conf` file. You can
use the example in `config_templates/bitcoin.conf`. Ensure that your inputs
here are consistent with the ones in the `.env` file.
Inside `data/electrs/config`, you will need to place a `config.toml` file. You
can use the example in `config_templates/config.toml`. For this one, you should
not make any changes if you are following these instructions.
Inside `data/lnbits`, you will need to place a `.env` file. Pay attention: this
file is specific for LNbits and is unrelated to the other `.env` file that sits
2023-02-18 23:14:48 +01:00
on the root of this repo. The best place to get an example
is [the official LNbits repository](https://github.com/lnbits/lnbits).
2023-02-18 22:58:26 +01:00
### Running and Smoke testing
2023-02-18 19:48:04 +01:00
2023-02-18 22:58:26 +01:00
To run, execute a simple `docker compose up -d`.
2023-02-18 19:48:04 +01:00
2023-02-18 22:58:26 +01:00
Once you get everything running, here is how you can check on the health of the
different services:
2023-02-18 19:48:04 +01:00
2023-02-18 22:58:26 +01:00
- All: check if the containers are running.
- Bitcoin: check the logs. You should see Bitcoin updating its tip with as new
blocks are found.
- Electrs: connect from Sparrow or another wallet.
- Mempool: visit the page.
- LNbits: visit the page, perhaps make a small transaction if you want to be
dead sure everything is up and running.
2023-02-18 19:48:04 +01:00
2023-02-19 09:04:00 +01:00
### Monitoring
TODO: explain how to setup automatic monitoring of all the services
2023-02-18 19:48:04 +01:00
## Upgrading versions of the different services
- Bitcoin: upgrade in docker-compose.yaml.
2023-02-18 23:14:48 +01:00
- electrs: specify tag in the `git checkout` command in the custom electrs
dockerfile, build again.
2023-02-18 19:48:04 +01:00
- mempool: upgrade web, api and db in docker-compose.yaml.
- LNbits: upgrade in docker-compose.yaml.
2023-02-19 09:03:11 +01:00
## How to backup data
2023-02-18 19:48:04 +01:00
2023-02-19 09:03:11 +01:00
The relevant assets you should backup are:
- Your `.env` file.
- Your `docker-compose-yaml` (if you changed any of its contents).
- Your data folder.
An `rsync` to another server should do the trick. You probably don't want to
copy the bitcoin blockchain and the electrs indexes due to their massive size.
You can use the `--exclude` option when calling `rsync` to exclude them.
2023-02-18 19:48:04 +01:00