Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.sample.holesky
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ MEV_RELAYS=https://0xab78bf8c781c58078c3beb5710c57940874dd96aef2835e7742c866b4c7
#CHARON_LOKI_ADDRESSES=

# Charon Cluster Name. Mandatory to send logs with Promtail.
#CLUSTER_NAME=
#CLUSTER_NAME=""

# Charon Cluster Peer. Mandatory to send logs with Promtail.
#CLUSTER_PEER=
#CLUSTER_PEER=""

# Nickname to identify this charon node on monitoring (max 32 characters).
#CHARON_NICKNAME=
#CHARON_NICKNAME=""

# Docker network of running charon node. See `docker network ls`.
#CHARON_DOCKER_NETWORK=
Expand Down
6 changes: 3 additions & 3 deletions .env.sample.hoodi
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ MEV_RELAYS=https://0x98f0ef62f00780cf8eb06701a7d22725b9437d4768bb19b363e882ae871
#CHARON_LOKI_ADDRESSES=

# Charon Cluster Name. Mandatory to send logs with Promtail.
#CLUSTER_NAME=
#CLUSTER_NAME=""

# Charon Cluster Peer. Mandatory to send logs with Promtail.
#CLUSTER_PEER=
#CLUSTER_PEER=""

# Nickname to identify this charon node on monitoring (max 32 characters).
#CHARON_NICKNAME=
#CHARON_NICKNAME=""

# Docker network of running charon node. See `docker network ls`.
#CHARON_DOCKER_NETWORK=
Expand Down
6 changes: 3 additions & 3 deletions .env.sample.mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ MEV_RELAYS=https://0xa15b52576bcbf1072f4a011c0f99f9fb6c66f3e1ff321f11f461d15e31b
#CHARON_LOKI_ADDRESSES=

# Charon Cluster Name. Mandatory to send logs with Promtail.
#CLUSTER_NAME=
#CLUSTER_NAME=""

# Charon Cluster Peer. Mandatory to send logs with Promtail.
#CLUSTER_PEER=
#CLUSTER_PEER=""

# Nickname to identify this charon node on monitoring (max 32 characters).
#CHARON_NICKNAME=
#CHARON_NICKNAME=""

# Docker network of running charon node. See `docker network ls`.
#CHARON_DOCKER_NETWORK=
Expand Down
87 changes: 87 additions & 0 deletions alloy/config.alloy.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
discovery.docker "docker" {
host = "unix:///var/run/docker.sock"
}

loki.process "docker" {
forward_to = [loki.write.default.receiver]

stage.docker { }
}

discovery.relabel "docker" {
targets = discovery.docker.docker.targets

rule {
source_labels = ["__meta_docker_container_label_promtail_monitored"]
regex = "true"
action = "keep"
}

rule {
source_labels = ["__meta_docker_container_name"]
regex = "/(.*)"
target_label = "container"
}

rule {
source_labels = ["container"]
regex = ".*charon.*"
target_label = "job"
replacement = "charon"
}

rule {
source_labels = ["container"]
regex = ".*nethermind.*"
target_label = "job"
replacement = "nethermind"
}

rule {
source_labels = ["container"]
regex = ".*lodestar.*"
target_label = "job"
replacement = "lodestar"
}

rule {
source_labels = ["container"]
regex = ".*lighthouse.*"
target_label = "job"
replacement = "lighthouse"
}

rule {
source_labels = ["container"]
regex = ".*mev-boost.*"
target_label = "job"
replacement = "mev-boost"
}

rule {
target_label = "cluster_name"
replacement = "$CLUSTER_NAME"
}

rule {
target_label = "cluster_peer"
replacement = "$CLUSTER_PEER"
}
}

loki.source.docker "docker" {
host = "unix:///var/run/docker.sock"
targets = discovery.docker.docker.targets
forward_to = [loki.process.docker.receiver]
relabel_rules = discovery.relabel.docker.rules
}

loki.write "default" {
endpoint {
url = "$CHARON_LOKI_ADDRESSES"
}
external_labels = {
cluster_name = "$CLUSTER_NAME",
cluster_peer = "$CLUSTER_PEER",
}
}
34 changes: 34 additions & 0 deletions alloy/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

if [ -z "${CHARON_LOKI_ADDRESSES:-}" ]; then
echo "Error: \$CHARON_LOKI_ADDRESSES variable is empty" >&2
exit 1
fi

if [ -z "${CLUSTER_NAME:-}" ]; then
echo "Error: \$CLUSTER_NAME variable is empty" >&2
exit 1
fi

if [ -z "${CLUSTER_PEER:-}" ]; then
echo "Error: \$CLUSTER_PEER variable is empty" >&2
exit 1
fi

SRC="/etc/alloy/config.alloy.example"
DST="/etc/alloy/config.alloy"

echo "Rendering template: $SRC -> $DST"

sed -e "s|\$CHARON_LOKI_ADDRESSES|${CHARON_LOKI_ADDRESSES}|g" \
-e "s|\$CLUSTER_NAME|${CLUSTER_NAME}|g" \
-e "s|\$CLUSTER_PEER|${CLUSTER_PEER}|g" \
"$SRC" > "$DST"

echo "Config successfully rendered to $DST"

# Execute the command passed as arguments if any
if [ $# -gt 0 ]; then
echo "Executing: $@"
exec "$@"
fi
11 changes: 5 additions & 6 deletions logging.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
services:

promtail:
image: grafana/promtail:${PROMTAIL_VERSION:-2.8.2}
alloy:
image: grafana/alloy:${ALLOY_VERSION:-v1.11.3}
environment:
CHARON_LOKI_ADDRESSES: ${CHARON_LOKI_ADDRESSES}
CLUSTER_NAME: ${CLUSTER_NAME}
CLUSTER_PEER: ${CLUSTER_PEER}
command: -config.file=/etc/promtail/config.yml
volumes:
- ./promtail:/etc/promtail
- ./alloy:/etc/alloy
- /var/run/docker.sock:/var/run/docker.sock
networks: [dvnode]
entrypoint: /etc/promtail/run.sh
entrypoint: /etc/alloy/run.sh
command: ["/bin/alloy", "run", "/etc/alloy/config.alloy", "--storage.path=/var/lib/alloy/data"]
restart: unless-stopped

networks:
Expand Down
49 changes: 0 additions & 49 deletions promtail/config.yml.example

This file was deleted.

26 changes: 0 additions & 26 deletions promtail/run.sh

This file was deleted.