Skip to content

Commit 987402c

Browse files
authored
chore: IRM updates (#17914)
- Migrate to using alloy instead of agent: https://grafana.com/docs/agent/latest/ - Update naming to remove `testnet` and use namespace - more robust scripts - Add action for deploying IRM
2 parents bba66b3 + 1669056 commit 987402c

21 files changed

+422
-241
lines changed

.github/workflows/deploy-fisherman-network.yaml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,6 @@ jobs:
156156
./scripts/install_deps.sh
157157
./scripts/network_deploy.sh ignition-fisherman
158158
159-
- name: Setup IRM
160-
env:
161-
MONITORING_NAMESPACE: ${{ env.NETWORK }}-irm
162-
INFURA_SECRET_NAME: infura-${{ env.L1_NETWORK }}-url
163-
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
164-
run: |
165-
166-
echo "Setting up IRM for namespace: $NAMESPACE, monitoring namespace: $MONITORING_NAMESPACE"
167-
echo "Network: $NETWORK"
168-
169-
echo "INFURA Secret Name: $INFURA_SECRET_NAME"
170-
171-
./spartan/metrics/testnet-monitor/scripts/update-monitoring.sh $NAMESPACE ${{ env.MONITORING_NAMESPACE }} $NETWORK $INFURA_SECRET_NAME
172-
173159
- name: Notify Slack on failure
174160
if: failure()
175161
env:
@@ -187,3 +173,23 @@ jobs:
187173
-H "Content-type: application/json" \
188174
--data "$data"
189175
fi
176+
177+
setup-irm-sepolia:
178+
needs: deploy-fisherman
179+
if: inputs.l1_network == 'sepolia'
180+
uses: ./.github/workflows/deploy-irm.yml
181+
secrets: inherit
182+
with:
183+
network: staging-ignition
184+
namespace: ignition-fisherman-sepolia
185+
l1_network: sepolia
186+
187+
setup-irm-mainnet:
188+
needs: deploy-fisherman
189+
if: inputs.l1_network == 'mainnet'
190+
uses: ./.github/workflows/deploy-irm.yml
191+
secrets: inherit
192+
with:
193+
network: mainnet
194+
namespace: ignition-fisherman-mainnet
195+
l1_network: mainnet

.github/workflows/deploy-irm.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Deploys the IRM to a given network
2+
3+
name: Deploy IRM
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
network:
9+
description: "Network that IRM will be monitoring e.g. testnet, staging-ignition..."
10+
required: true
11+
type: string
12+
default: "testnet"
13+
namespace:
14+
description: "Namespace to use for fetching L1 contract addresses. Network name will be used if not provided."
15+
required: false
16+
type: string
17+
monitoring_namespace:
18+
description: "The IRM Namespace. Will default to {namespace}-irm if not provided."
19+
required: false
20+
type: string
21+
l1_network:
22+
description: "L1 network to deploy IRM to"
23+
required: true
24+
type: string
25+
default: "sepolia"
26+
cluster:
27+
description: "The cluster to deploy to, e.g. aztec-gke-private"
28+
required: true
29+
type: string
30+
default: "aztec-gke-private"
31+
workflow_dispatch:
32+
inputs:
33+
network:
34+
description: "Network that IRM will be monitoring e.g. testnet, staging-ignition..."
35+
required: true
36+
type: string
37+
default: "testnet"
38+
namespace:
39+
description: "Namespace to use for fetching L1 contract addresses. Network name will be used if not provided."
40+
required: false
41+
type: string
42+
monitoring_namespace:
43+
description: "The IRM Namespace. Will default to {namespace}-irm if not provided."
44+
required: false
45+
type: string
46+
l1_network:
47+
description: "L1 network to deploy IRM to"
48+
required: true
49+
type: string
50+
default: "sepolia"
51+
cluster:
52+
description: "The cluster to deploy to, e.g. aztec-gke-private"
53+
required: true
54+
type: string
55+
default: "aztec-gke-private"
56+
57+
jobs:
58+
deploy-irm:
59+
env:
60+
CLUSTER_NAME: ${{ inputs.cluster }}
61+
GKE_CLUSTER_CONTEXT: "gke_testnet-440309_us-west1-a_${{ inputs.cluster }}"
62+
REGION: us-west1-a
63+
INFURA_SECRET_NAME: infura-${{ inputs.l1_network }}-url
64+
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
69+
with:
70+
ref: ${{ steps.checkout-ref.outputs.ref }}
71+
persist-credentials: false
72+
73+
- name: Authenticate to Google Cloud
74+
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f
75+
with:
76+
credentials_json: ${{ secrets.GCP_SA_KEY }}
77+
78+
- name: Set up Cloud SDK
79+
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a
80+
81+
- name: Install GKE Auth Plugin
82+
run: |
83+
gcloud components install gke-gcloud-auth-plugin --quiet
84+
85+
- name: Configure kubectl with GKE cluster
86+
run: |
87+
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --region ${{ env.REGION }}
88+
89+
- name: Validate inputs
90+
run: |
91+
# Validate l1_network
92+
if [[ "${{ inputs.l1_network }}" != "sepolia" && "${{ inputs.l1_network }}" != "mainnet" ]]; then
93+
echo "Error: L1 network must be 'sepolia' or 'mainnet', got '${{ inputs.l1_network }}'"
94+
exit 1
95+
fi
96+
97+
# Validate namespace to monitor
98+
# Determine namespace to monitor (defaults to network when not provided)
99+
NAMESPACE_TO_MONITOR="${{ inputs.namespace }}"
100+
if [[ -z "$NAMESPACE_TO_MONITOR" ]]; then
101+
NAMESPACE_TO_MONITOR="${{ inputs.network }}"
102+
fi
103+
104+
# Determine IRM namespace (defaults to {namespace}-irm when not provided)
105+
EFFECTIVE_MONITORING_NAMESPACE="${{ inputs.monitoring_namespace }}"
106+
if [[ -z "$EFFECTIVE_MONITORING_NAMESPACE" ]]; then
107+
EFFECTIVE_MONITORING_NAMESPACE="${NAMESPACE_TO_MONITOR}-irm"
108+
fi
109+
110+
echo "Namespace to monitor: ${NAMESPACE_TO_MONITOR}"
111+
echo "IRM namespace: ${EFFECTIVE_MONITORING_NAMESPACE}"
112+
113+
# Ensure the namespace to monitor exists in the selected cluster
114+
if ! kubectl get namespace "${NAMESPACE_TO_MONITOR}" >/dev/null 2>&1; then
115+
echo "Error: Namespace '${NAMESPACE_TO_MONITOR}' does not exist in cluster '${CLUSTER_NAME}' (region '${REGION}')"
116+
echo "Available namespaces:"
117+
kubectl get namespaces -o name || true
118+
exit 1
119+
fi
120+
121+
# Export values for use in downstream steps
122+
echo "NAMESPACE=${NAMESPACE_TO_MONITOR}" >> "$GITHUB_ENV"
123+
echo "MONITORING_NAMESPACE=${EFFECTIVE_MONITORING_NAMESPACE}" >> "$GITHUB_ENV"
124+
125+
- name: Deploy IRM
126+
run: |
127+
echo "Deploying IRM to network: ${{ inputs.network }}"
128+
echo "Namespace to monitor: ${NAMESPACE}"
129+
echo "Monitoring namespace: ${MONITORING_NAMESPACE}"
130+
echo "L1 network: ${{ inputs.l1_network }}"
131+
132+
./spartan/metrics/irm-monitor/scripts/update-monitoring.sh $NAMESPACE $MONITORING_NAMESPACE ${{ inputs.network }} $INFURA_SECRET_NAME

.github/workflows/deploy-network.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ on:
66
workflow_call:
77
inputs:
88
network:
9-
description: 'Network to deploy (e.g., staging-public, staging-ignition, testnet, next-net)'
9+
description: "Network to deploy (e.g., staging-public, staging-ignition, testnet, next-net)"
1010
required: true
1111
type: string
1212
semver:
13-
description: 'Semver version (e.g., 2.3.4)'
13+
description: "Semver version (e.g., 2.3.4)"
1414
required: true
1515
type: string
1616
docker_image_tag:
17-
description: 'Full docker image tag (optional, defaults to semver)'
17+
description: "Full docker image tag (optional, defaults to semver)"
1818
required: false
1919
type: string
2020
ref:
21-
description: 'Git ref to checkout'
21+
description: "Git ref to checkout"
2222
required: false
2323
type: string
2424
workflow_dispatch:
2525
inputs:
2626
network:
27-
description: 'Network to deploy (e.g., staging-public, staging-ignition, testnet, next-net)'
27+
description: "Network to deploy (e.g., staging-public, staging-ignition, testnet, next-net)"
2828
required: true
2929
type: choice
3030
options:
31-
- staging-public
32-
- staging-ignition
33-
- testnet
34-
- next-net
35-
- devnet
31+
- staging-public
32+
- staging-ignition
33+
- testnet
34+
- next-net
35+
- devnet
3636
semver:
37-
description: 'Semver version (e.g., 2.3.4)'
37+
description: "Semver version (e.g., 2.3.4)"
3838
required: true
3939
type: string
4040
docker_image_tag:
41-
description: 'Full docker image tag (optional, defaults to semver)'
41+
description: "Full docker image tag (optional, defaults to semver)"
4242
required: false
4343
type: string
4444

@@ -68,7 +68,7 @@ jobs:
6868
ref: ${{ steps.checkout-ref.outputs.ref }}
6969
fetch-depth: 0
7070
persist-credentials: false
71-
submodules: recursive # Initialize git submodules for l1-contracts dependencies
71+
submodules: recursive # Initialize git submodules for l1-contracts dependencies
7272

7373
- name: Validate inputs
7474
run: |
@@ -107,13 +107,13 @@ jobs:
107107
- name: Setup gcloud and install GKE auth plugin
108108
uses: google-github-actions/setup-gcloud@v2
109109
with:
110-
install_components: 'gke-gcloud-auth-plugin'
110+
install_components: "gke-gcloud-auth-plugin"
111111

112112
- name: Setup Terraform
113113
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1
114114
with:
115115
terraform_version: "1.7.5"
116-
terraform_wrapper: false # Disable the wrapper that adds debug output, this messes with reading terraform output
116+
terraform_wrapper: false # Disable the wrapper that adds debug output, this messes with reading terraform output
117117

118118
- name: Install Foundry
119119
uses: foundry-rs/foundry-toolchain@v1
@@ -138,15 +138,6 @@ jobs:
138138
./scripts/install_deps.sh
139139
./scripts/network_deploy.sh "${{ inputs.network }}"
140140
141-
- name: Update testnet monitoring (testnet only)
142-
if: inputs.network == 'testnet' && !contains(inputs.semver, '-')
143-
env:
144-
MONITORING_NAMESPACE: testnet-block-height-monitor
145-
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
146-
run: |
147-
echo "Updating monitoring app for testnet deployment..."
148-
./spartan/metrics/testnet-monitor/scripts/update-monitoring.sh testnet ${{ env.MONITORING_NAMESPACE }}
149-
150141
- name: Notify Slack on failure
151142
if: failure()
152143
env:
@@ -164,3 +155,12 @@ jobs:
164155
-H "Content-type: application/json" \
165156
--data "$data"
166157
fi
158+
159+
update-irm:
160+
needs: deploy-network
161+
if: inputs.network == 'testnet' && !contains(inputs.semver, '-')
162+
uses: ./.github/workflows/deploy-irm.yml
163+
secrets: inherit
164+
with:
165+
network: testnet
166+
l1_network: sepolia

spartan/metrics/testnet-monitor/grafana/dashboards/alpha-testnet-monitor.json renamed to spartan/metrics/irm-monitor/grafana/dashboards/block-height-monitor.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"editable": true,
1919
"fiscalYearStartMonth": 0,
2020
"graphTooltip": 0,
21-
"id": 17,
21+
"id": 0,
2222
"links": [],
2323
"panels": [
2424
{
@@ -102,7 +102,7 @@
102102
"sort": "none"
103103
}
104104
},
105-
"pluginVersion": "12.3.0-18356121373.patch4",
105+
"pluginVersion": "12.3.0-18686767985",
106106
"targets": [
107107
{
108108
"editorMode": "code",
@@ -215,7 +215,7 @@
215215
"sort": "none"
216216
}
217217
},
218-
"pluginVersion": "12.3.0-18356121373.patch4",
218+
"pluginVersion": "12.3.0-18686767985",
219219
"targets": [
220220
{
221221
"editorMode": "code",
@@ -309,7 +309,7 @@
309309
"sort": "none"
310310
}
311311
},
312-
"pluginVersion": "12.3.0-18356121373.patch4",
312+
"pluginVersion": "12.3.0-18686767985",
313313
"targets": [
314314
{
315315
"editorMode": "code",
@@ -331,12 +331,12 @@
331331
"list": []
332332
},
333333
"time": {
334-
"from": "now-3h",
334+
"from": "now-6h",
335335
"to": "now"
336336
},
337337
"timepicker": {},
338338
"timezone": "browser",
339-
"title": "Aztec Testnet Block Height Monitor",
339+
"title": "Aztec Network Block Height Monitor",
340340
"uid": "alpha-testnet-monitor",
341-
"version": 11
341+
"version": 12
342342
}
File renamed without changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: grafana-alloy-config
5+
data:
6+
config.alloy: |
7+
// Scrape metrics from the irm-monitor service
8+
prometheus.scrape "irm_monitor" {
9+
targets = [{
10+
__address__ = "localhost:8080",
11+
}]
12+
forward_to = [prometheus.remote_write.grafana_cloud.receiver]
13+
job_name = "irm-monitor"
14+
metrics_path = "/metrics"
15+
scrape_interval = "30s"
16+
}
17+
18+
// Remote write to Grafana Cloud
19+
prometheus.remote_write "grafana_cloud" {
20+
endpoint {
21+
url = "https://prometheus-prod-55-prod-gb-south-1.grafana.net/api/prom/push"
22+
basic_auth {
23+
username = "2476101"
24+
password_file = "/etc/alloy/secret/grafana-cloud-password"
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)