Skip to content

Commit fcb6bf5

Browse files
committed
Fix prometheus on
1 parent f32c9f7 commit fcb6bf5

6 files changed

Lines changed: 47 additions & 33 deletions

File tree

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
include .env
22

3-
run:
3+
up:
44
docker compose -p base up --build -d
55

6-
stop:
6+
down:
77
docker compose -p base stop
88

9-
check:
9+
status:
1010
docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}"
1111

1212
mongo:
1313
docker exec -it `docker ps -a | grep base-mongo | cut -d ' ' -f 1` mongosh -u ${MONGO_USER} -p ${MONGO_PASS}
1414

15-
log:
16-
docker compose logs
15+
# TODO: logs:
1716

1817
set:
1918
sudo chmod 0755 ~

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ A base of file storages and databases to support ecosystem projects
44
## Run
55
1. Create `.secrets/base.env` from `.env.example`
66

7-
2. Create folders `data/s3`, `data/mongo`, `data/redis`, `data/logs`
7+
2. Create folders `data/s3`, `data/mongo`, `data/prometheus`, `data/loki`, `data/alloy`, `data/grafana`, `data/redis`
88

9-
3. Create empty files `data/logs/mongodb.log`
10-
11-
4. Change configuration for MongoDB:
9+
3. Change configuration for MongoDB:
1210
```
1311
sudo sysctl -w vm.max_map_count=262144
1412
```
1513

16-
5. Run `make run`
14+
4. Run `make run`
1715

18-
6. Set up domains `make set`
16+
5. Set up domains `make set`
1917

20-
7. Set up all subdomains `sudo certbot --nginx`
18+
6. Set up all subdomains `sudo certbot --nginx`
2119

22-
8. Set up S3 buckets on `https://console.chill.services/`
20+
7. Set up S3 buckets on `https://console.chill.services/`
2321

24-
9. Connect to MongoDB on `mongo mongo.chill.services -u <user> -p <pass> --authenticationDatabase admin`
22+
8. Connect to MongoDB on `mongo mongo.chill.services -u <user> -p <pass> --authenticationDatabase admin`

compose.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ services:
2525
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS}
2626
volumes:
2727
- ${DATA_PATH}/mongo:/data/db
28-
- ${DATA_PATH}/logs:/data/logs
29-
- ./configs/mongod.conf:/etc/mongod.conf
28+
- ./infra/mongo/mongod.conf:/etc/mongod.conf
3029
command: --config /etc/mongod.conf
3130

3231
# redis:
@@ -57,9 +56,9 @@ services:
5756
- "--collector.textfile.directory=/textfile"
5857
- "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc|rootfs)($$|/)"
5958

60-
node-exporter-textfile:
59+
node_exporter_textfile:
6160
image: busybox:1.37.0
62-
container_name: base-node-exporter-textfile
61+
container_name: base-node_exporter_textfile
6362
restart: unless-stopped
6463
volumes:
6564
- /proc:/host/proc:ro

infra/nginx/prod.conf

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,10 @@ server {
1919
add_header Access-Control-Allow-Origin "*";
2020
}
2121

22-
location /prometheus/ {
23-
proxy_pass http://0.0.0.0:${PROMETHEUS_PORT}/;
24-
}
25-
location /grafana/ {
26-
proxy_pass http://0.0.0.0:${GRAFANA_PORT}/;
27-
proxy_set_header Host $http_host;
28-
}
29-
location /grafana/api/live {
30-
proxy_http_version 1.1;
31-
proxy_set_header Upgrade $http_upgrade;
32-
proxy_set_header Connection "Upgrade";
33-
proxy_set_header Host $http_host;
34-
proxy_pass http://0.0.0.0:${GRAFANA_PORT}/;
22+
# Health check
23+
location /health {
24+
return 200 'ok';
25+
add_header Content-Type text/plain;
3526
}
3627
}
3728

@@ -49,6 +40,27 @@ server {
4940
proxy_set_header Upgrade $http_upgrade;
5041
proxy_set_header Connection "upgrade";
5142
}
43+
44+
location /prometheus/ {
45+
proxy_pass http://0.0.0.0:${PROMETHEUS_PORT}/;
46+
}
47+
location /grafana/ {
48+
proxy_pass http://0.0.0.0:${GRAFANA_PORT}/;
49+
proxy_set_header Host $http_host;
50+
}
51+
location /grafana/api/live {
52+
proxy_http_version 1.1;
53+
proxy_set_header Upgrade $http_upgrade;
54+
proxy_set_header Connection "Upgrade";
55+
proxy_set_header Host $http_host;
56+
proxy_pass http://0.0.0.0:${GRAFANA_PORT}/;
57+
}
58+
59+
# Health check
60+
location /health {
61+
return 200 'ok';
62+
add_header Content-Type text/plain;
63+
}
5264
}
5365

5466
server {
@@ -65,4 +77,10 @@ server {
6577
proxy_set_header Upgrade $http_upgrade;
6678
proxy_set_header Connection "upgrade";
6779
}
80+
81+
# Health check
82+
location /health {
83+
return 200 'ok';
84+
add_header Content-Type text/plain;
85+
}
6886
}

infra/prometheus/prometheus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ scrape_configs:
1919
static_configs:
2020
- targets: ['redis-exporter:9121']
2121

22-
- job_name: node-exporter
22+
- job_name: node_exporter
2323
static_configs:
24-
- targets: ['node-exporter:9100']
24+
- targets: ['node_exporter:9100']
2525
labels:
2626
env: prod
2727
name: master

0 commit comments

Comments
 (0)