microservices-patterns / ftgo-application

Example code for the book Microservice patterns
Other
3.35k stars 1.29k forks source link

docker-compose script error run on windows #99

Open LlorandoLau opened 4 years ago

LlorandoLau commented 4 years ago

First of all, Thanks for your excellent book.

I got a problem when run 'docker-compose up -d' on windows, it shows:

PS E:\github\ftgo-application> docker-compose up -d
Building ftgo-consumer-service
Step 1/5 : FROM openjdk:8u171-jre-alpine
 ---> 0fe3f0d1ee48
Step 2/5 : RUN apk --no-cache add curl
 ---> Using cache
 ---> 2db9847b244b
Step 3/5 : CMD java ${JAVA_OPTS} -jar ftgo-consumer-service.jar
 ---> Using cache
 ---> b2c326f8460a
Step 4/5 : HEALTHCHECK --start-period=30s --interval=5s CMD curl -f http://localhost:8080/actuator/health || exit 1
 ---> Using cache
 ---> d14592e19d29
Step 5/5 : COPY build/libs/ftgo-consumer-service.jar .
ERROR: Service 'ftgo-consumer-service' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder709502353/build/libs/ftgo-consumer-service.jar: no such file or directory

It seems that script has used linux path on windows. And I have not modified any configuration files.

Wait for your advice.

Thanks, Llorando Lau

cer commented 4 years ago

Did you run gradlew assemble first? Perhaps the jar does not exist.

LlorandoLau commented 4 years ago

No. I just run gradlew.bat. I would have a try now.

cer commented 4 years ago

Please delete the inline log comments and repost as links to gists - makes the issue easier to read.

cer commented 4 years ago

Which version of Docker are you using? docker for Windows or Docker toolbox (need to set DOCKER_HOST_IP for toolbox)

LlorandoLau commented 4 years ago

The application has been started, but unhealthy. docker ps -a https://gist.github.com/LlorandoLau/d905ba6d232e69073e61fc7e1d9f1d1b

I have copied one of services' log below. It seems there are some problem in kafka. Is it a problem caused by ram limit? Docker machine configuration in my laptop is 4GB and 2CPU. https://gist.github.com/LlorandoLau/f8ef64846aef81bde0d84acbad5a3125

And the log in kafka is below. There are no logs around 04:29, when ftgo-restaurant-service throwed exception. https://gist.github.com/LlorandoLau/3af6bb7055ee6827a3a455b7aecb8853

The version of my docker desktop is 2.2.0.5(43884). It runs on win10.

cer commented 4 years ago

Strange. Which version of ftgo-application? Up to date master branch?

cer commented 4 years ago

Also, can you do docker inspect on the container whose log you sent and attach that as a gist.

cer commented 4 years ago

Also, I what's the health of the CDC service: curl http://localhost:8099/actuator/health?

LlorandoLau commented 4 years ago

Yes, it's up to date now.

Beneath is the output of docker inspect ftgo-application_ftgo-restaurant-service_1. There is an error while connecting to 8080: curl: (7) Failed to connect to localhost port 8080: Connection refused https://gist.github.com/LlorandoLau/74cddfa6b3ae71e2653f43725d7ed84e

The output of curl http://localhost:8099/actuator/health is: https://gist.github.com/LlorandoLau/d6c142b7958d48ce9116b61d68841283

cer commented 4 years ago

"Yes, it's up to date now." implies that it wasn't before. Also, the CDC service looks like it healthy, which means it can connect to Kafka. Run these commands: First,

./gradlew :composeDown

to clean up.

then,

./gradlew assemble :composeUp
LlorandoLau commented 4 years ago

Emmm. I used a wrong expression. Since the day before yesterday, when I failed to start it in my laptop, I have removed the whole dir of ftgo-application in my laptop and re-cloned them from github. Last night I checked the version and found it up to date already.

The output of ./gradlew :composeDown and ./gradlew assemble :composeUp is below. However, it keeps printing Waiting for cdc-service_1 to become healthy (it's unhealthy). It seems like endless. https://gist.github.com/LlorandoLau/e972534c4ac487190e850d8a991a1310

LlorandoLau commented 4 years ago

Great. It is started heathly after many unhealthy printing. And I could visit swagger-ui now. Thanks for your help.

LlorandoLau commented 4 years ago

What's more, could you give me some advice on how to Run and Debug with IDE intellij idea? I have read the issue #11 . But the url you gived is gone. I can't visit it now.

cer commented 4 years ago

So what changed that enabled it to work? Or was it just waiting? Perhaps the docker vm needs to be made larger: more cpu and memory ? What's the current settings?

cer commented 4 years ago

Please create a separate issue for IDEA. Thanks.

LlorandoLau commented 4 years ago

Just waiting. It's strange. The current settings is still 4GB and 2CPU.

LlorandoLau commented 4 years ago

Maybe more cpu and memory would make it runs better. According to #41 ,10GB and 4 cpu is better.

MurshedGilbert commented 2 years ago

When executing ./gradlew :ComposeUp I get following error:

File "docker\api\client.py", line 221, in _retrieve_server_version docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.') [18368] Failed to execute script docker-compose

Task :composeUp FAILED

FAILURE: Build failed with an exception.

Any suggestion how to resolve this?