Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ logs/
############################################
# Environment / Secrets
############################################
.env
.env.dev
.env.*
*.env
*.key
Expand Down
29 changes: 24 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

services:

postgres:
Expand All @@ -15,7 +13,7 @@ services:
volumes:
- vimaltech_pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U contactuser -d contactdb" ]
test: ["CMD-SHELL", "pg_isready -U contactuser -d contactdb"]
interval: 10s
timeout: 5s
retries: 5
Expand All @@ -28,9 +26,30 @@ services:
condition: service_healthy
ports:
- "8080:8080"
env_file:
- .env.prod
environment:
SPRING_PROFILES_ACTIVE: dev
SPRING_PROFILES_ACTIVE: prod
restart: unless-stopped

prometheus:
image: prom/prometheus
container_name: vimaltech-prometheus
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
restart: unless-stopped

grafana:
image: grafana/grafana
container_name: vimaltech-grafana
ports:
- "3000:3000"
volumes:
- grafana_data:/var/lib/grafana
restart: unless-stopped

volumes:
vimaltech_pgdata:
vimaltech_pgdata:
grafana_data:
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
10 changes: 10 additions & 0 deletions prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
global:
scrape_interval: 15s

scrape_configs:
- job_name: 'contact-api'

metrics_path: /actuator/prometheus

static_configs:
- targets: ['contact-api:8080']
16 changes: 15 additions & 1 deletion src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,18 @@ logging:
root: WARN
com.vimaltech.contactapi: INFO
org.springframework: WARN
org.hibernate: WARN
org.hibernate: WARN

management:
endpoints:
web:
exposure:
include: health,info,prometheus

endpoint:
health:
show-details: never

metrics:
tags:
application: contact-api