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

Failed to change port (regression) #3179

Closed
ne0h opened this issue Nov 26, 2016 · 21 comments
Closed

Failed to change port (regression) #3179

ne0h opened this issue Nov 26, 2016 · 21 comments
Assignees
Labels
kind/bug Outline of a bug - must adhere to the bug report template. severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code.

Comments

@ne0h
Copy link

ne0h commented Nov 26, 2016

Hi,
I do not manage to get che running with a non-default port (9080). I tried on Arch Linux and Ubuntu 14.04 LTS. 8080 works but changing the port via export CHE_PORT=9080 does not work.
Error message in the terminal where I start docker:

INFO: ECLIPSE CHE: Found image eclipse/che-server:5.0.0-latest
INFO: ECLIPSE CHE: Starting container...
INFO: ECLIPSE CHE: Server logs at "docker logs -f che-server"
INFO: ECLIPSE CHE: Server booting...
---------------------------------------
ERROR: !!!
ERROR:      ECLIPSE CHE: Timeout waiting for server. Run "docker logs che-server" to inspect the issue.
ERROR: !!!
---------------------------------------

Docker log is attached here: https://gist.github.com/ne0h/7e07dd868bdb2a8fc42130471be261b0

Reproduction Steps:

  1. Follow the guide: https://www.eclipse.org/che/getting-started/download/ to download the startup file
  2. export CHE_PORT=9080
  3. che start

Expected behavior:

Everything is fine.

Observed behavior:

Che "does not come up".

Che version: 5.0.0-latest
**OS and version:**Ubuntu 14.04 LTS, Arch Linux
Docker version: 1.12.3, build 6b644ec
Che install: Docker container

Additional information:

  • Problem started happening recently, didn't happen in an older version of Che: No
  • Problem can be reliably reproduced, doesn't happen randomly: Yes

Thanks in advance!
Max

@TylerJewell TylerJewell self-assigned this Nov 26, 2016
@TylerJewell TylerJewell added the kind/question Questions that haven't been identified as being feature requests or bugs. label Nov 26, 2016
@TylerJewell
Copy link

Maximillian - I am investigating. In the mean time, you can bypass the CLI and [launch the server] (https://eclipse-che.readme.io/docs/usage-docker-server) with this Docker syntax. And you can override the ports more directly with that.

@TylerJewell TylerJewell added kind/bug Outline of a bug - must adhere to the bug report template. severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code. and removed kind/question Questions that haven't been identified as being feature requests or bugs. labels Nov 26, 2016
@TylerJewell
Copy link

Confirmed the issue with che-launcher. There is an adaptaptation regression that is causing some sort of variable passing error.

@TylerJewell TylerJewell changed the title Failed to change port Failed to change port (regression) Nov 26, 2016
@TylerJewell
Copy link

@ne0h - found the issue and got a fix in. This will show up in our nightly's shortly.

eclipse-che/che-dockerfiles#50 (review)

@TylerJewell
Copy link

@ne0h - CI systems updated and this issue should no longer be active.

@ne0h
Copy link
Author

ne0h commented Nov 27, 2016

@TylerJewell - Thanks a lot for your work!

Are sure that the bug is fixed? I am getting the same error even with CHE_VERSION=nightly.
I tried docker run --rm -t -v /var/run/docker.sock:/var/run/docker.sock -e CHE_PORT=9080 -e CHE_VERSION=nightly eclipse/che:nightly start and CHE_PORT=9080 CHE_VERSION=nightly che start.

lsof -i :9080 shows that there is "something" running on 9080:

COMMAND     PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
docker-pr 10626 root    4u  IPv6 10978498      0t0  TCP *:9080 (LISTEN)

But there is still nothing to access on http://localhost:9080. Same on Archlinux and Ubuntu.

@TylerJewell
Copy link

Yes the issue is fixed. It is fixed in a utility so please set CHE_UTILITY_VERSION to nightly first.

@ne0h
Copy link
Author

ne0h commented Nov 27, 2016

So it works for you?

I am still getting the same error with CHE_PORT=9080 CHE_UTILITY_VERSION=nightly che start.
No difference if passing the environment variables directly or using export.

@TylerJewell
Copy link

Yes, it is working for me. Chances are your old images are cached. This happens a lot when using the "nightly" images. You should start by doing docker rmi -f $(docker images -q) to remove all of the images on your system and then try again.

@ne0h
Copy link
Author

ne0h commented Nov 27, 2016

Ah your absolutely right - works like a charm now.
Thanks a lot for your patience and fast responses!

@orboan
Copy link

orboan commented Jan 9, 2017

Hello,
trying to change the default port and reaching this thread.

I run this:

docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v ~/data/che:/data -e CHE_HOST=${HOST} -e CHE_PORT=${PORT} -e CHE_UTILITY_VERSION=nightly -e CHE_VERSION=nightly eclipse/che:nightly start

(The environment variables for port and host are correctly set.)

And I get:

INFO: (che cli): Pulling image alpine:3.4 INFO: (che cli): Pulling image eclipse/che-ip:nightly INFO: (che cli): Loading cli... ERROR: ERROR: Your CLI version 'eclipse/che:nightly' does not match your installed version '5.0.0'. ERROR: ERROR: The 'nightly' CLI is only compatible with 'nightly' installed versions. ERROR: You may not 'che upgrade' from 'nightly' to a numbered (tagged) version. ERROR: ERROR: Run the CLI as 'eclipse/che:<version>' to install a tagged version.

And yes, I removed first all docker images.

So, what am I missing?

Thanks.

@TylerJewell
Copy link

It looks like the files that you have in ~/data/che were originally installed with the 5.0.0 version of Che. It means that you ran docker run eclipse/che.

The nightly version is not compatible with non-nightly versions. So if you try to use eclipse/che:nightly as the version, we check the installation folder and if it is also not a nightly then we fail. We do this because the nightly is essnetially like a development channel, and it changes frequently with no guarantee of underlying data integrity.

You either need to run the nightly in a new folder, or to destroy the installation you have first before running again.

# Destroy an installation
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock 
  -v ~/data/che:/data eclipse/che:nightly destroy

# Create new installation and start with a port
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock 
  -v ~/data/che:/data -e CHE_HOST=${HOST} -e CHE_PORT=${PORT} 
   eclipse/che:nightly start

Note the CHE_VERSION and CHE_UTILITY_VERSION no longer apply with this new CLI. You can just run "docker run eclipse/che" to get help. We have greatly simplified the CLI.

@tkausl
Copy link

tkausl commented Jan 12, 2017

I still have this problem, looking through the cli log, the server isn't started directly but through docker-compose using a generated yml file. This yml still uses the wrong port (8080): https://github.com/eclipse/che/blob/master/dockerfiles/init/modules/compose/templates/docker-compose.yml.erb

@TylerJewell
Copy link

The YML is set to the CHE_HOST port. It maps the external port of the container to the internal port, 8080. We do not yet have logic that simplifies changing the intenral port of the Tomcat in the container, but why should that matter? The container's exposed port is changed.

I just tested this with nightly on windows 10 and it was ok.

@tkausl
Copy link

tkausl commented Jan 12, 2017

Well tomcat seems to always listen on the CHE_PORT for me so mapping to the internal port 8080 isn't working

part of docker logs che:

2017-01-12 16:47:30,146[main]             [INFO ] [o.a.c.s.VersionLoggerListener 115]   - Command line argument: -Dport.http=8181

https://github.com/eclipse/che/blob/master/dockerfiles/che/entrypoint.sh#L155

@TylerJewell
Copy link

Humm - can you share Che version you ran for this, too - was it nightly? Thx.

@tkausl
Copy link

tkausl commented Jan 12, 2017

It was nightly, yes. And eclipse/che, not eclipse/che-cli if this matters

@TylerJewell
Copy link

Ok - thanks for the report - will do a proper investigation this weekend.

@orboan
Copy link

orboan commented Jan 13, 2017

Thanks TylerJewell

@TylerJewell
Copy link

Well, I have uncovered the root cause.

When you run the CLI with -e CHE_PORT=<num>, we purposely do not include CHE_PORT into the che.env. As a result, CHE_PORT should not be passed from the CLI into the eclipse/che-server container as an environment variable (we pass the entire che.env file into the new container when it is started). We then make assumptions that CHE_PORT is not passed into the new container, and therefore it should be hard-coded to 8080 inside of the che-server container and then your custom port exposed.

However, when starting Che with the latest tagged release and inspecting the container, CHE_PORT with the custom value is passed in. This, of course, breaks the template, which is just mapping the external custom port to the hard-coded internal port.

This is happening because we are actually passing in two separate che.env files. There is the user's configured che.env but there seems to be a secondary /instance/config/che.env file that we generate internally that is also passed in. This secondary che.env is set from this template https://github.com/eclipse/che/blob/master/dockerfiles/init/modules/che/templates/che.env.erb and it has CHE_PORT included within it. So while I assumed CHE_PORT was never passed in, looks like @benoitf updated the configuration to make sure it's always passed in.

So the solution is to either revert CHE_PORT out of the secondary puppet template. Or to update the docker-compose template to do an internal mapping of the CHE_PORT.

@TylerJewell
Copy link

I also note that in https://github.com/eclipse/che/blob/master/dockerfiles/init/modules/che/templates/che.env.erb that CHE_PORT is added twice. There is a function at the top that loopse through all in-memory variables with CHE_* set and then a hard-coded list of additional CHE_* variables. So if CHE_PORT is in memory, then it will always be added to this file, even if we remove the hard-coded variant.

So seems simplest fix will be to update the template to make the internal Che server respect the port parameter.

@TylerJewell
Copy link

#3734

To make this work temporarily until this makes it into the nightly stream:

  1. git clone http://github.com/eclipse/che
  2. git checkout CHE-3179
  3. cd dockerfiles/init; bash build.sh
  4. cd dockerfiles/cli; bash build.sh

This should generate a new eclipse/che:nightly image that has this correction. You can then use a custom port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template. severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code.
Projects
None yet
Development

No branches or pull requests

4 participants