|
| 1 | +version: '3.7' |
| 2 | + |
| 3 | +services: |
| 4 | + |
| 5 | + # Car Rental services |
| 6 | + |
| 7 | + # Users service |
| 8 | + users-service: |
| 9 | + image: quay.io/quarkus-in-action/users-service:1.0.0 |
| 10 | + container_name: users-service |
| 11 | + network_mode: host |
| 12 | + restart: always |
| 13 | + depends_on: |
| 14 | + keycloak: |
| 15 | + condition: service_healthy |
| 16 | + |
| 17 | + # Reservation service |
| 18 | + reservation-service: |
| 19 | + image: quay.io/quarkus-in-action/reservation-service:1.0.0 |
| 20 | + container_name: reservation-service |
| 21 | + network_mode: host |
| 22 | + restart: always |
| 23 | + depends_on: |
| 24 | + postgres-reservation: |
| 25 | + condition: service_healthy |
| 26 | + keycloak: |
| 27 | + condition: service_healthy |
| 28 | + rabbitmq: |
| 29 | + condition: service_healthy |
| 30 | + |
| 31 | + # Rental service |
| 32 | + rental-service: |
| 33 | + image: quay.io/quarkus-in-action/rental-service:1.0.0 |
| 34 | + container_name: rental-service |
| 35 | + network_mode: host |
| 36 | + restart: always |
| 37 | + depends_on: |
| 38 | + kafka: |
| 39 | + condition: service_healthy |
| 40 | + mongodb-rental: |
| 41 | + condition: service_healthy |
| 42 | + |
| 43 | + # Inventory service |
| 44 | + inventory-service: |
| 45 | + image: quay.io/quarkus-in-action/inventory-service:1.0.0 |
| 46 | + container_name: inventory-service |
| 47 | + network_mode: host |
| 48 | + restart: always |
| 49 | + depends_on: |
| 50 | + mysql: |
| 51 | + condition: service_healthy |
| 52 | + |
| 53 | + # Billing service |
| 54 | + billing-service: |
| 55 | + image: quay.io/quarkus-in-action/billing-service:1.0.0 |
| 56 | + container_name: billing-service |
| 57 | + network_mode: host |
| 58 | + restart: always |
| 59 | + depends_on: |
| 60 | + rabbitmq: |
| 61 | + condition: service_healthy |
| 62 | + kafka: |
| 63 | + condition: service_healthy |
| 64 | + mongodb-billing: |
| 65 | + condition: service_healthy |
| 66 | + |
| 67 | + # Infrastructure |
| 68 | + |
| 69 | + # Keycloak |
| 70 | + postgres-keycloak: |
| 71 | + container_name: postgres-keycloak |
| 72 | + image: docker.io/library/postgres:14 |
| 73 | + environment: |
| 74 | + POSTGRES_DB: keycloak |
| 75 | + POSTGRES_USER: keycloak |
| 76 | + POSTGRES_PASSWORD: keycloak |
| 77 | + networks: |
| 78 | + - keycloak_network |
| 79 | + healthcheck: |
| 80 | + test: [ "CMD-SHELL", "pg_isready -U keycloak -d keycloak" ] |
| 81 | + interval: 5s |
| 82 | + retries: 100 |
| 83 | + |
| 84 | + keycloak: |
| 85 | + container_name: keycloak |
| 86 | + image: quay.io/keycloak/keycloak:25.0.6 |
| 87 | + user: "${UID}" |
| 88 | + volumes: |
| 89 | + - "./configs/car-rental-realm.json:/opt/keycloak/data/import/car-rental-realm.json:Z" |
| 90 | + command: |
| 91 | + - start-dev |
| 92 | + - --import-realm |
| 93 | + environment: |
| 94 | + KEYCLOAK_ADMIN: admin |
| 95 | + KEYCLOAK_ADMIN_PASSWORD: admin |
| 96 | + KC_DB: postgres |
| 97 | + KC_DB_URL: jdbc:postgresql://postgres-keycloak/keycloak |
| 98 | + KC_DB_USERNAME: keycloak |
| 99 | + KC_DB_PASSWORD: keycloak |
| 100 | + KC_HEALTH_ENABLED: "true" |
| 101 | + ports: |
| 102 | + - 7777:8080 |
| 103 | + restart: always |
| 104 | + depends_on: |
| 105 | + postgres-keycloak: |
| 106 | + condition: service_healthy |
| 107 | + networks: |
| 108 | + - keycloak_network |
| 109 | + healthcheck: |
| 110 | + test: [ "CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/9000;echo -e 'GET /health/ready HTTP/1.1\r\nhost: http://localhost\r\nConnection: close\r\n\r\n' >&3;if [ $? -eq 0 ]; then echo 'Healthcheck Successful';exit 0;else echo 'Healthcheck Failed';exit 1;fi;" ] |
| 111 | + interval: 5s |
| 112 | + timeout: 10s |
| 113 | + retries: 100 |
| 114 | + |
| 115 | + # Postgres for Reservation service |
| 116 | + postgres-reservation: |
| 117 | + image: docker.io/library/postgres:14 |
| 118 | + container_name: postgres-reservation |
| 119 | + environment: |
| 120 | + POSTGRES_DB: reservation |
| 121 | + POSTGRES_USER: user |
| 122 | + POSTGRES_PASSWORD: pass |
| 123 | + ports: |
| 124 | + - "5432:5432" |
| 125 | + healthcheck: |
| 126 | + test: [ "CMD-SHELL", "pg_isready -U user -d reservation" ] |
| 127 | + interval: 5s |
| 128 | + retries: 100 |
| 129 | + |
| 130 | + # RabbitMQ |
| 131 | + rabbitmq: |
| 132 | + image: docker.io/library/rabbitmq:3.12-management |
| 133 | + container_name: rabbitmq |
| 134 | + ports: |
| 135 | + - "5672:5672" |
| 136 | + - "15672:15672" |
| 137 | + healthcheck: |
| 138 | + test: rabbitmq-diagnostics -q ping |
| 139 | + interval: 30s |
| 140 | + timeout: 30s |
| 141 | + retries: 100 |
| 142 | + |
| 143 | + # MongoDB for Rental service |
| 144 | + mongodb-rental: |
| 145 | + image: docker.io/library/mongo:7.0 |
| 146 | + container_name: mongodb-rental |
| 147 | + ports: |
| 148 | + - "27017:27017" |
| 149 | + healthcheck: |
| 150 | + test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet |
| 151 | + interval: 5s |
| 152 | + timeout: 10s |
| 153 | + retries: 100 |
| 154 | + |
| 155 | + # MongoDB for Billing service |
| 156 | + mongodb-billing: |
| 157 | + image: docker.io/library/mongo:7.0 |
| 158 | + container_name: mongodb-billing |
| 159 | + ports: |
| 160 | + - "27018:27017" |
| 161 | + healthcheck: |
| 162 | + test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet |
| 163 | + interval: 5s |
| 164 | + timeout: 10s |
| 165 | + retries: 100 |
| 166 | + |
| 167 | + # Kafka |
| 168 | + zookeeper: |
| 169 | + image: quay.io/strimzi/kafka:latest-kafka-3.8.0 |
| 170 | + container_name: zookeeper |
| 171 | + command: [ |
| 172 | + "sh", "-c", |
| 173 | + "bin/zookeeper-server-start.sh config/zookeeper.properties" |
| 174 | + ] |
| 175 | + ports: |
| 176 | + - "2181:2181" |
| 177 | + environment: |
| 178 | + LOG_DIR: /tmp/logs |
| 179 | + |
| 180 | + kafka: |
| 181 | + image: quay.io/strimzi/kafka:latest-kafka-3.8.0 |
| 182 | + container_name: kafka |
| 183 | + command: [ |
| 184 | + "sh", "-c", |
| 185 | + "bin/kafka-server-start.sh config/server.properties \ |
| 186 | + --override listeners=$${KAFKA_LISTENERS} \ |
| 187 | + --override advertised.listeners=$${KAFKA_ADVERTISED_LISTENERS} \ |
| 188 | + --override zookeeper.connect=$${KAFKA_ZOOKEEPER_CONNECT}" |
| 189 | + ] |
| 190 | + depends_on: |
| 191 | + - zookeeper |
| 192 | + ports: |
| 193 | + - "9092:9092" |
| 194 | + environment: |
| 195 | + LOG_DIR: "/tmp/logs" |
| 196 | + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 |
| 197 | + KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 |
| 198 | + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 |
| 199 | + healthcheck: |
| 200 | + test: /opt/kafka/bin/kafka-cluster.sh cluster-id --bootstrap-server 0.0.0.0:9092 || exit 1 |
| 201 | + interval: 5s |
| 202 | + retries: 100 |
| 203 | + |
| 204 | + # MySQL |
| 205 | + mysql: |
| 206 | + image: docker.io/library/mysql:8.4 |
| 207 | + container_name: mysql |
| 208 | + environment: |
| 209 | + MYSQL_DATABASE: inventory |
| 210 | + MYSQL_USER: user |
| 211 | + MYSQL_PASSWORD: pass |
| 212 | + MYSQL_ROOT_PASSWORD: admin |
| 213 | + ports: |
| 214 | + - "3306:3306" |
| 215 | + healthcheck: |
| 216 | + test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] |
| 217 | + timeout: 20s |
| 218 | + retries: 10 |
| 219 | + |
| 220 | + prometheus: |
| 221 | + image: docker.io/prom/prometheus:v2.54.1 |
| 222 | + container_name: prometheus |
| 223 | + network_mode: host |
| 224 | + volumes: |
| 225 | + - ./configs/prometheus.yml:/etc/prometheus/prometheus.yml:Z |
| 226 | + command: |
| 227 | + - '--config.file=/etc/prometheus/prometheus.yml' |
| 228 | + |
| 229 | + grafana: |
| 230 | + image: docker.io/grafana/grafana:11.2.2 |
| 231 | + container_name: grafana |
| 232 | + network_mode: host |
| 233 | + volumes: |
| 234 | + - ./configs/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml:Z |
| 235 | + - ./configs/inventory-service-dashboard.json:/etc/grafana/provisioning/dashboards/inventory-service-dashboard.json:Z |
| 236 | + - ./configs/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml:Z |
| 237 | + environment: |
| 238 | + - GF_SECURITY_ADMIN_USER=admin |
| 239 | + - GF_SECURITY_ADMIN_PASSWORD=admin |
| 240 | + |
| 241 | + jaeger-all-in-one: |
| 242 | + image: docker.io/jaegertracing/all-in-one:1.62.0 |
| 243 | + container_name: jaeger |
| 244 | + ports: |
| 245 | + - "16686:16686" # Jaeger UI |
| 246 | + - "4317:4317" # OTLP receiver |
| 247 | + |
| 248 | +networks: |
| 249 | + keycloak_network: |
| 250 | + driver: bridge |
0 commit comments