-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Simplify Tomcat che.sh bootsrap script #2786
Conversation
Build # 704 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/704/ to view the results. |
Build # 705 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/705/ to view the results. |
Build # 706 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/706/ to view the results. |
Build # 707 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/707/ to view the results. |
Build # 708 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/708/ to view the results. |
Build # 709 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/709/ to view the results. |
Build # 710 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/710/ to view the results. |
Build # 711 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/711/ to view the results. |
ENTRYPOINT [ "/home/user/che/bin/che.sh", "-c" ] | ||
|
||
CMD [ "run" ] | ||
ENTRYPOINT ["/home/user/che/bin/start.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing EOL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
# Short circuit | ||
JUMP_TO_END=false | ||
determine_os () { | ||
# Set OS. Mac & Windows require VirtualBox and docker-machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mac And windows could use as well docker 4 mac, docker 4 windows ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a bad comment - leftover. Removed it.
@@ -83,6 +83,17 @@ | |||
</dependencies> | |||
<build> | |||
<plugins> | |||
<plugin> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get rid of this plugin definition by adding a newline in start.sh script after the header
#
<--insert newline there
pid=0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch - that explains the issue.
error_exit "This Linux user is not in 'docker' group. ` | ||
`See https://docs.docker.com/engine/installation/ubuntulinux/#create-a-docker-group" | ||
error "This Linux user is not in 'docker' group. ` | ||
`See https://docs.docker.com/engine/installation/ubuntulinux/#create-a-docker-group" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
working link seems to be https://docs.docker.com/engine/installation/linux/ubuntulinux/#/create-a-docker-group but it's kind specific to ubuntu
for example for debian we have https://docs.docker.com/engine/installation/linux/debian/#/giving-non-root-access
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire check was removed - as we no longer need to perform these checks.
# if [ "${CHE_IN_CONTAINER}" == "true" ]; then | ||
|
||
# Make sure the user named "user" is the owner of the CHE_HOME directory. | ||
# Make sure the user named "user" is the owner of the CHE_DATA directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe say CHE_HOME and CHE_DATA directories instead of 2 lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is removed in che.sh and it's been added into docker.sh with an improved message.
@@ -0,0 +1,235 @@ | |||
#!/bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need bash ? or sh should be enough ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, correct - downgraded it to sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested on ubuntu box and it worked fine
On Mac I wasn't able to run native che with docker4mac but it is already the case now, so :-)
Build # 715 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/715/ to view the results. |
launch_docker_registry | ||
execute_che () { | ||
check_docker | ||
determine_os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check_doker
and determine_os
won't work when running in a non privileged container on Kubernetes or OpenShift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will have to manage that in another PR, I believe. The scope of the current scirpt is related to the assumption that you are running the container on a host without privileged mode and /var/run/docker.sock activated.
We have two scenarios that we have to address with the che-server container, and the underlying che.sh Tomcat script:
1: - if it is a non-privileged container, then we need to rewrite certain functions - or pass in environment values from the container orchestrator.
2: - we have customers that are going to require Che in localhost mode - without the use of any Docker capabilities. This will need to come a bit later this year. But we make a large number of assumptions about Docker in the current scripts which would not be necessary and must be removed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see your point: some customers still need to run che-server in localhost mode, without Docker, and they deserve a "launcher" too. And I completely agree. But why not expanding the launcher itself to support this scenario? Or a new no-docker-launcher script that would reuse launcher_funcs.sh.
Current PR has a couple of drawbacks:
- Code duplication (launcher already does a lot of these checks)
- Incompatibility with kubernetes/openshift
And I'm for a complete rewrite of che.sh
to remove all the checks that are already handled by the launcher(s).
I agree with some of these points but not all of them. I will get time this week to articulate better the separation of concerns. I don't think the goal is necessarily avoidance of duplication. However I think the separation of concerns has to be driven by the desired customer use case and we should better articulate the purpose of each entry point. |
@skabashnyuk please plan to have this merged early in M7 |
82b9a21
to
cc8ba3b
Compare
Simplify Tomcat che.sh bootsrap script
What does this PR do?
Contains a rewrite for the native Tomcat scripts for starting and stopping Che to incorporate a number of improvements requested by users, and to remove a number of Docker-launch capabilities that are no longer needed as we provide
che-server
andche-launcher
containers, which are more commonly used.The improvements targeted for this pull request:
--<command>
command line options and replace them with environment variables./data
mount folder.docker stop che
handled proper shutdown.In order to deliver on this capability, we now have the Dockerfile entrypoint be
start.sh
which is then responsible for calling /home/user/che/bin/che.sh with the right command. We launch the command in the background which is necessary for JVM programs to receive a SIGTERM. This will also allow us to intercept theCHE_ASSEMBLY
and handle the logic there along with some nice checking of the path to see if the path is valid for usage.As part of this change, we are now only supporting a single volume mount of
/data
. Everything that is user configurable and / or needs to be saved in between multiple runs is now saved in this directory and volume mounted. In the basic tests - the following worked. We do an inspection in the che-server container to find the host volume that is mounted to/data
. We then take that value and update the default che.properties to replace five fields with this location.Shadow documentation:
https://eclipse-che.readme.io/v5.0/docs/usage-docker-server-1
Build
This image is not yet hosted on Docker Hub. You need to build it locally.
What issues does this PR fix or reference?
#2754 (open) - che.sh not checking for /var/run/docker.sock, & do DOCKER_HOST checks.
#2755 (open) - Usability improvements to che-server execution
#2771 - mapping
Previous behavior
The existing native script has a mix of environment variables and command line options which are not consistently applied. Also, the current bootstrap script will attempt to launch Docker using docker-machine if it is not present. This is no longer required as the only users of the Tomcat bootstrap script are those that understand how to configure Docker properly.
New behavior
*1. Have the trap shut down che
*2. Remove -v, -m, -a options.
*3. Remove launch_docker_vm from che.sh?
*4. Remove print_client_connect method
*5. Convert all parameters to inherit from env variables & CHE_ values
*6. Add check for any parameters with nice output for codenvy/che-server run
*7. -p:port ==> CHE_PORT
*8. -l:level ==> CHE_LOG_LEVEL (check CLI version)
*9. Show help if no parameters
*9. -r:ip ==> CHE_IP environment variable
*10. Check che-launcher for how debug is handled
*11. Add CHE_BLOCKING_ENTROPY
*12. Add CHE_LAUNCH_DOCKER_REGISTRY
*13. Add CHE_SKIP_JAVA_VERSION_CHECK
*14. Add CHE_SKIP_DOCKER_UID_ENFORCEMENT
*15. Remove USE_DOCKER, add check into early compatibility check
*16. Remove CHE_DOCKER_TAG
*17. Move help to better section - it's in the core body now
*18. Formalize CHE_SERVER_ACTION
*19. Add CHE_IN_CONTAINER=true to replace COPY_LIB
*20. Remove unnecessary Windows command output
*22. Auto detect if the container is in a VM and set necessary properties including
CHE_DOCKER_MACHINE_HOST_EXTERNAL=${HOSTNAME}
CHE_WORKSPACE_STORAGE="${CHE_DATA_HOST}/workspaces"
CHE_WORKSPACE_STORAGE_CREATE_FOLDERS=false