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

Improvements to remove docker-in-docker for che running as image #257

Merged
merged 6 commits into from
Feb 10, 2016

Conversation

TylerJewell
Copy link

  1. Do a docker pull before doing docker run to get latest image.
  2. Launch docker image by volume mounting directories to avoid dind.
  3. Update the docker exec that launches che to copy ws-agent and terminal to right location.

echo -e "Cleaning up any zombie containers named ${GREEN}che${NC}..."

# Force remove any lingering zombie containers with the name che
"${DOCKER}" rm -f che &> /dev/null || true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's name container eclipseche to avoid possible collisions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the possible collisions?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when some other product uses name che.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a new command line option --container:name which will set the name of the container. The default is che. But it can be overridden.

1. Added CONTAINER variable & command line option for setting name of docker container to use.
2. Refactored numerous strings for simpler reading and reduce duplication.
3. Added in SKIP_JAVA_VERSION check command line option
4. Improved formatting of error output.
@TylerJewell
Copy link
Author

@garagatyi Numerous improvements made. Please do another review.

@danpolanco
Copy link

--priveleged will no longer be required?

@TylerJewell
Copy link
Author

Yes correct. I can post what the new docker command looks like if you want.

@danpolanco
Copy link

I should be able to figure it out, otherwise I'll let you know.

What's neat is I should be able to get it running on carina 💃

@TylerJewell
Copy link
Author

There is one significant issue with this new approach. If you run this che container on vbox on Windows, it is able to successfully start and shutdown. But for some reason if you restart the same container, then the vbox VM will peg the CPU and not complete the boot of the Che server. It then requires the VM to be destroyed before the che container can start again. We are researching the root cause, but we think it's a vbox bug.

@danpolanco
Copy link

I'll take you up on seeing the new docker command now :)

@TylerJewell
Copy link
Author

This is the quickest way to experience the new container that doesn't use dind.

docker run -ti --net=host -e DOCKER_MACHINE_HOST=<ip-of-host-of-docker> -v /var/run/docker.sock:/var/run/docker.sock -v /home/user/che/lib:/home/user/che/lib-copy -v /home/user/che/workspaces:/home/user/che/workspaces -v /home/user/che/tomcat/temp/local-storage:/home/user/che/tomcat/temp/local-storage codenvy/che:no_dnd

@danpolanco
Copy link

Awesome! Leaving this hear in case anyone else is curious... (I haven't tested to make sure everything works as expected yet)

editor_container:
  image: "codenvy/che:no_dnd"
  restart: "always"
  environment:
    - "VIRTUAL_HOST=sub.yourdomain.org"
    - "VIRTUAL_PORT=8080"
    - "TZ=America/Mountains"
  volumes:
    - "/var/run/docker.sock:/var/run/docker.sock"
  volumes_from:
    - "editor_data"

editor_data:
  image: "codenvy/che:no_dnd"
  environment:
    - "TZ=America/Mountains"
  volumes:
    - "/home/user/che/lib-copy"
    - "/home/user/che/workspaces"
    - "/home/user/che/tomcat/temp/local-storage"
  entrypoint: "true"

Should close #238.

@TylerJewell
Copy link
Author

thanks for the contribution @DanTheColoradan. May we post this suggestion on the docs when we update our Docker page with the new instructions?

if [[ "${SKIP_JAVA_VERSION}" == false ]]; then
# Che requires Java version 1.8 or higher.
JAVA_VERSION=$("${JAVA_HOME}/bin/java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ -z "${JAVA_VERSION}" || "${JAVA_VERSION}" < "1.8" ]]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix indentation

if ${USE_DEBUG}; then
set +x
fi
return

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is useless

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary to avoid flawed output if script execution is interrupted

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@garagatyi
Copy link

@TylerJewell It is nice that you changed functions declaration syntax but it won't help to fix #262.
I believe that only one thing that we can do is disable POSIX compliant mode in Che script. If we won't do that we have to fix dozens of operations in the script to fix that issue.

@danpolanco
Copy link

What permissions is /home/user/che supposed to have? It looks like they are being set back to root somehow?

screen shot 2016-02-05 at 9 53 54 am

@danpolanco
Copy link

Nvm.

screen shot 2016-02-05 at 10 06 44 am

@garagatyi
Copy link

ok for me. @skabashnyuk @vparfonov WDYT?

@TylerJewell
Copy link
Author

Hold on any merge. We have a new commit that is coming that will need re-testing.

Tyler Jewell added 2 commits February 8, 2016 09:03
Made numerous improvements.  We now have the ability to start / stop repeatedly a Che server running in an image without corruption.  Finally!
@TylerJewell
Copy link
Author

@garagatyi @skabashnyuk @vparfonov I am ready to merge this. Made numerous improvements and now Che in a docker image is stable even after many stop / restart cycles.

`"mkdir -p /home/user/che/lib-copy/ && "`
`"sudo chown -R user:user /home/user && "`
`"cp -rf /home/user/che/lib/* /home/user/che/lib-copy && "`
`"sudo sed -i 's/random/urandom/g' /opt/jre1.8.0_65/lib/security/java.security && "`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explaine why you added this sed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this change decreses security of random generator. @skabashnyuk WDYT is it ok to accept that change?

@ghost
Copy link

ghost commented Feb 9, 2016

I think this one isn't necessary - http://stackoverfklow.com/questions/26431922/tomcat7-starts-too-late-on-ubuntu-14-04-x64-digitalocean however, it is harmless in terms of affecting Che. It is just an exec. I thought this might be the reason why container was unresponsive.

1. Will only stop the che server if che is in a docker container.
2. Added --stop-container option which will also stop docker container running che
3. Removed unnecessary sed command in che start
@TylerJewell
Copy link
Author

@garagatyi Ready to merge. Last updates made.

@skabashnyuk
Copy link
Contributor

ok

TylerJewell pushed a commit that referenced this pull request Feb 10, 2016
Improvements to remove docker-in-docker for che running as image
@TylerJewell TylerJewell merged commit abe68ed into master Feb 10, 2016
@skabashnyuk skabashnyuk deleted the idex-4266 branch February 11, 2016 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants