Improve Vagrantfile (#2085)

1. Fixed speed
2. Fixed ability to do vagrant up / suspend
3. Added better printout of URL
6.19.x
Tyler Jewell 2016-08-11 13:32:06 -07:00 committed by GitHub
parent 5ae3c861ed
commit bed0b3cfd4
1 changed files with 17 additions and 20 deletions

37
Vagrantfile vendored
View File

@ -11,7 +11,7 @@
$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'] || "latest"
$che_version = ENV['CHE_VERSION'] || "nightly"
$ip = ENV['CHE_IP'] || "192.168.28.100"
$hostPort = (ENV['CHE_PORT'] || 8080).to_i
$containerPort = (ENV['CHE_CONTAINER_PORT'] || ($hostPort == -1 ? 8080 : $hostPort)).to_i
@ -144,7 +144,7 @@ Vagrant.configure(2) do |config|
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
#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
@ -170,26 +170,9 @@ Vagrant.configure(2) do |config|
perform $PROVISION_PROGRESS docker pull codenvy/che-launcher:${CHE_VERSION}
perform $PROVISION_PROGRESS docker pull codenvy/che-server:${CHE_VERSION}
echo "--------------------------------"
echo "ECLIPSE CHE: BOOTING ECLIPSE CHE"
echo "--------------------------------"
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
export CHE_CONF_FOLDER=/home/user/che/conf/
export CHE_PORT=${PORT}
export CHE_VERSION=${CHE_VERSION}
export CHE_HOST_IP=172.17.0.1
export CHE_HOSTNAME=${CHE_IP}
/home/vagrant/che.sh start
# docker run --net=host --name=che --restart=always --detach `
# `-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/storage:/home/user/che/storage `
# `-v /home/user/che/conf:/container `
# `-e CHE_LOCAL_CONF_DIR=/container `
# `codenvy/che:${CHE_VERSION} --remote:${IP} --port:${PORT} run &>/dev/null
SHELL
config.vm.provision "shell" do |s|
@ -202,6 +185,18 @@ Vagrant.configure(2) do |config|
PORT=$2
MAPPED_PORT=$3
export CHE_CONF_FOLDER=/home/user/che/conf/
export CHE_PORT=${PORT}
export CHE_VERSION=${CHE_VERSION}
export CHE_HOST_IP=172.17.0.1
export CHE_HOSTNAME=${CHE_IP}
export CHE_DATA_FOLDER=${CHE_DATA}
echo "--------------------------------"
echo "ECLIPSE CHE: BOOTING ECLIPSE CHE"
echo "--------------------------------"
/home/vagrant/che.sh restart &>/dev/null
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/')
@ -213,6 +208,8 @@ Vagrant.configure(2) do |config|
echo "${CHE_URL}" > /home/user/che/.che_url
echo "${MAPPED_PORT}" > /home/user/che/.che_host_port
echo "ECLIPSE CHE READY AT: ${CHE_URL}"
SHELL