forked from Jojoooo1/spring-boot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
121 lines (113 loc) · 3.44 KB
/
docker-compose.yaml
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
version: '3.9'
services:
# After using this maven container you need to re-install maven using "mvn install -DskipTests"
api:
container_name: api
image: maven:3.9.5-eclipse-temurin-21
user: '1000'
command:
[
'mvn',
'clean',
'spring-boot:run',
'-Dspring.profiles.active=dev',
'-Duser.home=/var/maven'
]
network_mode: host
depends_on:
api-database:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
MAVEN_CONFIG: /var/maven/.m2
SPRING_PROFILES_ACTIVE: dev
SPRING_CLOUD_KUBERNETES_ENABLED: "false"
SPRING_DATASOURCE_URL: "jdbc:postgresql://localhost:5432/api?stringtype=unspecified&reWriteBatchedInserts=true"
volumes:
- "$PWD:/usr/src/workdir"
- ~/.m2:/var/maven/.m2
working_dir: /usr/src/workdir
healthcheck:
test:
[
'CMD-SHELL',
'curl --fail --silent localhost:8080/actuator/health | grep UP || exit 1'
]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
api-database:
container_name: api-database
image: bitnami/postgresql:15.5.0-debian-11-r3
network_mode: host
environment:
POSTGRESQL_DATABASE: api
POSTGRESQL_POSTGRES_PASSWORD: password
POSTGRESQL_USERNAME: user
POSTGRESQL_PASSWORD: password
volumes:
# Config is injected to activate logical replication
- ./scripts/configs/postgres/conf:/bitnami/postgresql/conf
- api_database:/bitnami/postgresql
healthcheck:
test: [ 'CMD-SHELL', 'pg_isready -U postgres' ]
interval: 5s
timeout: 5s
retries: 10
rabbitmq:
container_name: api-rabbitmq
image: bitnami/rabbitmq:3.12.8-debian-11-r1
network_mode: host
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 5s
timeout: 5s
retries: 10
environment:
RABBITMQ_LOAD_DEFINITIONS: "true"
# definition is set with -> user: password
RABBITMQ_DEFINITIONS_FILE: /etc/rabbitmq/definitions.json
RABBITMQ_PLUGINS: rabbitmq_shovel rabbitmq_shovel_management rabbitmq_delayed_message_exchange
RABBITMQ_COMMUNITY_PLUGINS: https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v3.12.0/rabbitmq_delayed_message_exchange-3.12.0.ez
volumes:
- ./scripts/configs/rabbitmq-definition.json:/etc/rabbitmq/definitions.json
- api_rabbitmq:/bitnami/rabbitmq/mnesia
keycloak:
container_name: keycloak
image: bitnami/keycloak:22.0.5-debian-11-r0
# network_mode: host
environment:
KEYCLOAK_ADMIN_USER: admin
KEYCLOAK_ADMIN_PASSWORD: password
KEYCLOAK_DATABASE_HOST: keycloak-database
KEYCLOAK_DATABASE_PORT: 5432
KEYCLOAK_DATABASE_NAME: keycloak
KEYCLOAK_DATABASE_USER: user
KEYCLOAK_DATABASE_PASSWORD: password
ports:
- "8000:8080"
keycloak-database:
container_name: keycloak-database
image: bitnami/postgresql:15.5.0-debian-11-r3
environment:
POSTGRESQL_DATABASE: keycloak
POSTGRESQL_USERNAME: user
POSTGRESQL_PASSWORD: password
ports:
- "5434:5432"
healthcheck:
test: [ 'CMD-SHELL', 'pg_isready -U postgres' ]
interval: 5s
timeout: 5s
retries: 10
volumes:
- api_database_kc:/bitnami/postgresql
volumes:
api_database:
name: api_database
api_database_kc:
name: api_database_kc
api_rabbitmq:
name: api_rabbitmq