Skip to content

Commit 3ea416e

Browse files
committed
feat: add more images
1 parent 34d9730 commit 3ea416e

File tree

9 files changed

+149
-0
lines changed

9 files changed

+149
-0
lines changed

.github/workflows/build-images.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,31 @@ jobs:
6565
dockerfile: ./compose/production/python-3-12-slim-bookworm/Dockerfile
6666
architectures: linux/amd64,linux/arm64
6767
path: ./compose/production/python-3-12-slim-bookworm/
68+
- project: prometheus
69+
context: .
70+
dockerfile: ./compose/production/prometheus/Dockerfile
71+
architectures: linux/amd64,linux/arm64
72+
path: ./compose/production/prometheus/
73+
- project: node_exporter
74+
context: .
75+
dockerfile: ./compose/production/node_exporter/Dockerfile
76+
architectures: linux/amd64,linux/arm64
77+
path: ./compose/production/node_exporter/
78+
- project: grafana
79+
context: .
80+
dockerfile: ./compose/production/grafana/Dockerfile
81+
architectures: linux/amd64,linux/arm64
82+
path: ./compose/production/grafana/
83+
- project: loki
84+
context: .
85+
dockerfile: ./compose/production/loki/Dockerfile
86+
architectures: linux/amd64,linux/arm64
87+
path: ./compose/production/loki/
88+
- project: promtail
89+
context: .
90+
dockerfile: ./compose/production/promtail/Dockerfile
91+
architectures: linux/amd64,linux/arm64
92+
path: ./compose/production/promtail/
6893

6994
steps:
7095
- name: Checkout code

compose/production/grafana/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM grafana/grafana:latest
2+
3+
# 设置时区
4+
ENV TZ=Asia/Shanghai
5+
6+
# 设置默认管理员账号密码
7+
ENV GF_SECURITY_ADMIN_USER=admin \
8+
GF_SECURITY_ADMIN_PASSWORD=123456
9+
10+
# 健康检查
11+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
12+
CMD wget --quiet --tries=1 --spider http://localhost:3000/api/health || exit 1

compose/production/loki/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM grafana/loki:2.9.0
2+
3+
COPY ./compose/production/loki/loki-config.yml /etc/loki/
4+
5+
USER root
6+
7+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
8+
CMD wget --quiet --tries=1 --spider http://localhost:3100/ready || exit 1
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
auth_enabled: false
2+
3+
server:
4+
http_listen_port: 3100
5+
6+
ingester:
7+
lifecycler:
8+
address: 127.0.0.1
9+
ring:
10+
kvstore:
11+
store: inmemory
12+
replication_factor: 1
13+
final_sleep: 0s
14+
chunk_idle_period: 5m
15+
chunk_retain_period: 30s
16+
17+
schema_config:
18+
configs:
19+
- from: 2020-05-15
20+
store: boltdb-shipper
21+
object_store: filesystem
22+
schema: v11
23+
index:
24+
prefix: index_
25+
period: 24h
26+
27+
storage_config:
28+
boltdb_shipper:
29+
active_index_directory: /tmp/loki/boltdb-shipper-active
30+
cache_location: /tmp/loki/boltdb-shipper-cache
31+
cache_ttl: 24h
32+
shared_store: filesystem
33+
filesystem:
34+
directory: /tmp/loki/chunks
35+
36+
limits_config:
37+
retention_period: 744h
38+
max_query_length: 744h
39+
40+
ruler:
41+
storage:
42+
type: local
43+
local:
44+
directory: /tmp/loki/rules
45+
rule_path: /tmp/loki/rules-temp
46+
alertmanager_url: http://localhost:9093
47+
ring:
48+
kvstore:
49+
store: inmemory
50+
51+
compactor:
52+
working_directory: /tmp/loki/boltdb-shipper-compactor
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM prom/node-exporter:latest
2+
3+
# 设置默认参数
4+
ENV PATH_SYSFS=/host/sys \
5+
PATH_PROCFS=/host/proc \
6+
PATH_ROOTFS=/rootfs
7+
8+
# 健康检查
9+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
10+
CMD wget --quiet --tries=1 --spider http://localhost:9100/metrics || exit 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM prom/prometheus:latest
2+
3+
COPY ./compose/production/prometheus/prometheus.yml /etc/prometheus/
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
global:
2+
scrape_interval: 15s # 全局抓取间隔
3+
4+
scrape_configs:
5+
- job_name: 'prometheus'
6+
static_configs:
7+
- targets: ['prometheus:9090']
8+
9+
- job_name: 'django'
10+
static_configs:
11+
- targets: ['django:8000']
12+
13+
- job_name: 'node_exporter'
14+
static_configs:
15+
- targets: ['node_exporter:9100']
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM grafana/promtail:latest
2+
3+
COPY ./compose/production/promtail/promtail-config.yml /etc/promtail/
4+
5+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
6+
CMD wget --quiet --tries=1 --spider http://localhost:9080/ready || exit 1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
server:
2+
http_listen_port: 9080
3+
grpc_listen_port: 0
4+
5+
positions:
6+
filename: /tmp/positions.yaml
7+
8+
clients:
9+
- url: http://loki:3100/loki/api/v1/push
10+
11+
scrape_configs:
12+
- job_name: system
13+
static_configs:
14+
- targets:
15+
- localhost
16+
labels:
17+
job: varlogs
18+
__path__: /app/logs/*.log

0 commit comments

Comments
 (0)