Skip to content

Commit cc5b420

Browse files
pinheadmzadamjonas
authored andcommitted
docs: more cleanup, details, and remove compose
1 parent 45f128b commit cc5b420

File tree

7 files changed

+56
-60
lines changed

7 files changed

+56
-60
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ Monitor and analyze the emergent behaviors of Bitcoin networks.
2424
- [Monitoring](/docs/logging_monitoring.md)
2525
- [Lightning Network](/docs/lightning.md)
2626
- [Scaling](/docs/scaling.md)
27-
- [Connecting to local nodes](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/
27+
- [Connecting to local nodes](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/)
2828

2929
![warnet-art](https://raw.githubusercontent.com/bitcoin-dev-project/warnet/main/docs/machines.webp)

docs/install.md

+21-17
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
# Install Warnet
22

3-
Warnet requires _either_ Kubernetes or Docker to be installed in order to run the network.
4-
Instructions for both can be found below.
3+
Warnet requires Kubernetes in order to run the network. Kubernetes can be run
4+
remotely or locally (with minikube or Docker Desktop). `kubectl` must be run
5+
locally to administer the network.
56

67
## Dependencies
78

89
### Kubernetes
910

1011
Install [`kubectl`](https://kubernetes.io/docs/setup/) (or equivalent) and
11-
configure your cluster. This can be done locally with `minikube` or using a
12-
managed cluster.
12+
configure your cluster. This can be done locally with `minikube` (or Docker Desktop)
13+
or using a managed cluster.
1314

1415
#### Docker engine with minikube
1516

1617
If using Minikube to run a smaller-sized local cluster, you will require docker engine.
17-
To install docker engine and its `compose` plugin for your system, see: https://docs.docker.com/engine/install/
18+
To install docker engine, see: https://docs.docker.com/engine/install/
1819

1920
e.g. For Ubuntu:
2021

2122
```bash
2223
# First uninstall any old versions
23-
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
24+
for pkg in docker.io docker-doc podman-docker containerd runc; do sudo apt-get remove $pkg; done
2425

2526
# Add Docker's official GPG key:
2627
sudo apt-get update
@@ -36,7 +37,7 @@ echo \
3637
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
3738
sudo apt-get update
3839

39-
# Install the docker packages and docker compose plugin
40+
# Install the docker packages
4041
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
4142
```
4243

@@ -50,28 +51,30 @@ The Docker daemon MUST be running before stating Warnet.
5051
- [Check Docker user/group permissions](https://stackoverflow.com/a/48957722/1653320)
5152
- or [`chmod` the Docker UNIX socket](https://stackoverflow.com/a/51362528/1653320)
5253

53-
##### macOS
54+
## Install Warnet
5455

55-
On macOS, a bridge to the docker subnet is required, such as https://github.com/chipmk/docker-mac-net-connect
56+
### Recommended: use a virtual Python environment such as `venv`
5657

5758
```bash
58-
# Install via Homebrew
59-
brew install chipmk/tap/docker-mac-net-connect
59+
python3 -m venv .venv # Use alternative venv manager if desired
60+
source .venv/bin/activate
61+
```
6062

61-
# Run the service and register it to launch at boot
62-
sudo brew services start chipmk/tap/docker-mac-net-connect
63+
```bash
64+
pip install --upgrade pip
65+
pip install warnet
6366
```
6467

65-
## Download Warnet
68+
## Contributing / Local Warnet Development
69+
70+
### Download the code repository
6671

6772
```bash
6873
git clone https://github.com/bitcoin-dev-project/warnet
6974
cd warnet
7075
```
7176

72-
## Install Warnet
73-
74-
### Optional: use a virtual Python environment such as `venv`
77+
### Recommended: use a virtual Python environment such as `venv`
7578

7679
```bash
7780
python3 -m venv .venv # Use alternative venv manager if desired
@@ -82,3 +85,4 @@ source .venv/bin/activate
8285
pip install --upgrade pip
8386
pip install -e .
8487
```
88+

docs/logging_monitoring.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ Warnet allows different granularity of logging.
66

77
### Warnet network level logging
88

9-
For information like:
9+
Fetch logs from the warnet RPC server `rpc-0`, which is in charge of orchestrating the network.
10+
11+
Examples of information provided:
1012

1113
- how many tanks are running
1214
- what scenarios are running
13-
- RPC requests
15+
- warnet RPC requests
1416

15-
To run these `warcli network logs` or `warcli network logs --follow`.
17+
Commands: `warcli network logs` or `warcli network logs --follow`.
1618

17-
These logs are fetched from the warnet RPC server `rpc-0`, which is in charge of orchestrating the network.
19+
See more details in [warcli](/docs/warcli.md#warcli-network-logs)
1820

1921
### Bitcoin Core logs
2022

@@ -36,7 +38,7 @@ For logs of lightning nodes, kubectl is required.
3638

3739
### Aggregated logs from all nodes
3840

39-
Aggregated logs can be searched using RPC `grep-logs` with regex patterns.
41+
Aggregated logs can be searched using `warcli bitcoin grep-logs` with regex patterns.
4042

4143
Example:
4244

@@ -52,6 +54,8 @@ warnet_test_uhynisdj_tank_000007: 2023-10-11T17:44:52.173199Z [validation] Enque
5254
... (etc)
5355
```
5456

57+
See more details in [warcli](/docs/warcli.md#warcli-bitcoin-grep-logs)
58+
5559
## Monitoring and Metrics
5660

5761
## Install logging infrastructure
@@ -73,7 +77,7 @@ It might take a couple minutes to get the pod running. If you see `error: unable
7377
The Grafana dashboard (and API) will be accessible without requiring authentication
7478
at `http://localhost:3000`.
7579

76-
The below logging scripts need to be installed before starting the network in order to collect the information for monitoring and metrics. `warcli network down && warcli network up` should do the trick.
80+
The `install_logging` script will need to be installed before starting the network in order to collect the information for monitoring and metrics. Restart the network with `warcli network down && warcli network up` if necessary.
7781

7882
### Prometheus
7983

docs/running.md

+11-27
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,32 @@
11
# Running Warnet
22

3-
Warnet runs a server which can be used to manage multiple networks. On docker
4-
this runs locally, but on Kubernetes this runs as a `statefulSet` in the
5-
cluster.
3+
Warnet runs a server which can be used to manage multiple networks. On Kubernetes
4+
this runs as a `statefulSet` in the cluster.
65

7-
If the `$XDG_STATE_HOME` environment variable is set, the server will log to
8-
a file `$XDG_STATE_HOME/warnet/warnet.log`, otherwise it will use `$HOME/.warnet/warnet.log`.
6+
See more details in [warcli](/docs/warcli.md), examples:
97

10-
## Kubernetes
11-
12-
// TODO
13-
14-
### Install logging infrastructure
15-
16-
First make sure you have `helm` installed, then simply run the following script:
17-
18-
```bash
19-
./scripts/install_logging.sh
20-
```
21-
22-
To forward port to view Grafana dashboard:
8+
To start the server run:
239

2410
```bash
25-
./scripts/connect_logging.sh
11+
warcli cluster deploy
2612
```
2713

28-
## Kubernetes (e.g. minikube)
29-
30-
To start the server run:
14+
Start a network from a graph file:
3115

3216
```bash
33-
warcli network start
17+
warcli network start resources/graphs/default.graphml
3418
```
3519

36-
Make sure the tanks are running with:
20+
Make sure all tanks are running with:
3721

3822
```bash
39-
warcli network status
23+
warcli network status
4024
```
4125

42-
Check if the edges of the nodes are connected with:
26+
Check if the edges of the graph (bitcoin p2p connections) are complete:
4327

4428
```bash
45-
warcli network connected
29+
warcli network connected
4630
```
4731

4832
_Optional_ Check out the logs with:

docs/scaling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Running large networks
22

3-
When running a large number of containers on a single host machine (i.e. with the Docker interface), the system may run out of various resources.
3+
When running a large number of containers on a single host machine, the system may run out of various resources.
44
We recommend setting the following values in /etc/sysctl.conf:
55

66
```sh

docs/scenarios.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
Scenarios are written using the Bitcoin Core test framework for functional testing,
44
with some modifications: most notably that `self.nodes[]` represents an array of
5-
dockerized `bitcoind` nodes. Scenario files can be run with a python interpreter
6-
or from `warcli` commands and used to control many nodes in the network simultaneously.
5+
containerized `bitcoind` nodes ("tanks"). Scenario files are run with a python interpreter
6+
inside the server and can control many nodes in the network simultaneously.
77

88
See [`src/warnet/scenarios`](../src/warnet/scenarios) for examples of how these can be written.
99

@@ -13,7 +13,7 @@ To see available scenarios (loaded from the default directory):
1313
warcli scenarios available
1414
```
1515

16-
Once a scenarios is selected it can be run with `warcli scenarios run [--network=warnet] <scenario_name> [scenario_params]`.
16+
Once a scenario is selected it can be run with `warcli scenarios run [--network=warnet] <scenario_name> [scenario_params]`.
1717

1818
The [`miner_std`](../src/warnet/scenarios/miner_std.py) scenario is a good one to start with as it automates block generation:
1919

@@ -22,7 +22,7 @@ The [`miner_std`](../src/warnet/scenarios/miner_std.py) scenario is a good one t
2222
warcli scenarios run miner_std --allnodes --interval=5
2323
```
2424

25-
This will run the run the scenario in the background until it exits or is stopped by the user.
25+
This will run the scenario in a background thread on the server until it exits or is stopped by the user.
2626

2727
Active scenarios can be listed and terminated by PID:
2828

@@ -44,7 +44,11 @@ $ warcli scenarios stop 14683
4444
Stopped scenario with PID 14683.
4545
```
4646

47-
## Add scenarios
47+
## Running a custom scenario
4848

49-
To add your own scenario make a copy of one of the existing python tests in src/scenarios/ and write the desired scenario.
50-
Save this file back into the same `src/warnet/scenarios/` directory and it will be listed and available for running using the aforementioned commands.
49+
You can write your own scenario file locally and upload it to the server with
50+
the [run-file](/docs/warcli.md#warcli-scenarios-run-file) command (example):
51+
52+
```bash
53+
warcli scenarios run-file /home/me/bitcoin_attack.py
54+
```

resources/scripts/connect_logging.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ echo "Grafana pod name: ${POD_NAME}"
88

99
while true; do
1010
echo "Attempting to start Grafana port forwarding"
11-
echo "(Hang tight... it might take a couple of minutes to get the pod running)"
11+
echo "Please wait... it might take a few minutes for all logging pods to start"
1212
kubectl --namespace warnet-logging port-forward "${POD_NAME}" 3000 2>&1
1313
echo "Grafana port forwarding exited with status: $?"
1414
sleep 5

0 commit comments

Comments
 (0)