Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate docker compose #27062

Merged
merged 91 commits into from
Sep 14, 2024
Merged

integrate docker compose #27062

merged 91 commits into from
Sep 14, 2024

Conversation

mshima
Copy link
Member

@mshima mshima commented Aug 24, 2024

Fixes #24469.


Please make sure the below checklist is followed for Pull Requests.

@mraible
Copy link
Contributor

mraible commented Aug 27, 2024

Added bug bounty to the issue this fixes.

@mshima mshima force-pushed the compose branch 2 times, most recently from 8af2f3f to c98676d Compare August 27, 2024 20:29
@mraible
Copy link
Contributor

mraible commented Sep 6, 2024

Is there anything I can do to help move this along?

@mshima mshima force-pushed the compose branch 2 times, most recently from 5b72bd6 to 1b0fa44 Compare September 7, 2024 04:30
@mshima
Copy link
Member Author

mshima commented Sep 7, 2024

@mraible its not clear to me how to test it.
I am thinking in adding tests to daily builds.

see #24469 (comment)

@mshima
Copy link
Member Author

mshima commented Sep 7, 2024

I know PostgreSQL is broken due to missing password.

@mraible
Copy link
Contributor

mraible commented Sep 7, 2024 via email

@mshima
Copy link
Member Author

mshima commented Sep 7, 2024

We test compiled jar for monoliths and docker images for microservices.
The compiled jar and docker image removes docker-compose lib.

I think this behavior is correct because the production jar and docker images are the most important.

To test docker compose integration we should run using ./mvnw.

@mraible
Copy link
Contributor

mraible commented Sep 13, 2024

I tried generating microservices again with the latest code and the gateway seems to hang on startup.

Screenshot 2024-09-13 at 09 43 48

It eventually starts, but there's no logging about downloading containers.

Screenshot 2024-09-13 at 09 45 02

If I try to start the "blog" microservice, it fails with the following error:

 Container blog-neo4j-1  Started
 Container blog-consul-config-loader-1  Started
Error response from daemon: driver failed programming external connectivity on endpoint blog-consul-1 (df4e3264b57f8306e3a92cc7ad5701ceb8ce9bdda8a1fcdb0a80216371b3c2c9): Bind for 127.0.0.1:8300 failed: port is already allocated

        at org.springframework.boot.docker.compose.core.ProcessRunner.run(ProcessRunner.java:96)
        at org.springframework.boot.docker.compose.core.DockerCli.run(DockerCli.java:80)

If I start the "store" microservice, the error is similar:

 Container store-consul-1  Starting
 Container store-consul-config-loader-1  Started
 Container store-mongodb-1  Started
Error response from daemon: driver failed programming external connectivity on endpoint store-keycloak-1 (0a8311dbce4c3f30e4ce5bbcd93400a17ce70c74ec7c6bec77efb2b0385b95e9): Bind for 127.0.0.1:9080 failed: port is already allocated

        at org.springframework.boot.docker.compose.core.ProcessRunner.run(ProcessRunner.java:96)
        at org.springframework.boot.docker.compose.core.DockerCli.run(DockerCli.java:80)

docker ps shows the following:

CONTAINER ID   IMAGE                                  COMMAND                  CREATED         STATUS                   PORTS                                                                                                        NAMES
42f3b4cec5ca   jhipster/consul-config-loader:v0.4.1   "/bin/sh -c /load-co…"   4 minutes ago   Up 4 minutes                                                                                                                          blog-consul-config-loader-1
c0d9b8482ed1   neo4j:5.23.0                           "tini -g -- /startup…"   4 minutes ago   Up 4 minutes (healthy)   127.0.0.1:7474->7474/tcp, 7473/tcp, 127.0.0.1:7687->7687/tcp                                                 blog-neo4j-1
66d3ccc65525   jhipster/consul-config-loader:v0.4.1   "/bin/sh -c /load-co…"   4 minutes ago   Up 4 minutes                                                                                                                          store-consul-config-loader-1
b8e596c9ea9f   mongo:7.0.6                            "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes (healthy)   127.0.0.1:27017->27017/tcp                                                                                   store-mongodb-1
3f252b934acc   quay.io/keycloak/keycloak:25.0.1       "/opt/keycloak/bin/k…"   8 minutes ago   Up 8 minutes (healthy)   8080/tcp, 8443/tcp, 127.0.0.1:9080->9080/tcp, 9000/tcp, 127.0.0.1:9443->9443/tcp                             gateway-keycloak-1
e61812c3c2b3   postgres:16.4                          "docker-entrypoint.s…"   8 minutes ago   Up 8 minutes (healthy)   127.0.0.1:5432->5432/tcp                                                                                     gateway-postgresql-1
cffdb1ad1c97   bitnami/consul:1.19.2                  "/opt/bitnami/script…"   8 minutes ago   Up 8 minutes             127.0.0.1:8300->8300/tcp, 8301/udp, 127.0.0.1:8500->8500/tcp, 127.0.0.1:8600->8600/tcp, 8301/tcp, 8600/udp   gateway-consul-1
c4eb3697180d   jhipster/consul-config-loader:v0.4.1   "/bin/sh -c /load-co…"   8 minutes ago   Up 8 minutes                                                                                                                          gateway-consul-config-loader-1

I suspected this might happen, that's why I QA'd it. I believe we might have to remove some Docker Compose files from microservices because they'll already be started by the gateway.

@mshima
Copy link
Member Author

mshima commented Sep 13, 2024

It eventually starts, but there's no logging about downloading containers.

I’ve reduced the log to warn, it’s too verbose in CI.

DanielFran
DanielFran previously approved these changes Sep 13, 2024
@mshima
Copy link
Member Author

mshima commented Sep 13, 2024

I suspected this might happen, that's why I QA'd it. I believe we might have to remove some Docker Compose files from microservices because they'll already be started by the gateway.

microservices now depends on the database compose file instead of services.

@mraible
Copy link
Contributor

mraible commented Sep 14, 2024

I tested again with microservices and confirmed everything starts and works as expected. Nice work, @mshima!

@mraible mraible merged commit 55d8df8 into jhipster:main Sep 14, 2024
67 checks passed
@mshima mshima deleted the compose branch September 20, 2024 17:10
@mraible mraible added this to the 8.7.1 milestone Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate Spring Boot's Docker Compose support
3 participants