Skip to content

Commit 08c040e

Browse files
committed
adding a docker-compose.yml and updating the README to use docker-compose
1 parent 8073f15 commit 08c040e

File tree

2 files changed

+128
-0
lines changed

2 files changed

+128
-0
lines changed

README.adoc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,62 @@ java -jar creekproducer/targecreekproducer-0.0.1-SNAPSHOT.jar
6363
----
6464

6565

66+
== Using Docker and Docker Compose
6667

68+
Build the docker images per Project:
69+
70+
[source,bash]
71+
.creekconsumer
72+
----
73+
cd creekconsumer
74+
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=creek-consumer
75+
----
76+
77+
[source,bash]
78+
.creekproducer
79+
----
80+
cd creekproducer
81+
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=creek-producer
82+
----
83+
84+
85+
.[source,bash]
86+
creektransformer
87+
----
88+
cd creektransformer
89+
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=creek-transformer
90+
----
91+
92+
93+
[source,bash]
94+
.creekmeasurementrepositoryconsumer
95+
----
96+
cd creekmeasurementrepositoryconsumer
97+
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=creek-storage
98+
----
99+
100+
Now, you can use the following `docker-compose.yml` file and execute:
101+
102+
[source,yaml]
103+
----
104+
include::docker-compose.yml[]
105+
----
106+
107+
[source,bash]
108+
----
109+
docker-compose up
110+
----
111+
112+
You can open your browser the http://localhost:15672[RabbitMQ Console^] to see the Exchanges and Queues created.
113+
114+
The port `3306` is exposed, so you can use a SQL Client for a MySQL/MariaDB and see the Table and data that stores the creek results.
115+
116+
117+
=== Cleaning up
118+
119+
In another window and in the same folder where you ran the `docker-compose` command, you can run:
120+
121+
[source,bash]
122+
----
123+
docker-compose down
124+
----

docker-compose.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
services:
3+
rabbitmq:
4+
image: rabbitmq:3.11.10-management-alpine
5+
container_name: creek-rabbitmq
6+
expose:
7+
- '5672'
8+
ports:
9+
- '15672:15672'
10+
11+
mariadb:
12+
image: mariadb
13+
container_name: creek-mariadb
14+
environment:
15+
- MARIADB_ROOT_PASSWORD=creek-pass
16+
- MARIADB_PASSWORD=creek-pass
17+
- MARIADB_MYSQL_LOCALHOST_GRANTS=creek
18+
- MARIADB_USER=creek
19+
- MARIADB_DATABASE=creek-db
20+
expose:
21+
- '3306'
22+
ports:
23+
- '3306:3306'
24+
25+
creek-consumer:
26+
image: creek-consumer
27+
container_name: creek-consumer
28+
environment:
29+
- SPRING_RABBITMQ_HOST=rabbitmq
30+
depends_on:
31+
- rabbitmq
32+
33+
creek-transformer:
34+
image: creek-transformer
35+
container_name: creek-transformer
36+
environment:
37+
- SPRING_RABBITMQ_HOST=rabbitmq
38+
- SPRING_CLOUD_STREAM_BINDINGS_INPUT_DESTINATION=usgs-data
39+
- SPRING_CLOUD_STREAM_BINDINGS_INPUT_GROUP=foo
40+
- SPRING_CLOUD_STREAM_BINDINGS_OUTPUT_DESTINATION=creek-data
41+
- SPRING_CLOUD_STREAM.BINDINGS.OUTPUT_GROUP=foo
42+
depends_on:
43+
- rabbitmq
44+
45+
creek-storage:
46+
image: creek-storage
47+
container_name: creek-storage
48+
environment:
49+
- SPRING_DATASOURCE_URL=jdbc:mariadb://mariadb:3306/creek-db?useSsl=false
50+
- SPRING_DATASOURCE_USERNAME=creek
51+
- SPRING_DATASOURCE_PASSWORD=creek-pass
52+
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.mariadb.jdbc.Driver
53+
- SPRING_RABBITMQ_HOST=rabbitmq
54+
- SPRING_CLOUD_STREAM_BINDINGS_INPUT_DESTINATION=creek-data
55+
- SPRING_CLOUD_STREAM_BINDINGS_INPUT_GROUP=creek-data-group
56+
57+
depends_on:
58+
- rabbitmq
59+
60+
creek-producer:
61+
image: creek-producer
62+
container_name: creek-producer
63+
environment:
64+
- SPRING_RABBITMQ_HOST=rabbitmq
65+
- SPRING_CLOUD_STREAM_BINDINGS_OUTPUT_DESTINATION=usgs-data
66+
- SPRING_CLOUD_STREAM_BINDINGS_OUTPUT_GROUP=foo
67+
depends_on:
68+
- creek-consumer
69+
- creek-transformer
70+
- creek-storage

0 commit comments

Comments
 (0)