Skip to content

Commit b56afcc

Browse files
authored
Migrate OBOL_PROM_REMOTE_WRITE_TOKEN (#2579)
1 parent 19d0a6a commit b56afcc

4 files changed

Lines changed: 29 additions & 8 deletions

File tree

ethd

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,30 @@ __source_build() {
12401240
}
12411241

12421242

1243+
# Remove after Glamsterdam
1244+
__migrate_alloy_obol() {
1245+
local prom_token
1246+
1247+
__get_compose_file
1248+
if [[ "${__source_ver}" -lt 55 && "${COMPOSE_FILE}" =~ lido-obol-alloy.yml ]]; then
1249+
var="OBOL_PROM_REMOTE_WRITE_TOKEN"
1250+
__get_value_from_env "${var}" "${__env_file}" "__value"
1251+
if [[ -z "${__value}" && -f ./prometheus/custom-prom.yml ]] && grep -q 'credentials:' ./prometheus/custom-prom.yml >/dev/null; then
1252+
echo "Migrating Lido Obol Promtail to Lido Obol Alloy"
1253+
prom_token=$(awk -F': *' '/credentials:/ {gsub(/"/,"",$2); print $2; exit}' ./prometheus/custom-prom.yml)
1254+
if [[ -z "${prom_token}" ]]; then
1255+
echo "Could not determine value of OBOL_PROM_REMOTE_WRITE_TOKEN in ./prometheus/custom-prom.yml"
1256+
echo "Please update it yourself with \"nano .env\""
1257+
return
1258+
fi
1259+
var="OBOL_PROM_REMOTE_WRITE_TOKEN"
1260+
OBOL_PROM_REMOTE_WRITE_TOKEN="${prom_token}"
1261+
__update_value_in_env "${var}" "${!var}" "${__env_file}"
1262+
fi
1263+
fi
1264+
}
1265+
1266+
12431267
# When this gets called $var is CORE_FILES or CUSTOM_FILES and $__value is what is set in .env for it
12441268
# This function rebuilds __value, applying any file name changes
12451269
__migrate_compose_files() {
@@ -2268,6 +2292,8 @@ update() {
22682292
if [[ "${__env_migrated}" -eq 1 ]] && ! cmp -s "${__env_file}" "${__env_file}".source; then # Create .bak early
22692293
${__as_owner} cp "${__env_file}".source "${__env_file}".bak
22702294
fi
2295+
# Remove after Glamsterdam
2296+
__migrate_alloy_obol
22712297
__pull_and_build
22722298

22732299
__upgrade_postgres

lido-obol-alloy.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ services:
66
CHARON_LOKI_ADDRESSES: ${OBOL_CHARON_REMOTE_LOKI_ADDRESSES}
77
CLUSTER_NAME: ${OBOL_CLUSTER_NAME}
88
CLUSTER_PEER: ${OBOL_CLUSTER_PEER}
9+
OBOL_PROM_REMOTE_WRITE_TOKEN: ${OBOL_PROM_REMOTE_WRITE_TOKEN}
910
volumes:
1011
- ./alloy-obol:/etc/alloy
1112
- /var/run/docker.sock:/var/run/docker.sock:ro
@@ -25,10 +26,6 @@ services:
2526
- metrics.instance=obol-alloy
2627
- metrics.network=${NETWORK}
2728

28-
charon:
29-
labels:
30-
- obol-alloy-monitored=true
31-
3229
execution:
3330
labels:
3431
- obol-alloy-monitored=true
@@ -41,9 +38,5 @@ services:
4138
labels:
4239
- obol-alloy-monitored=true
4340

44-
mev-boost:
45-
labels:
46-
- obol-alloy-monitored=true
47-
4841
volumes:
4942
alloy-obol-data:

lido-obol.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ services:
3636
- metrics.path=/metrics
3737
- metrics.port=3620
3838
- metrics.instance=charon
39+
- obol-alloy-monitored=true
3940

4041
charon-create-enr:
4142
profiles: ["tools"]

mev-boost.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ services:
4949
- metrics.instance=mev-boost
5050
- metrics.network=${NETWORK}
5151
- logs.collect=true
52+
- obol-alloy-monitored=true

0 commit comments

Comments
 (0)