Skip to content

Commit

Permalink
feat : add postgres health check and use official apache kafka image
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli authored Feb 28, 2024
1 parent 7863cb6 commit 0d46ab6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
19 changes: 12 additions & 7 deletions docker-compose-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ services:
- POSTGRES_USER=appuser
- POSTGRES_PASSWORD=secret
- POSTGRES_DB=appdb
healthcheck:
test: "pg_isready -U appuser -d appdb"
interval: 2s
timeout: 20s
retries: 10
ports:
- "5432:5432"
networks:
Expand All @@ -24,7 +29,8 @@ services:
ports:
- "5050:80"
depends_on:
- postgresql
postgresql:
condition: service_healthy
restart: unless-stopped
networks:
- microservice-network
Expand Down Expand Up @@ -58,7 +64,7 @@ services:

kafka:
container_name: kafka
image: confluentinc/cp-kafka:7.6.0
image: apache/kafka:3.7.0
hostname: broker
extra_hosts: [ 'host.docker.internal:host-gateway' ]
ports:
Expand Down Expand Up @@ -202,7 +208,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
loki :
condition: service_started
api-gateway:
Expand Down Expand Up @@ -234,7 +240,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://dockerUser:dockerSecret@config-server:8888/
Expand Down Expand Up @@ -262,7 +268,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://dockerUser:dockerSecret@config-server:8888/
Expand Down Expand Up @@ -290,7 +296,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
SPRING_PROFILES_ACTIVE: docker
SPRING_CONFIG_IMPORT: configserver:http://dockerUser:dockerSecret@config-server:8888/
Expand Down Expand Up @@ -395,4 +401,3 @@ volumes:
postgres_data:
driver: local


15 changes: 10 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ services:
- POSTGRES_DB=appdb
ports:
- "5432:5432"
healthcheck:
test: "pg_isready -U appuser -d appdb"
interval: 2s
timeout: 20s
retries: 10
networks:
- microservice-network

Expand Down Expand Up @@ -58,7 +63,7 @@ services:

kafka:
container_name: kafka
image: confluentinc/cp-kafka:7.6.0
image: apache/kafka:3.7.0
hostname: broker
extra_hosts: [ 'host.docker.internal:host-gateway' ]
ports:
Expand Down Expand Up @@ -175,7 +180,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://docker-dev:docker-pass@config-server:8888/
Expand All @@ -199,7 +204,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://docker-dev:docker-pass@config-server:8888/
Expand All @@ -223,7 +228,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://docker-dev:docker-pass@config-server:8888/
Expand All @@ -247,7 +252,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://docker-dev:docker-pass@config-server:8888/
Expand Down
13 changes: 9 additions & 4 deletions payment-service/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ services:
- POSTGRES_DB=appdb
ports:
- "5432:5432"
healthcheck:
test: "pg_isready -U appuser -d appdb"
interval: 2s
timeout: 20s
retries: 10
networks:
- payment-network

Expand All @@ -28,7 +33,7 @@ services:
- payment-network

kafka:
image: confluentinc/cp-kafka:7.6.0
image: apache/kafka:3.7.0
ports:
- "9092:9092"
healthcheck:
Expand Down Expand Up @@ -91,7 +96,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://config-server:8888/
Expand Down Expand Up @@ -133,7 +138,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://config-server:8888/
Expand All @@ -156,7 +161,7 @@ services:
naming-server:
condition: service_started
postgresql:
condition: service_started
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE= docker
- SPRING_CONFIG_IMPORT=configserver:http://config-server:8888/
Expand Down

0 comments on commit 0d46ab6

Please sign in to comment.