diff --git a/MANIFEST.in b/MANIFEST.in
index 508588d66..59767adcb 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,7 @@
include src/schema/*.json
include src/templates/bitcoin.conf
include src/templates/fork_observer_config.toml
+include src/templates/addrman_observer_config.toml
include src/templates/addrman.patch
include src/templates/isroutable.patch
graft src/templates/k8s
diff --git a/src/templates/addrman_observer_config.toml b/src/templates/addrman_observer_config.toml
new file mode 100644
index 000000000..4bfcdb79b
--- /dev/null
+++ b/src/templates/addrman_observer_config.toml
@@ -0,0 +1,8 @@
+# addrman-observer base configuration file
+
+# path to the location of the static www files
+www_path = "./www"
+
+# webserver listen address
+address = "0.0.0.0:3882"
+
diff --git a/src/warnet/services.py b/src/warnet/services.py
index 95009a6f9..24327e812 100644
--- a/src/warnet/services.py
+++ b/src/warnet/services.py
@@ -1,4 +1,5 @@
FO_CONF_NAME = "fork_observer_config.toml"
+AO_CONF_NAME = "addrman_observer_config.toml"
GRAFANA_PROVISIONING = "grafana-provisioning"
PROM_CONF_NAME = "prometheus.yml"
@@ -33,6 +34,14 @@
"container_port": "2323",
"config_files": [f"{FO_CONF_NAME}:/app/config.toml"],
},
+ "addrmanobserver": {
+ "backends": ["compose"],
+ "image": "b10c/addrman-observer:latest",
+ "container_name_suffix": "addrman-observer",
+ "warnet_port": "23005",
+ "container_port": "3882",
+ "config_files": [f"{AO_CONF_NAME}:/app/config.toml"],
+ },
"grafana": {
"backends": ["compose"],
"image": "grafana/grafana:latest",
diff --git a/src/warnet/warnet.py b/src/warnet/warnet.py
index e2cce88fd..a1ea78386 100644
--- a/src/warnet/warnet.py
+++ b/src/warnet/warnet.py
@@ -12,7 +12,7 @@
import yaml
from backends import ComposeBackend, KubernetesBackend
from templates import TEMPLATES
-from warnet.services import FO_CONF_NAME, GRAFANA_PROVISIONING, PROM_CONF_NAME
+from warnet.services import AO_CONF_NAME, FO_CONF_NAME, GRAFANA_PROVISIONING, PROM_CONF_NAME
from warnet.tank import Tank
from warnet.utils import gen_config_dir, load_schema, validate_graph_schema
@@ -181,8 +181,10 @@ def generate_deployment(self):
self.container_interface.generate_deployment_file(self)
if "forkobserver" in self.services:
self.write_fork_observer_config()
+ if "addrmanobserver" in self.services:
+ self.write_addrman_observer_config()
if "grafana" in self.services:
- self.write_grafna_config()
+ self.write_grafana_config()
if "prometheus" in self.services:
self.write_prometheus_config()
@@ -205,8 +207,27 @@ def write_fork_observer_config(self):
"""
)
logger.info(f"Wrote file: {dst}")
+
+ def write_addrman_observer_config(self):
+ src = TEMPLATES / AO_CONF_NAME
+ dst = self.config_dir / AO_CONF_NAME
+ shutil.copy(src, dst)
+ with open(dst, "a") as f:
+ for tank in self.tanks:
+ f.write(
+ f"""
+ [[nodes]]
+ id = {tank.index}
+ name = "node-{tank.index}"
+ rpc_host = "{tank.ipv4}"
+ rpc_port = {tank.rpc_port}
+ rpc_user = "{tank.rpc_user}"
+ rpc_password = "{tank.rpc_password}"
+ """
+ )
+ logger.info(f"Wrote file: {dst}")
- def write_grafna_config(self):
+ def write_grafana_config(self):
src = TEMPLATES / GRAFANA_PROVISIONING
dst = self.config_dir / GRAFANA_PROVISIONING
shutil.copytree(src, dst, dirs_exist_ok=True)
diff --git a/test/data/services.graphml b/test/data/services.graphml
index 41d53bd80..b92125bbc 100644
--- a/test/data/services.graphml
+++ b/test/data/services.graphml
@@ -15,7 +15,7 @@
- cadvisor forkobserver grafana nodeexporter prometheus
+ cadvisor forkobserver addrmanobserver grafana nodeexporter prometheus
26.0
-uacomment=w0 -debug=validation
@@ -23,4 +23,4 @@
lnd
-
\ No newline at end of file
+
diff --git a/test/graph_test.py b/test/graph_test.py
index 1aee675d9..84e0a8286 100755
--- a/test/graph_test.py
+++ b/test/graph_test.py
@@ -70,6 +70,15 @@
else:
raise Exception("forkobserver not OK")
+ node_id = 0
+ ao_res = requests.get(f"http://localhost:23005/{node_id}")
+ assert ao_res.status_code == 200
+ addrman = ao_res.json()
+ if "new" in addrman and "tried" in addrman:
+ print("addrmanobserver OK")
+ else:
+ raise Exception("addrmanobserver not OK")
+
grafana_res = requests.get("http://localhost:23002/api/datasources/uid/prometheusdatasource/health")
assert grafana_res.status_code == 200
health = grafana_res.json()