mirror of
https://github.com/vacp2p/status-benchmarks.git
synced 2026-01-08 15:13:59 -05:00
13
docker-utils/README.md
Normal file
13
docker-utils/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Docker-utils
|
||||
|
||||
Containers that will be needed for the experiments.
|
||||
|
||||
## status-init
|
||||
|
||||
This container is in charge of preparing `/static/configs/config.json` file for `status-backend`.
|
||||
It will grab the ENR of the store nodes that will also act as bootstrap, and put it in the json file.
|
||||
|
||||
## status-subscriber
|
||||
|
||||
Simple container that will connect to `status-backend` signal to log information.
|
||||
|
||||
3
docker-utils/status-init/Dockerfile
Normal file
3
docker-utils/status-init/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
COPY init_container.py /init_container.py
|
||||
9
docker-utils/status-init/README.md
Normal file
9
docker-utils/status-init/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# status-init
|
||||
|
||||
This container is in charge of preparing `/static/configs/config.json` file for `status-backend`.
|
||||
It will grab the env variables of BOOT_ENRS and STORE_ENRS (bootstrap and store nodes) and put them it in the configuration.
|
||||
|
||||
## Changelog
|
||||
|
||||
- v1.0.0
|
||||
- Working with status-backend `b22c58bd3bdd4a387dc09dccba1d866d5ae09adf`
|
||||
63
docker-utils/status-init/init_container.py
Normal file
63
docker-utils/status-init/init_container.py
Normal file
@@ -0,0 +1,63 @@
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def update_config():
|
||||
bootstrap_enrs = [
|
||||
os.getenv(env)
|
||||
for env in os.environ
|
||||
if env.startswith("BOOT_ENRS") and os.getenv(env).startswith("enr:")
|
||||
]
|
||||
|
||||
store_enrs = [
|
||||
os.getenv(env)
|
||||
for env in os.environ
|
||||
if env.startswith("STORE_ENRS") and os.getenv(env).startswith("enr:")
|
||||
]
|
||||
|
||||
config_path = os.getenv("CONFIG_PATH", "/static/configs/config.json")
|
||||
|
||||
try:
|
||||
config_dir = Path(config_path).parent
|
||||
config_dir.mkdir(parents=True, exist_ok=True)
|
||||
logger.info(f"Ensured config folder exists at: {config_dir}")
|
||||
|
||||
config = {
|
||||
"dst.dev": {
|
||||
"wakuNodes": bootstrap_enrs,
|
||||
"discV5BootstrapNodes": [],
|
||||
"clusterId": int(os.getenv("CLUSTER_ID", 16)),
|
||||
"storeNodes": []
|
||||
}
|
||||
}
|
||||
|
||||
for counter, enr in enumerate(store_enrs):
|
||||
config["dst.dev"]["storeNodes"].append({
|
||||
"id": f"store-node-{counter}",
|
||||
"enr": enr,
|
||||
"addr": "",
|
||||
"fleet": "dst.dev"
|
||||
})
|
||||
|
||||
with open(config_path, "w") as f:
|
||||
json.dump(config, f, indent=2)
|
||||
logger.info(f"Configuration successfully written to {config_path}")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to update config: {e}", exc_info=True)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main():
|
||||
update_config()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user