Skip to content

Commit 121d303

Browse files
m3dwardswillcl-ark
authored andcommitted
grafana running behind caddy
1 parent 48acdde commit 121d303

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

resources/charts/caddy/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ caddyConfig: |
9999
}
100100
101101
handle_path /grafana/* {
102-
reverse_proxy grafana:3000
102+
reverse_proxy loki-grafana:80
103103
}
104104
105105
}

resources/manifests/grafana_values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ grafana.ini:
1616
auth:
1717
disable_login_form: true
1818
disable_signout_menu: true
19+
server:
20+
# this is required to use Grafana behind a reverse proxy (caddy)
21+
root_url: "%(protocol)s://%(domain)s:%(http_port)s/grafana/"
1922
auth.anonymous:
2023
enabled: true
2124
org_name: Main Org.

src/warnet/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def inquirer_create_network(project_path: Path):
184184
custom_network_path,
185185
fork_observer,
186186
fork_observer_query_interval,
187-
fork_observer, # This enables caddy whenever fork-observer is enabled
187+
fork_observer, # This enables caddy whenever fork-observer is enabled
188188
)
189189
return custom_network_path
190190

test/data/logging/network.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ nodes:
1010
metrics: txrate=getchaintxstats(10)["txrate"]
1111
- name: tank-0002
1212
connect:
13-
- tank-0000
13+
- tank-0000
14+
caddy:
15+
enabled: true

test/logging_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import requests
1111
from test_base import TestBase
1212

13+
GRAFANA_URL = "http://localhost:2019/grafana/"
14+
1315

1416
class LoggingTest(TestBase):
1517
def __init__(self):
@@ -60,7 +62,7 @@ def wait_for_endpoint_ready(self):
6062

6163
def check_endpoint():
6264
try:
63-
response = requests.get("http://localhost:3000/login")
65+
response = requests.get(f"{GRAFANA_URL}login")
6466
return response.status_code == 200
6567
except requests.RequestException:
6668
return False
@@ -75,7 +77,7 @@ def make_grafana_api_request(self, ds_uid, start, metric):
7577
"from": f"{start}",
7678
"to": "now",
7779
}
78-
reply = requests.post("http://localhost:3000/api/ds/query", json=data)
80+
reply = requests.post(f"{GRAFANA_URL}api/ds/query", json=data)
7981
if reply.status_code != 200:
8082
self.log.error(f"Grafana API request failed with status code {reply.status_code}")
8183
self.log.error(f"Response content: {reply.text}")
@@ -92,7 +94,7 @@ def test_prometheus_and_grafana(self):
9294
self.warnet(f"run {miner_file} --allnodes --interval=5 --mature")
9395
self.warnet(f"run {tx_flood_file} --interval=1")
9496

95-
prometheus_ds = requests.get("http://localhost:3000/api/datasources/name/Prometheus")
97+
prometheus_ds = requests.get(f"{GRAFANA_URL}api/datasources/name/Prometheus")
9698
assert prometheus_ds.status_code == 200
9799
prometheus_uid = prometheus_ds.json()["uid"]
98100
self.log.info(f"Got Prometheus data source uid from Grafana: {prometheus_uid}")

0 commit comments

Comments
 (0)