appsody / stacks

Appsody application stacks. This repo will be archived soon.
https://appsody.dev
Apache License 2.0
90 stars 120 forks source link

java-openliberty: `appsody run` fails if Kubernetes is enabled #652

Open ianpartridge opened 4 years ago

ianpartridge commented 4 years ago

Describe the bug

On macOS, using Docker Desktop's built-in Kubernetes, the default template does not run if Kubernetes is enabled.

To Reproduce Steps to reproduce the behavior:

  1. mkdir testapp && cd testapp
  2. appsody init java-openliberty
  3. appsody run

Expected behavior

The default app starts.

Actual behaviour

The app does not start.

$ appsody run
Running development environment...
Pulling docker image docker.io/appsody/java-openliberty:0.1
Running command: docker pull docker.io/appsody/java-openliberty:0.1
0.1: Pulling from appsody/java-openliberty
Digest: sha256:8afe107bc74a9ab205c21a4a0fb8a4f0191d1de5fd4de106afa6878117bdfcf6
Status: Image is up to date for appsody/java-openliberty:0.1
docker.io/appsody/java-openliberty:0.1
Running command: docker run --rm -p 7777:7777 -p 9080:9080 -p 9443:9443 --name testapp-dev -u 502:20 -e APPSODY_USER=502 -e APPSODY_GROUP=20 -v /Users/ianpartridge/.m2/repository:/mvn/repository -v /Users/ianpartridge/src/testapp/.:/project/user-app -v appsody-controller-0.3.4:/.appsody -t --entrypoint /.appsody/appsody-controller docker.io/appsody/java-openliberty:0.1 --mode=run
[Container] docker: Error response from daemon: driver failed programming external connectivity on endpoint testapp-dev (9b4fa39e08056c656ba67872a760804020ace7ad180dac903183700ea2d91b65): Error starting userland proxy: listen tcp 0.0.0.0:9443: bind: address already in use.
[Error] Error in 'appsody run': exit status 125

If I then shut down Kubernetes on my machine, it works:

$ appsody run
Running development environment...
Pulling docker image docker.io/appsody/java-openliberty:0.1
Running command: docker pull docker.io/appsody/java-openliberty:0.1
0.1: Pulling from appsody/java-openliberty
Digest: sha256:8afe107bc74a9ab205c21a4a0fb8a4f0191d1de5fd4de106afa6878117bdfcf6
Status: Image is up to date for appsody/java-openliberty:0.1
docker.io/appsody/java-openliberty:0.1
Running command: docker run --rm -p 7777:7777 -p 9080:9080 -p 9443:9443 --name testapp-dev -u 502:20 -e APPSODY_USER=502 -e APPSODY_GROUP=20 -v /Users/ianpartridge/.m2/repository:/mvn/repository -v /Users/ianpartridge/src/testapp/.:/project/user-app -v appsody-controller-0.3.4:/.appsody -t --entrypoint /.appsody/appsody-controller docker.io/appsody/java-openliberty:0.1 --mode=run
[Container] Running APPSODY_PREP command: export APPSODY_DEV_MODE=prep;  ../validate.sh
[Container] Installing parent dev.appsody:java-openliberty:0.1.7
[Container] [INFO] Scanning for projects...
etc etc....

Environment Details (please complete the following information):

macOS 10.15.2 Catalina Docker Desktop 2.2.0.0 stable with Kubernetes v1.15.5 Appsody CLI 0.5.8

If applicable please specify:

helenmasters commented 4 years ago

This was raised in Slack at the end of last week and is going into the FAQ on https://appsody.dev. I'm just waiting for the PR to be reviewed https://github.com/appsody/website/issues/505

Please do comment on the FAQ I've written as I've described the workaround where we change the port, but not the workaround of shutting down Kubernetes.

Once this is merged my thoughts are that we should link to it from the Java microprofile and Open Liberty stack readmes with wording such as “Note: If you find that your Open Liberty Appsody project on macOS fails with the error “address already in use”, see the [Appsody FAQs](link to details on website).”

ianpartridge commented 4 years ago

The workaround sounds OK, but this issue should stay open for fixing the underlying problem in the stack, yeah?

neeraj-laad commented 4 years ago

@scottkurz What are your thoughts on this? In the past, we have tried to use the ports that the users of the language/framework are most familiar with so the developer's find transition to Appsody easier, but in this case this is causing more work than we want.

We could always use -P, but that means there is an additional step for every stack after every run. I'd like to avoid that if possible.

scottkurz commented 4 years ago

@neeraj-laad in asking me my thoughts, I feel like you understand a piece of this that I'm missing. E.g. why does the fact that k8s is active matter? Maybe we could chat on Slack?