mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 14:55:50 +00:00
Merge pull request #1 from tautaus/use_docker_compose
Use docker compose
This commit is contained in:
commit
520df2f296
6 changed files with 69 additions and 2 deletions
|
@ -1,6 +1,4 @@
|
|||
# Use an official OpenJDK runtime as a parent image
|
||||
# FROM openjdk:17-jdk-alpine
|
||||
|
||||
FROM openjdk
|
||||
|
||||
# Set the working directory inside the container
|
||||
|
|
9
grafana/provisioning/datasources/datasource.yaml
Normal file
9
grafana/provisioning/datasources/datasource.yaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
editable: true
|
5
pom.xml
5
pom.xml
|
@ -139,6 +139,11 @@
|
|||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Micrometer Prometheus Registry -->
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
8
prometheus.yml
Normal file
8
prometheus.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
global:
|
||||
scrape_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'spring-boot-app'
|
||||
metrics_path: '/actuator/prometheus'
|
||||
static_configs:
|
||||
- targets: ['petclinic:8080']
|
41
spring-petclinic.yml
Normal file
41
spring-petclinic.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
services:
|
||||
petclinic:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8080:8080"
|
||||
networks:
|
||||
- custom-network
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
ports:
|
||||
- "9090:9090"
|
||||
volumes:
|
||||
- prometheus_data:/prometheus
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
networks:
|
||||
- custom-network
|
||||
depends_on:
|
||||
- petclinic
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
networks:
|
||||
- custom-network
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||
depends_on:
|
||||
- prometheus
|
||||
|
||||
volumes:
|
||||
prometheus_data:
|
||||
grafana_data:
|
||||
|
||||
networks:
|
||||
custom-network:
|
|
@ -23,3 +23,9 @@ logging.level.org.springframework=INFO
|
|||
|
||||
# Maximum time static resources should be cached
|
||||
spring.web.resources.cache.cachecontrol.max-age=12h
|
||||
|
||||
# Configure the Prometheus endpoint
|
||||
management.endpoint.prometheus.enabled=true
|
||||
|
||||
# Enable Prometheus metrics export
|
||||
management.metrics.export.prometheus.enabled=true
|
Loading…
Reference in a new issue