From 2c811b8c5ec938a22151f53cfa2d0c11a8138a72 Mon Sep 17 00:00:00 2001 From: Florent BENOIT Date: Wed, 18 Jan 2017 11:51:58 +0100 Subject: [PATCH 1/2] Remove native launch of che CLI is used to start che. command is : docker run eclipse/che to use local binaries : add -v :/repo Change-Id: I8649830049974043b69f6725480c1799cfe325cd Signed-off-by: Florent BENOIT --- .../assembly-main/src/assembly/assembly.xml | 12 -- .../assembly-main/src/assembly/bin/che.bat | 29 --- che.bat | 28 --- che.sh | 173 ------------------ 4 files changed, 242 deletions(-) delete mode 100644 assembly/assembly-main/src/assembly/bin/che.bat delete mode 100644 che.bat delete mode 100755 che.sh diff --git a/assembly/assembly-main/src/assembly/assembly.xml b/assembly/assembly-main/src/assembly/assembly.xml index d64e2177a9b..6ca7b8012e5 100644 --- a/assembly/assembly-main/src/assembly/assembly.xml +++ b/assembly/assembly-main/src/assembly/assembly.xml @@ -201,18 +201,6 @@ - - ${project.basedir}/src/assembly/bin/che.sh - bin - che.sh - 755 - - - ${project.basedir}/src/assembly/bin/che.bat - bin - che.bat - 755 - ${project.basedir}/src/assembly/bin/che-install-plugin.sh bin diff --git a/assembly/assembly-main/src/assembly/bin/che.bat b/assembly/assembly-main/src/assembly/bin/che.bat deleted file mode 100644 index 37be6ac3708..00000000000 --- a/assembly/assembly-main/src/assembly/bin/che.bat +++ /dev/null @@ -1,29 +0,0 @@ -@REM -@REM Copyright (c) 2012-2017 Codenvy, S.A. -@REM All rights reserved. This program and the accompanying materials -@REM are made available under the terms of the Eclipse Public License v1.0 -@REM which accompanies this distribution, and is available at -@REM http://www.eclipse.org/legal/epl-v10.html -@REM -@REM Contributors: -@REM Codenvy, S.A. - initial API and implementation -@REM - -@echo off - -REM Check to ensure bash is installed -CALL bash --help > nul 2>&1 -IF %ERRORLEVEL% NEQ 0 goto setup - -REM Launch Che and any associated docker machines, if necessary -CALL bash --login -i "%~dp0\che.sh" %* - -goto end - -:setup -echo. -echo REQUIRED: Git bash. Please re-run Docker Toolbox Installer and add bash.exe to your PATH. -echo This is typically located at c:\Program Files\Git\bin. -echo. - -:end diff --git a/che.bat b/che.bat deleted file mode 100644 index 5f36265321a..00000000000 --- a/che.bat +++ /dev/null @@ -1,28 +0,0 @@ -@REM -@REM Copyright (c) 2012-2016 Codenvy, S.A. -@REM All rights reserved. This program and the accompanying materials -@REM are made available under the terms of the Eclipse Public License v1.0 -@REM which accompanies this distribution, and is available at -@REM http://www.eclipse.org/legal/epl-v10.html -@REM -@REM Contributors: -@REM Codenvy, S.A. - initial API and implementation -@REM - -@echo off - -REM Check to ensure bash is installed -CALL bash --help > nul 2>&1 -IF %ERRORLEVEL% NEQ 0 goto setup - -REM Launch matching Bash script which contains commands -CALL bash --login -i "%~dp0\che.sh" %* - -goto end - -:setup -echo. -echo "REQUIRED: Git Bash for Windows. Get it at https://git-for-windows.github.io/" -echo. - -:end diff --git a/che.sh b/che.sh deleted file mode 100755 index 16e3ff86f1d..00000000000 --- a/che.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/bin/bash -# Copyright (c) 2012-2016 Codenvy, S.A. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Tyler Jewell - Initial Implementation -# - -init_logging() { - BLUE='\033[1;34m' - GREEN='\033[0;32m' - RED='\033[0;31m' - YELLOW='\033[38;5;220m' - NC='\033[0m' - - # Which che CLI version to run? - DEFAULT_CHE_CLI_VERSION="latest" - CHE_CLI_VERSION=${CHE_CLI_VERSION:-${DEFAULT_CHE_CLI_VERSION}} - - DEFAULT_CHE_PRODUCT_NAME="ECLIPSE CHE" - CHE_PRODUCT_NAME=${CHE_PRODUCT_NAME:-${DEFAULT_CHE_PRODUCT_NAME}} - - # Name used in CLI statements - DEFAULT_CHE_MINI_PRODUCT_NAME="che" - CHE_MINI_PRODUCT_NAME=${CHE_MINI_PRODUCT_NAME:-${DEFAULT_CHE_MINI_PRODUCT_NAME}} - - # Turns on stack trace - DEFAULT_CHE_CLI_DEBUG="false" - CHE_CLI_DEBUG=${CHE_CLI_DEBUG:-${DEFAULT_CHE_CLI_DEBUG}} - - # Activates console output - DEFAULT_CHE_CLI_INFO="true" - CHE_CLI_INFO=${CHE_CLI_INFO:-${DEFAULT_CHE_CLI_INFO}} - - # Activates console warnings - DEFAULT_CHE_CLI_WARN="true" - CHE_CLI_WARN=${CHE_CLI_WARN:-${DEFAULT_CHE_CLI_WARN}} -} - -warning() { - if is_warning; then - printf "${YELLOW}WARN:${NC} %s\n" "${1}" - fi -} - -info() { - if is_info; then - if [ -z ${2+x} ]; then - PRINT_COMMAND="" - PRINT_STATEMENT=$1 - else - PRINT_COMMAND="($CHE_MINI_PRODUCT_NAME $1):" - PRINT_STATEMENT=$2 - fi - printf "${GREEN}INFO:${NC} %s %s\n" \ - "${PRINT_COMMAND}" \ - "${PRINT_STATEMENT}" - fi -} - -debug() { - if is_debug; then - printf "\n${BLUE}DEBUG:${NC} %s" "${1}" - fi -} - -error() { - printf "${RED}ERROR:${NC} %s\n" "${1}" -} - -is_warning() { - if [ "${CHE_CLI_WARN}" = "true" ]; then - return 0 - else - return 1 - fi -} - -is_info() { - if [ "${CHE_CLI_INFO}" = "true" ]; then - return 0 - else - return 1 - fi -} - -is_debug() { - if [ "${CHE_CLI_DEBUG}" = "true" ]; then - return 0 - else - return 1 - fi -} - -has_docker() { - hash docker 2>/dev/null && return 0 || return 1 -} - -check_docker() { - if ! has_docker; then - error "Error - Docker not found. Get it at https://docs.docker.com/engine/installation/." - return 1; - fi - - if ! docker ps > /dev/null 2>&1; then - output=$(docker ps) - error "Error - Docker not installed properly: \n${output}" - return 1; - fi - - # Prep script by getting default image - if [ "$(docker images -q alpine 2> /dev/null)" = "" ]; then - info "Pulling image alpine:latest" - docker pull alpine > /dev/null 2>&1 - fi - - if [ "$(docker images -q appropriate/curl 2> /dev/null)" = "" ]; then - info "Pulling image curl:latest" - docker pull appropriate/curl > /dev/null 2>&1 - fi -} - -curl () { - docker run --rm --net=host appropriate/curl "$@" -} - -update_che_cli() { - info "Downloading cli-$CHE_CLI_VERSION" - - CLI_DIR=~/."${CHE_MINI_PRODUCT_NAME}"/cli - test -d "${CLI_DIR}" || mkdir -p "${CLI_DIR}" - - if [[ "${CHE_CLI_VERSION}" = "latest" ]] || \ - [[ "${CHE_CLI_VERSION}" = "nightly" ]] || \ - [[ ${CHE_CLI_VERSION:0:1} == "4" ]]; then - GITHUB_VERSION=master - else - GITHUB_VERSION=$CHE_CLI_VERSION - fi - - URL=https://raw.githubusercontent.com/eclipse/che/$GITHUB_VERSION/cli.sh - - if ! curl --output /dev/null --silent --head --fail "$URL"; then - error "CLI download error. Bad network or version. CLI update works for 5.0.0-M3+." - return 1; - else - curl -sL $URL > ~/."${CHE_MINI_PRODUCT_NAME}"/cli/cli-$CHE_CLI_VERSION.sh - fi -} - -init() { - init_logging - check_docker - - # Test to see if we have cli_funcs - if [ ! -f ~/."${CHE_MINI_PRODUCT_NAME}"/cli/cli-${CHE_CLI_VERSION}.sh ]; then - update_che_cli - fi - - source ~/."${CHE_MINI_PRODUCT_NAME}"/cli/cli-${CHE_CLI_VERSION}.sh - - init_global_variables -} - -# See: https://sipb.mit.edu/doc/safe-shell/ -set -e -set -u -init -parse_command_line "$@" -execute_cli "$@" From 792cc0fc2be8637d62f8cd2c273201fd6d27713c Mon Sep 17 00:00:00 2001 From: Florent BENOIT Date: Wed, 18 Jan 2017 14:31:49 +0100 Subject: [PATCH 2/2] fixup! Remove native launch of che CLI is used to start che. Change-Id: Iea826391d3f211eb709d18a249f22b68af93c00d Signed-off-by: Florent BENOIT --- Vagrantfile | 207 ---------------------------------------------------- 1 file changed, 207 deletions(-) delete mode 100644 Vagrantfile diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index fc4539b7a58..00000000000 --- a/Vagrantfile +++ /dev/null @@ -1,207 +0,0 @@ -# Copyright (c) 2012-2016 Codenvy, S.A. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Codenvy, S.A. - initial API and implementation - -# Set to "://:@:" -$http_proxy = ENV['HTTP_PROXY'] || "" -$https_proxy = ENV['HTTPS_PROXY'] || "" -$no_proxy = ENV['NO_PROXY'] || "localhost,127.0.0.1" -$che_version = ENV['CHE_VERSION'] || "4.7.2" -$ip = ENV['CHE_HOST_IP'] || "192.168.28.100" -$hostPort = (ENV['CHE_PORT'] || 8080).to_i -$containerPort = (ENV['CHE_CONTAINER_PORT'] || ($hostPort == -1 ? 8080 : $hostPort)).to_i -$user_data = ENV['CHE_DATA'] || "." -$vm_name = ENV['CHE_VM_NAME'] || "eclipse-che-vm" -$provisionProgress = ENV['PROVISION_PROGRESS'] || "extended" - -Vagrant.configure(2) do |config| - puts ("ECLIPSE CHE: VAGRANT INSTALLER") - puts ("ECLIPSE CHE: REQUIRED: VIRTUALBOX 5.x") - puts ("ECLIPSE CHE: REQUIRED: VAGRANT 1.8.x") - puts ("") - if ($http_proxy.to_s != '' || $https_proxy.to_s != '') && !Vagrant.has_plugin?("vagrant-proxyconf") - puts ("You configured a proxy, but Vagrant's proxy plugin not detected.") - puts ("Install the plugin with: vagrant plugin install vagrant-proxyconf") - Process.kill 9, Process.pid - end - - if Vagrant.has_plugin?("vagrant-proxyconf") - config.proxy.http = $http_proxy - config.proxy.https = $https_proxy - config.proxy.no_proxy = $no_proxy - end - - config.vm.box = "boxcutter/centos72" - config.vm.box_download_insecure = true - config.ssh.insert_key = false - if $ip.to_s.downcase == "dhcp" - config.vm.network :private_network, type: "dhcp" - else - config.vm.network :private_network, ip: $ip - end - if $hostPort != -1 - config.vm.network "forwarded_port", guest: $containerPort, host: $hostPort - end - config.vm.synced_folder $user_data, "/home/user/che" - config.vm.define "che" do |che| - end - - config.vm.provider "virtualbox" do |vb| - vb.memory = "4096" - vb.name = $vm_name - end - - $script = <<-'SHELL' - HTTP_PROXY=$1 - HTTPS_PROXY=$2 - NO_PROXY=$3 - CHE_VERSION=$4 - IP=$5 - PORT=$6 - PROVISION_PROGRESS=$7 - - if [ "${IP,,}" = "dhcp" ]; then - echo "----------------------------------------" - echo "ECLIPSE CHE: CHECKING DYNAMIC IP ADDRESS" - echo "----------------------------------------" - DEV=$(grep -l "VAGRANT-BEGIN" /etc/sysconfig/network-scripts/ifcfg-*|xargs grep "DEVICE="|sort|tail -1|cut -d "=" -f 2) - if [ -z "${DEV}" ]; then - >&2 echo "Unable to find DHCP network device" - exit 1 - fi - IP=$(ip addr show dev ${DEV} | sed -r -e '/inet [0-9]/!d;s/^[[:space:]]*inet ([^[:space:]/]+).*$/\1/') - if [ -z "${IP}" ]; then - >&2 echo "Unable to find DHCP network ip" - exit 1 - fi - echo "IP: ${IP}" - echo - fi - - if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then - echo "-------------------------------------" - echo "." - echo "ECLIPSE CHE: CONFIGURING SYSTEM PROXY" - echo "." - echo "-------------------------------------" - echo "export http_proxy=$HTTP_PROXY" >> /etc/profile.d/vars.sh - echo "export https_proxy=$HTTPS_PROXY" >> /etc/profile.d/vars.sh - echo "export no_proxy=$NO_PROXY" >> /etc/profile.d/vars.sh - source /etc/profile.d/vars.sh - - # Configuring the Che properties file - mounted into Che container when it starts - echo "export CHE_PROPERTY_http_proxy=${HTTP_PROXY}" >> /etc/profile.d/vars.sh - echo "export CHE_PROPERTY_https_proxy=${HTTP_PROXY}" >> /etc/profile.d/vars.sh - - echo "HTTP PROXY set to: $HTTP_PROXY" - echo "HTTPS PROXY set to: $HTTPS_PROXY" - fi - - echo "------------------------------" - echo "ECLIPSE CHE: INSTALLING DOCKER" - echo "------------------------------" - sudo yum -y install expect - - # INstall docker - sudo yum -y update -# perform $PROVISION_PROGRESS sudo yum install docker-engine - curl -fsSL https://get.docker.com/ | sh - sudo service docker start - - echo $(docker --version) - - # Add the 'vagrant' user to the 'docker' group - usermod -aG docker vagrant &>/dev/null - - # We need write access to this file to enable Che container to create other containers - sudo chmod 777 /var/run/docker.sock &>/dev/null - - # Setup the overlay storage driver to eliminate errors - #sudo sed -i '/ExecStart=\/usr\/bin\/dockerd/c\ExecStart=\/usr\/bin\/dockerd --storage-driver=overlay' /lib/systemd/system/docker.service - - # Configure Docker daemon with the proxy - if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then - mkdir /etc/systemd/system/docker.service.d - fi - if [ -n "$HTTP_PROXY" ]; then - printf "[Service]\nEnvironment=\"HTTP_PROXY=${1}\"" > /etc/systemd/system/docker.service.d/http-proxy.conf - printf "" - fi - if [ -n "$HTTPS_PROXY" ]; then - printf "[Service]\nEnvironment=\"HTTPS_PROXY=${2}\"" > /etc/systemd/system/docker.service.d/https-proxy.conf - fi - if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then - printf "[Service]\nEnvironment=\"NO_PROXY=${3}\"" > /etc/systemd/system/docker.service.d/no-proxy.conf - fi - - systemctl daemon-reload - systemctl restart docker - - echo "--------------------------------------------------" - echo "ECLIPSE CHE: DOWNLOADING ECLIPSE CHE DOCKER IMAGES" - echo "--------------------------------------------------" - docker pull alpine:latest - docker pull codenvy/che-launcher:${4} - docker pull codenvy/che-server:${4} - - curl -sL https://raw.githubusercontent.com/eclipse/che/master/che.sh | tr -d '\15\32' > /home/vagrant/che.sh - chmod +x /home/vagrant/che.sh - - echo "export CHE_PORT=${6}" >> /etc/profile.d/vars.sh - echo "export CHE_VERSION=${4}" >> /etc/profile.d/vars.sh - echo "export CHE_HOST_IP=${5}" >> /etc/profile.d/vars.sh - echo "export CHE_HOSTNAME=${5}" >> /etc/profile.d/vars.sh - echo "export IS_INTERACTIVE=false" >> /etc/profile.d/vars.sh - echo "export IS_PSEUDO_TTY=false" >> /etc/profile.d/vars.sh - - SHELL - - config.vm.provision "shell" do |s| - s.inline = $script - s.args = [$http_proxy, $https_proxy, $no_proxy, $che_version, $ip, $containerPort, $provisionProgress] - end - - $script2 = <<-'SHELL' - IP=$1 - PORT=$2 - MAPPED_PORT=$3 - - echo "--------------------------------" - echo "ECLIPSE CHE: BOOTING ECLIPSE CHE" - echo "--------------------------------" - - docker run --rm -t -v /var/run/docker.sock:/var/run/docker.sock \ - -e "CHE_PORT=${2}" \ - -e "CHE_RESTART_POLICY=always" \ - -e "CHE_HOST_IP=${1}" \ - -e "CHE_HOSTNAME=${1}" \ - codenvy/che-launcher:${CHE_VERSION} start - - - if [ "${IP,,}" = "dhcp" ]; then - DEV=$(grep -l "VAGRANT-BEGIN" /etc/sysconfig/network-scripts/ifcfg-*|xargs grep "DEVICE="|sort|tail -1|cut -d "=" -f 2) - IP=$(ip addr show dev ${DEV} | sed -r -e '/inet [0-9]/!d;s/^[[:space:]]*inet ([^[:space:]/]+).*$/\1/') - fi - - rm -f /home/user/che/.che_url - rm -f /home/user/che/.che_host_port - CHE_URL="http://${IP}:${PORT}" - - echo "${CHE_URL}" > /home/user/che/.che_url - echo "${MAPPED_PORT}" > /home/user/che/.che_host_port - echo "" - echo "ECLIPSE CHE READY AT: ${CHE_URL}" - - SHELL - - config.vm.provision "shell", run: "always" do |s| - s.inline = $script2 - s.args = [$ip, $containerPort, $hostPort] - end - -end