DaCrow13
commited on
Commit
·
8fb2104
1
Parent(s):
0718c0e
fix(docker): configure Prometheus external URL for HF Spaces
Browse files
docker/scripts/start_space.sh
CHANGED
|
@@ -71,13 +71,21 @@ scrape_configs:
|
|
| 71 |
- targets: ['127.0.0.1:9090']
|
| 72 |
EOF
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
# Start Prometheus
|
| 75 |
-
# --web.external-url needs to match the
|
|
|
|
| 76 |
prometheus \
|
| 77 |
--config.file=/tmp/prometheus.yml \
|
| 78 |
--storage.tsdb.path=/tmp/prometheus_data \
|
| 79 |
--web.listen-address=0.0.0.0:9090 \
|
| 80 |
-
--web.external-url
|
| 81 |
--web.route-prefix=/prometheus/ \
|
| 82 |
>> /tmp/prometheus.log 2>&1 &
|
| 83 |
|
|
|
|
| 71 |
- targets: ['127.0.0.1:9090']
|
| 72 |
EOF
|
| 73 |
|
| 74 |
+
# Determine Prometheus External URL
|
| 75 |
+
if [ -n "$SPACE_ID" ]; then
|
| 76 |
+
PROM_EXTERNAL_URL="https://huggingface.co/spaces/$SPACE_ID/prometheus/"
|
| 77 |
+
else
|
| 78 |
+
PROM_EXTERNAL_URL="/prometheus/"
|
| 79 |
+
fi
|
| 80 |
+
|
| 81 |
# Start Prometheus
|
| 82 |
+
# --web.external-url needs to match the public URL for correct link generation
|
| 83 |
+
# --web.route-prefix needs to match the path Nginx proxies to (/prometheus/)
|
| 84 |
prometheus \
|
| 85 |
--config.file=/tmp/prometheus.yml \
|
| 86 |
--storage.tsdb.path=/tmp/prometheus_data \
|
| 87 |
--web.listen-address=0.0.0.0:9090 \
|
| 88 |
+
--web.external-url=$PROM_EXTERNAL_URL \
|
| 89 |
--web.route-prefix=/prometheus/ \
|
| 90 |
>> /tmp/prometheus.log 2>&1 &
|
| 91 |
|