File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ Sample Spring Boot project
55 - with Hibernate Envers/JPA Auditing - [ Git Tag V4.0] ( https://github.com/chatterjeesunit/spring-boot-app/tree/v4.0 )
66 - with Authentication using JWT - [ Git Tag V5.0] ( https://github.com/chatterjeesunit/spring-boot-app/tree/v5.0 )
77 - with Caffeine Caching - [ Git Tag V6.0] ( https://github.com/chatterjeesunit/spring-boot-app/tree/v6.0 )
8+ - with Docker Compose - [ Git Tag V7.0] ( https://github.com/chatterjeesunit/spring-boot-app/tree/v7.0 )
89
910For more detailed step by step guide on how to do this, please refer to the blogs on - http://sunitc.dev/tag/spring-boot/
Original file line number Diff line number Diff line change 1+ version : ' 3.8'
2+
3+ networks :
4+ internal-nw :
5+ internal : true
6+ outside-nw :
7+
8+ services :
9+ database :
10+ image : ' mysql:8.0.21'
11+ environment :
12+ MYSQL_ROOT_PASSWORD : r00t
13+ MYSQL_ROOT_HOST : ' %'
14+ MYSQL_DATABASE : testdb
15+ MYSQL_USER : testdbuser
16+ MYSQL_PASSWORD : dummyPass!
17+ ports :
18+ - ' 3306:3306'
19+ volumes :
20+ - ~/data/mysql8:/var/lib/mysql
21+ networks :
22+ - outside-nw
23+ - internal-nw
24+ # healthcheck:
25+ # test: mysql --user $$MYSQL_USER --password=$$MYSQL_PASSWORD --database $$MYSQL_DATABASE --execute "select 1;"
26+ # interval: 30s
27+ # timeout: 10s
28+ # retries: 3
29+ # start_period: 15s
30+
31+ application :
32+ build :
33+ context : .
34+ dockerfile : ./docker/Dockerfile.app-exploded
35+ ports :
36+ - 8080
37+ environment :
38+ SPRING_DATASOURCE_URL : ' jdbc:mysql://database:3306/testdb'
39+ SPRING_DATASOURCE_USERNAME : testdbuser
40+ SPRING_DATASOURCE_PASSWORD : dummyPass!
41+ SPRING_FLYWAY_URL : ' jdbc:mysql://database:3306/testdb'
42+ SPRING_FLYWAY_USER : testdbuser
43+ SPRING_FLYWAY_PASSWORD : dummyPass!
44+ networks :
45+ - internal-nw
46+ depends_on :
47+ - database
48+ restart : unless-stopped
49+ labels :
50+ - traefik.enable=true
51+ - traefik.http.routers.application.rule=Host(`dev-sandbox`)
52+ - traefik.http.services.application.loadbalancer.server.port=8080
53+
54+
55+ load-balancer :
56+ image : ' traefik:v2.3'
57+ command : >
58+ --providers.docker=true
59+ --providers.docker.exposedbydefault=false
60+ --entryPoints.http.address=":80"
61+ --accesslog
62+ --log.level=INFO
63+ --api=true
64+ --api.insecure=true
65+ --api.dashboard=true
66+ ports :
67+ - " 80:80" # load balancer port
68+ - " 8080:8080" # management UI
69+ volumes :
70+ # traefik does its magic by reading information about running containers from the docker socket
71+ - " /var/run/docker.sock:/var/run/docker.sock:ro"
72+ networks :
73+ - internal-nw
74+ - outside-nw
75+ depends_on :
76+ - application
77+ labels :
78+ - traefik.enable=true
79+ - traefik.http.routers.traefik_http.rule=Host(`dev-sandbox`)
80+ - traefik.http.routers.traefik_http.service=api@internal
81+ - traefik.http.routers.traefik_http.entrypoints=http
You can’t perform that action at this time.
0 commit comments