-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
134 lines (127 loc) · 4.07 KB
/
docker-compose.yaml
File metadata and controls
134 lines (127 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Docker Compose configuration for rJMX-Exporter
#
# This file provides an example setup for running rJMX-Exporter
# alongside a Java application with Jolokia and Prometheus.
#
# Usage:
# docker compose up -d # Start all services
# docker compose logs -f # View logs
# docker compose down # Stop all services
#
# Endpoints:
# - Java App (Jolokia): http://localhost:8778/jolokia
# - rJMX-Exporter: http://localhost:9090/metrics
# - Prometheus: http://localhost:9091
version: "3.8"
services:
# ==========================================================================
# Java Application with Jolokia Agent
# ==========================================================================
java-app:
build:
context: ./docker/java-app
dockerfile: Dockerfile
container_name: rjmx-java-app
ports:
- "8080:8080" # Application port
- "8778:8778" # Jolokia port
environment:
- JAVA_OPTS=-javaagent:/opt/jolokia/jolokia-jvm.jar=port=8778,host=0.0.0.0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8778/jolokia/version"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- rjmx-network
restart: unless-stopped
# ==========================================================================
# rJMX-Exporter
# ==========================================================================
rjmx-exporter:
build:
context: .
dockerfile: Dockerfile
container_name: rjmx-exporter
ports:
- "9090:9090"
volumes:
- ./config.example.yaml:/config.yaml:ro
environment:
- RUST_LOG=info
depends_on:
java-app:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/health"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
networks:
- rjmx-network
restart: unless-stopped
# Resource limits (optional, uncomment to enable)
# deploy:
# resources:
# limits:
# cpus: '0.5'
# memory: 50M
# reservations:
# memory: 10M
# ==========================================================================
# Prometheus (for testing and monitoring)
# ==========================================================================
prometheus:
image: prom/prometheus:v2.48.0
container_name: rjmx-prometheus
ports:
- "9091:9090"
volumes:
- ./docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--web.enable-lifecycle"
- "--web.console.libraries=/etc/prometheus/console_libraries"
- "--web.console.templates=/etc/prometheus/consoles"
depends_on:
- rjmx-exporter
networks:
- rjmx-network
restart: unless-stopped
# ==========================================================================
# Grafana (optional, for visualization)
# ==========================================================================
grafana:
image: grafana/grafana:10.2.0
container_name: rjmx-grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana-data:/var/lib/grafana
depends_on:
- prometheus
networks:
- rjmx-network
restart: unless-stopped
profiles:
- monitoring # Only start with: docker compose --profile monitoring up
# =============================================================================
# Networks
# =============================================================================
networks:
rjmx-network:
driver: bridge
# =============================================================================
# Volumes
# =============================================================================
volumes:
prometheus-data:
grafana-data: