You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/02/28 23:27:39 UTC

[GitHub] csantanapr closed pull request #3358: Update to tools/ubuntu-setup to support xenial and later Ubuntu releases

csantanapr closed pull request #3358: Update to tools/ubuntu-setup to support xenial and later Ubuntu releases
URL: https://github.com/apache/incubator-openwhisk/pull/3358
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tools/ubuntu-setup/all.sh b/tools/ubuntu-setup/all.sh
index 8c2cdbe217..02a881ae43 100755
--- a/tools/ubuntu-setup/all.sh
+++ b/tools/ubuntu-setup/all.sh
@@ -1,24 +1,44 @@
 #!/bin/bash
+
+#  This script can be tested for validity by doing something like:
+#
+#  docker run -v "${OPENWHISK_HOME}:/openwhisk" ubuntu:trusty \
+#    sh -c 'apt-get update && apt-get -y install sudo && /openwhisk/tools/ubuntu-setup/all.sh'
+#
+#  ...but see the WARNING at the bottom of the script before tinkering.
+
 set -e
 set -x
 SOURCE="${BASH_SOURCE[0]}"
 SCRIPTDIR="$( dirname "$SOURCE" )"
 
 echo "*** installing basics"
-"$SCRIPTDIR/misc.sh"
+/bin/bash "$SCRIPTDIR/misc.sh"
 
 echo "*** installing python dependences"
-"$SCRIPTDIR/pip.sh"
+/bin/bash "$SCRIPTDIR/pip.sh"
 
 echo "*** installing java"
-"$SCRIPTDIR/java8.sh"
-
-echo "*** install scala"
-"$SCRIPTDIR/scala.sh"
-
-echo "*** installing docker"
-"$SCRIPTDIR/docker.sh"
+/bin/bash "$SCRIPTDIR/java8.sh"
 
 echo "*** installing ansible"
-"$SCRIPTDIR/ansible.sh"
+/bin/bash "$SCRIPTDIR/ansible.sh"
+
+# WARNING:
+#
+# This step MUST be last when testing scripts for validity using
+# Docker (as recommended above).  The reason is because the scripted restart
+# of docker may actually communicates with a Docker for Mac controlling
+# instance and terminate the container.  It's the last step, so it's okay,
+# but nothing after this step will run in that validity test situation.
 
+echo "*** installing docker"
+u_release="$(lsb_release -rs)"
+if [ "${u_release%%.*}" -lt "16" ]; then
+    /bin/bash "$SCRIPTDIR/docker.sh"
+else
+    echo "--- WARNING -------------------------------------------------"
+    echo "Using EXPERIMENTAL Docker CE script on Xenial or later Ubuntu"
+    echo "--- WARNING -------------------------------------------------"
+    /bin/bash "$SCRIPTDIR/docker-xenial.sh"
+fi
diff --git a/tools/ubuntu-setup/ansible.sh b/tools/ubuntu-setup/ansible.sh
index 7d8dee954f..55ccf3a85f 100755
--- a/tools/ubuntu-setup/ansible.sh
+++ b/tools/ubuntu-setup/ansible.sh
@@ -2,7 +2,7 @@
 set -e
 set -x
 
-sudo pip install --upgrade setuptools
+sudo pip install --upgrade setuptools pip
 sudo apt-get install -y software-properties-common
 sudo apt-add-repository -y ppa:ansible/ansible
 sudo apt-get update
@@ -15,4 +15,4 @@ sudo pip install httplib2==0.9.2
 sudo pip install requests==2.10.0
 
 ansible --version
-ansible-playbook --version
\ No newline at end of file
+ansible-playbook --version
diff --git a/tools/ubuntu-setup/docker-xenial.sh b/tools/ubuntu-setup/docker-xenial.sh
new file mode 100644
index 0000000000..ba881a72d6
--- /dev/null
+++ b/tools/ubuntu-setup/docker-xenial.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+#
+#  WARNING:  This is EXPERIMENTAL support for running OpenWhisk on the latest
+#            stable version of Docker CE on Ubuntu Xenial or later.  Proceed
+#            at your own risk.
+#
+#  Currently, ./all.sh does not support running this shell script.ls
+#
+
+set -e
+set -x
+
+sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+sudo apt-key fingerprint 0EBFCD88
+
+sudo add-apt-repository \
+    "deb [arch=$(uname -m | sed -e 's/x86_64/amd64/g')] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
+sudo apt-get -y update
+
+sudo apt-get purge lxc-docker || /bin/true
+sudo apt-cache policy docker-engine
+
+# DOCKER
+
+# NOTE: For the moment, this script will use the latest stable version of
+#       Docker CE.  When OpenWhisk locks down on a version of Docker CE to use,
+#       it can then be locked in using the commented lines
+#sudo apt-get install -y docker-ce=$docker_ce_version
+#sudo apt-mark hold docker-engine
+sudo apt-get install -y docker-ce  # Replace with lines above to lock in version
+
+# enable (security - use 127.0.0.1)
+sudo -E bash -c 'echo '\''DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --storage-driver=aufs"'\'' >> /etc/default/docker'
+sudo gpasswd -a "$(whoami)" docker
+
+# Set DOCKER_HOST as an environment variable
+sudo -E bash -c 'echo '\''export DOCKER_HOST="tcp://0.0.0.0:4243"'\'' >> /etc/bash.bashrc'
+source /etc/bash.bashrc
+
+sudo service docker restart
+
+# do not run this command without a vagrant reload during provisioning
+# it gives an error that docker is not up (which the reload fixes).
+# sudo docker version
diff --git a/tools/ubuntu-setup/docker.sh b/tools/ubuntu-setup/docker.sh
index 337c5cf97a..3456d6ee9b 100755
--- a/tools/ubuntu-setup/docker.sh
+++ b/tools/ubuntu-setup/docker.sh
@@ -5,13 +5,14 @@ set -x
 sudo apt-get -y install apt-transport-https ca-certificates
 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
 sudo sh -c "echo deb https://apt.dockerproject.org/repo ubuntu-trusty main  > /etc/apt/sources.list.d/docker.list"
-sudo apt-get -y update -qq
+sudo apt-get -y update
 
 sudo apt-get purge lxc-docker
 sudo apt-cache policy docker-engine
 
 # AUFS
-sudo apt-get -y install linux-image-extra-$(uname -r)
+# Use '-virtual' package to support docker tests of the script and still run under Vagrant
+sudo apt-get --no-install-recommends -y install linux-image-extra-virtual
 
 # DOCKER
 sudo apt-get install -y --force-yes docker-engine=1.12.0-0~trusty
@@ -19,7 +20,7 @@ sudo apt-mark hold docker-engine
 
 # enable (security - use 127.0.0.1)
 sudo -E bash -c 'echo '\''DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --storage-driver=aufs"'\'' >> /etc/default/docker'
-sudo gpasswd -a `whoami` docker
+sudo gpasswd -a "$(whoami)" docker
 
 # Set DOCKER_HOST as an environment variable
 sudo -E bash -c 'echo '\''export DOCKER_HOST="tcp://0.0.0.0:4243"'\'' >> /etc/bash.bashrc'
diff --git a/tools/ubuntu-setup/java8.sh b/tools/ubuntu-setup/java8.sh
index 7e2c0bfb17..00444c82a5 100755
--- a/tools/ubuntu-setup/java8.sh
+++ b/tools/ubuntu-setup/java8.sh
@@ -2,8 +2,10 @@
 set -e
 set -x
 
-sudo apt-get install -y software-properties-common
-sudo add-apt-repository -y ppa:webupd8team/java
-sudo apt-get update -y
-echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
-sudo apt-get install -y oracle-java8-installer
+if [ "$(lsb_release -cs)" == "trusty" ]; then
+    sudo apt-get install -y software-properties-common python-software-properties
+    sudo add-apt-repository ppa:jonathonf/openjdk
+    sudo apt-get update
+fi
+
+sudo apt-get install openjdk-8-jdk -y
diff --git a/tools/ubuntu-setup/misc.sh b/tools/ubuntu-setup/misc.sh
index 7d36b2abf8..edf0f66782 100755
--- a/tools/ubuntu-setup/misc.sh
+++ b/tools/ubuntu-setup/misc.sh
@@ -4,14 +4,11 @@ set -x
 
 export DEBIAN_FRONTEND=noninteractive
 
+sudo apt-get update -y
+sudo apt-get install -y ntp git zip tzdata lsb-release
+
 echo "Etc/UTC" | sudo tee /etc/timezone
 sudo dpkg-reconfigure --frontend noninteractive tzdata
 
-sudo apt-get update -y
-sudo apt-get install -y ntp
-
 sudo service ntp restart
 sudo ntpq -c lpeer
-
-sudo apt-get -y install git
-sudo apt-get -y install zip
diff --git a/tools/ubuntu-setup/scala.sh b/tools/ubuntu-setup/scala.sh
deleted file mode 100755
index cffa7d3f2a..0000000000
--- a/tools/ubuntu-setup/scala.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-set -x
-
-wget www.scala-lang.org/files/archive/scala-2.11.8.deb -O /tmp/scala-2.11.8.deb
-sudo dpkg -i /tmp/scala-2.11.8.deb
-sudo apt-get update
-sudo apt-get install -y scala
\ No newline at end of file
diff --git a/tools/vagrant/README.md b/tools/vagrant/README.md
index e80a6d966f..e5e5b72829 100644
--- a/tools/vagrant/README.md
+++ b/tools/vagrant/README.md
@@ -1,10 +1,10 @@
 # OpenWhisk on Vagrant
 
-The following instructions were tested on Mac OS X El Capitan, Ubuntu 14.04.3 LTS and Windows.
+The following instructions were tested on Mac OS X El Capitan, Ubuntu 16.04 LTS.
 
 ## Requirements
-- Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) (tested with version 5.1.22)
-- Install [Vagrant](https://www.vagrantup.com/downloads.html) (tested with version 1.9.5)
+-   Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) (tested with version 5.2.6)
+-   Install [Vagrant](https://www.vagrantup.com/downloads.html) (tested with version 2.02)
 
 ## Setup
 
@@ -26,7 +26,8 @@ cd openwhisk/tools/vagrant
 ```
 #### Option B - Using a remote Database
 
-**Note:** Follow instructions [tools/db/README.md](../db/README.md) on how to configure the remote DB for OpenWhisk.
+**Note:** Follow instructions [tools/db/README.md](../db/README.md) on how to
+configure the remote DB for OpenWhisk.
 
 ##### Option B.1 - Setting a remote Cloudant DB
 ```
@@ -38,11 +39,19 @@ OW_DB=cloudant OW_DB_USERNAME=xxxxx OW_DB_PASSWORD=yyyyyy ./hello
 
 ```
 # Provide credentials for couchdb database with admin permissions
-OW_DB=couchdb OW_DB_USERNAME=xxxxx OW_DB_PASSWORD=yyyyyy OW_DB_PROTOCOL=http OW_DB_HOST=1.2.3.4 OW_DB_PORT=5984 ./hello
+export OW_DB=couchdb
+export OW_DB_USERNAME=<username>
+export OW_DB_PASSWORD=<password>
+export OW_DB_PROTOCOL=http
+export OW_DB_HOST=<ip_address>
+export OW_DB_PORT=5984 ./hello
 ```
 
-**Note:** Data will persist after [safe re-deploy](#safe-re-deploy-after-vm-restart), but will be destroyed if you initialze the DB.
-For more information on data store configurations see [tools/db/README.md](../db/README.md).
+**Note:**
+Data will persist after [safe re-deploy](#safe-re-deploy-after-vm-restart),
+but will be destroyed if you
+initialze the DB. For more information on data store configurations see
+[tools/db/README.md](../db/README.md).
 
 
 ### Wait for hello action output
@@ -52,28 +61,41 @@ wsk action invoke /whisk.system/utils/echo -p message hello --result
     "message": "hello"
 }
 ```
-**Tip:** The very first build may take 30 minutes or more depending on network speed.
-If there are any build failures, it might be due to network timeouts, to recover follow the manual
-process to build and deploy in [ansible/README.md](../../ansible/README.md)
+**Tip:**
+The very first build may take 30 minutes or more depending on network speed. If
+there are any build failures, it might be due to network timeouts, to recover
+follow the manual process to build and deploy in
+[ansible/README.md](../../ansible/README.md)
 
-**Tip:** By default, each `docker` command will timeout after 840 seconds (14 minutes). If you're on a really slow connection,
-this might be too short. You can modify the timeout value in [docker.gradle](../../../gradle/docker.gradle#L22) as needed.
+**Tip:**
+By default, each `docker` command will timeout after 840 seconds (14 minutes).
+If you're on a really slow connection, this might be too short. You can modify
+the timeout value in [docker.gradle](../../../gradle/docker.gradle#L22) as
 
-### Using CLI from outside the VM
-You can use the CLI from the host machine as well as from inside the virtual machine.
-The IP address of the virtual machine accessible from outside is `192.168.33.13`.
-If you start another Vagrant VM take into account that the IP address will conflict, use `vagrant suspend` before starting another VM with the same IP address.
-
-The CLI is available in `../../bin`. There you will find binaries specific to various operating systems and architectures (e.g. `../../bin/mac/amd64/wsk`).
-When using the CLI with a local deployment of OpenWhisk (which provides an insecure/self-signed SSL certificate), you must use the argument `-i` to permit an insecure HTTPS connection to OpenWhisk. This should be used for development purposes only.
-
-Call the binary directly or setup your environment variable PATH to include the location of the binary that corresponds to your environment.
 
-From your _host_, configure `wsk` to use your Vagrant-hosted OpenWhisk deployment and run the "echo" action again to test.
-The following commands assume that you have `wsk` setup correctly in your PATH.
+### Using CLI from outside the VM
+You can use the CLI from the host machine as well as from inside the virtual
+machine. The IP address of the virtual machine accessible from outside is
+`192.168.33.16`. If you start another Vagrant VM take into account that the IP
+address will conflict, use `vagrant suspend` before starting another VM with the
+same IP address.
+
+The CLI is available in `../../bin`. There you will find binaries specific to
+various operating systems and architectures (e.g. `../../bin/mac/amd64/wsk`).
+When using the CLI with a local deployment of OpenWhisk (which provides an
+insecure/self-signed SSL certificate), you must use the argument `-i` to permit
+an insecure HTTPS connection to OpenWhisk. This should be used for development
+purposes only.
+
+Call the binary directly or setup your environment variable PATH to include the
+location of the binary that corresponds to your environment.
+
+From your _host_, configure `wsk` to use your Vagrant-hosted OpenWhisk
+deployment and run the "echo" action again to test. The following commands
+assume that you have `wsk` setup correctly in your PATH.
 ```
 # Set your OpenWhisk Authorization Key.
-wsk property set --apihost 192.168.33.13 --auth `vagrant ssh -- cat openwhisk/ansible/files/auth.guest`
+wsk property set --apihost 192.168.33.16 --auth `vagrant ssh -- cat openwhisk/ansible/files/auth.guest`
 
 # Run the hello sample action
 wsk -i action invoke /whisk.system/utils/echo -p message hello --result
@@ -82,19 +104,29 @@ wsk -i action invoke /whisk.system/utils/echo -p message hello --result
 }
 ```
 
-**Tip:** You need to use the `-i` switch as the default SSL certificate used by the Vagrant installation is self-signed. Alternatively, you can configure your __apihost__ to use the non-SSL interface:
+**Tip:**
+You need to use the `-i` switch as the default SSL certificate used by the
+Vagrant installation is self-signed. Alternatively, you can configure your
+_apihost_ to use the non-SSL interface:
 
 ```
-wsk property set --apihost http://192.168.33.13:10001 --auth `vagrant ssh -- cat openwhisk/ansible/files/auth.guest`
+wsk property set --apihost http://192.168.33.16:10001 --auth `vagrant ssh -- cat openwhisk/ansible/files/auth.guest`
 ```
 
-You do not need to use the `-i` switch to `wsk` now. Note, however, that `wsk sdk` will not work, so you need to pass use `wsk -i --apihost 192.168.33.13  sdk {command}` in this case.
+You do not need to use the `-i` switch to `wsk` now. Note, however, that `wsk
+sdk` will not work, so you need to pass use `wsk -i --apihost 192.168.33.16  sdk
+{command}` in this case.
 
 
-**Note:** To connect to a different host API (i.e. bluemix.net) with the CLI, you will need to configure the CLI with new values for __apihost__, and __auth__ key.
+**Note:**
+To connect to a different host API (i.e. bluemix.net) with the CLI, you will
+need to configure the CLI with new values for _apihost_, and _auth_ key.
 
 ### Use the wsk CLI inside the VM
-For your convenience, a `wsk` wrapper is provided inside the VM which delegates CLI commands to `$OPENWHISK_HOME/bin/linux/amd64/wsk` and adds the `-i` parameter that is required for insecure access to the local OpenWhisk deployment.
+For your convenience, a `wsk` wrapper is provided inside the VM which delegates
+CLI commands to `$OPENWHISK_HOME/bin/linux/amd64/wsk` and adds the `-i`
+parameter that is required for insecure access to the local OpenWhisk
+deployment.
 
 Calling the wsk CLI via `vagrant ssh` directly
 ```
@@ -117,7 +149,9 @@ cd ${OPENWHISK_HOME}
 ```
 
 ## Building OpenWhisk
-Use gradle to build docker images from inside the VM, this is done automatically once at VM creation.
+Use gradle to build docker images from inside the VM, this is done automatically
+once at VM creation.
+
 ```
 vagrant ssh
 cd ${OPENWHISK_HOME}
@@ -126,7 +160,9 @@ cd ${OPENWHISK_HOME}
 
 ## Safe Re-deploy (after VM restart)
 
-If you restart the VM (e.g., `vagrant reload`), it may be necessary to refresh the OpenWhisk deployment. You can do this in a way that does not reload the data store container.
+If you restart the VM (e.g., `vagrant reload`), it may be necessary to refresh
+the OpenWhisk deployment. You can do this in a way that does not reload the data
+store container.
 
 ```
 vagrant ssh
@@ -137,11 +173,14 @@ ansible-playbook -i environments/local openwhisk.yml -e mode=clean
 ansible-playbook -i environments/local openwhisk.yml
 ```
 
-The following commands are helpful to deploy a fresh OpenWhisk and data store after booting a new VM using `vagrant up`.
+The following commands are helpful to deploy a fresh OpenWhisk and data store
+after booting a new VM using `vagrant up`.
 
 ### Teardown and Deploy (refresh the data store)
 Use ansible to re-deploy OpenWhisk from inside the VM
-To deploy a new code base you need to [re-build OpenWhisk](#build-openwhisk) first
+To deploy a new code base you need to [re-build OpenWhisk](#build-openwhisk)
+first
+
 ```
 vagrant ssh
 cd ${ANSIBLE_HOME}
@@ -159,38 +198,52 @@ ansible-playbook -i environments/local openwhisk.yml
 ansible-playbook -i environments/local postdeploy.yml
 ```
 
-**Tip** Do not restart the VM using Virtual Box tools, and always use `vagrant` from the command line: `vagrant up` to start the VM and `vagrant reload` to restart it. This allows the `$HOME/openwhisk` folder to be available inside the VM.
+**Tip**
+Do not restart the VM using Virtual Box tools, and always use `vagrant` from the
+command line: `vagrant up` to start the VM and `vagrant reload` to restart it.
+This allows the `$HOME/openwhisk` folder to be available inside the VM.
 
 **Tip** If you have problems with data stores check that `ansible/db_local.ini`.
 
-**Tip** To initialize the data store from scratch run `ansible-playbook -i environments/local initdb.yml` inside the VM as described in [ansible setup](../../../ansible/README.md).
-
-Once deployed, several Docker containers will be running in your virtual machine.
-You can check that containers are running by using the docker cli with the command `vagrant ssh -- docker ps`.
+**Tip**
+To initialize the data store from scratch run `ansible-playbook -i
+environments/local initdb.yml` inside the VM as described in
+[ansible setup](../../../ansible/README.md).
 
+Once deployed, several Docker containers will be running in your virtual
+machine. You can check that containers are running by using the docker cli with
+the command `vagrant ssh -- docker ps`.
 
 ## Adding OpenWhisk users (Optional)
 
-An OpenWhisk user, also known as a *subject*, requires a valid authorization key.
-OpenWhisk is preconfigured with a guest key located in `ansible/files/auth.guest`.
+An OpenWhisk user, also known as a _subject_, requires a valid authorization
+key. OpenWhisk is preconfigured with a guest key located in
+`ansible/files/auth.guest`.
 
-You may use this key if you like, or use [`wskadmin`](../admin) inside the VM to create a new key.
+You may use this key if you like, or use [`wskadmin`](../admin) inside the VM to
+create a new key.
 
 ```
 vagrant ssh
 wskadmin user create <subject>
 ```
 
-This command will create a new *subject* with the authorization key shown on the console once you run `wskadmin`. This key is required when making API calls to OpenWhisk, or when using the command line interface (CLI). The namespace is the same as the `<subject>` name used to create the key.
+This command will create a new _subject_ with the authorization key shown on the
+console once you run `wskadmin`. This key is required when making API calls to
+OpenWhisk, or when using the command line interface (CLI). The namespace is the
+same as the `<subject>` name used to create the key.
 
-A namespace allows two or more subjects to share resources. Each subject will have their own authorization key to work with resources in a namespace, but will have equal rights to the namespace.
+A namespace allows two or more subjects to share resources. Each subject will
+have their own authorization key to work with resources in a namespace, but will
+have equal rights to the namespace.
 
 ```
 vagrant ssh
 wskadmin user create <subject> -ns <namespace>
 ```
 
-The same tool may be used to remove a subject from a namespace or to delete a subject entirely.
+The same tool may be used to remove a subject from a namespace or to delete a
+subject entirely.
 
 ```
 vagrant ssh
@@ -200,8 +253,10 @@ wskadmin user delete <subject>                   # deletes <subject>
 
 ## SSL certificate configuration (Optional)
 
-OpenWhisk includes a _self-signed_ SSL certificate and the `wsk` CLI allows untrusted certificates via `-i` on the command line.
-The certificate is generated during setup and stored in `ansible/roles/nginx/files/openwhisk-cert.pem`.
+OpenWhisk includes a _self-signed_ SSL certificate and the `wsk` CLI allows
+untrusted certificates via `-i` on the command line. The certificate is
+generated during setup and stored in
+`ansible/roles/nginx/files/openwhisk-cert.pem`.
 
 Do not use these certificates in production: replace with your own and modify
 the configuration to use trusted certificates instead.
@@ -221,14 +276,21 @@ the configuration to use trusted certificates instead.
   vagrant ssh -- wsk -h
   vagrant ssh -- wsk <command> -h
 ```
-**Tip**: Don't use `vagrant resume`. See [here](https://github.com/mitchellh/vagrant/issues/6787) for related issue.
+**Tip**:
+Don't use `vagrant resume`. See
+[here](https://github.com/mitchellh/vagrant/issues/6787) for related issue.
 
 ## Using Vagrant VM in GUI mode (Optional)
-Create VM with Desktop GUI. The `username` and `password` are both set to `vagrant` by default.
+Create VM with Desktop GUI. The `username` and `password` are both set to
+`vagrant` by default.
+
 ```
   gui=true ./hello
   gui=true vagrant reload
 ```
-**Tip**: Ignore error message `Sub-process /usr/bin/dpkg returned an error code (1)` when
-creating Vagrant VM using `gui-true`. Remember to use `gui=true` every time you do `vagrant reload`.
-Or, you can enable the GUI directly by editing the Vagrant file.
+
+**Tip**:
+Ignore error message `Sub-process /usr/bin/dpkg returned an error code (1)` when
+creating Vagrant VM using `gui-true`. Remember to use `gui=true` every time you
+do `vagrant reload`. Or, you can enable the GUI directly by editing the Vagrant
+file.
diff --git a/tools/vagrant/Vagrantfile b/tools/vagrant/Vagrantfile
index 7d1ef88e28..d1da5af11a 100644
--- a/tools/vagrant/Vagrantfile
+++ b/tools/vagrant/Vagrantfile
@@ -8,10 +8,10 @@
 # Don't use vagrant resume, it will run the provisioning a second producing errors
 # Use vagrant suspend and vagrant up (using up it skips provisioning)
 
-BOX = "ubuntu/trusty64"
+BOX = "ubuntu/xenial64"
 BOX_MEMORY = ENV['BOX_MEMORY'] || '4096'
 BOX_CPUS = ENV['BOX_CPUS'] || '4'
-MACHINE_IP = ENV['MACHINE_IP'] || '192.168.33.13'
+MACHINE_IP = ENV['MACHINE_IP'] || '192.168.33.16'
 OW_DB = if ENV['OW_DB'] =~ (/^(cloudant|couchdb)$/i) then true else false end
 
 Vagrant.configure('2') do |config|
@@ -23,151 +23,135 @@ Vagrant.configure('2') do |config|
   config.ssh.forward_agent = true
 
   config.vm.provider :virtualbox do |vb|
-    vb.name = "whisk-" + Time.now.strftime("%y%m%d%H%M")
+    vb.name = 'whisk-' + Time.now.strftime('%y%m%d%H%M')
     vb.gui = ENV['gui'] || false
     vb.cpus = BOX_CPUS
     vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
-    vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
+    vb.customize ['modifyvm', :id, '--natdnsproxy1', 'off']
     vb.customize ['modifyvm', :id, '--ostype', 'Ubuntu_64']
     vb.customize ['modifyvm', :id, '--memory', BOX_MEMORY]
+    vb.customize ['modifyvm', :id, '--uartmode1', 'disconnected' ]
   end
 
   # Shared root of repository; do not use symlinks
   config.vm.synced_folder File.expand_path('..', File.expand_path('..', Dir.pwd)), '/home/vagrant/openwhisk'
 
   # Prevents "stdin: is not a tty" on Ubuntu (https://github.com/mitchellh/vagrant/issues/1673)
-  config.vm.provision "fix-no-tty", type: "shell" do |s|
+  config.vm.provision 'fix-no-tty', type: 'shell' do |s|
     s.privileged = false
     s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
   end
 
   # Install Software
-$script_common = <<SCRIPT
-  set -e
-  set -x
-  echo "`date`: ubuntu-setup-start" >> /tmp/vagrant-times.txt
-  sudo add-apt-repository ppa:git-core/ppa
-  sudo rm -rfv /var/lib/apt/lists/* && sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list
-  sudo apt-get update
-  sudo apt-get install git -y
-  sudo apt-get install htop
-
-  # Configure swapfile
-  echo 'swapfile not found. Adding swapfile.'
-  fallocate -l 8000M /swapfile
-  chmod 600 /swapfile
-  mkswap /swapfile
-  swapon /swapfile
-  echo '/swapfile none swap defaults 0 0' >> /etc/fstab
-
-  HOME=/home/vagrant
-  OPENWHISK_HOME=${HOME}/openwhisk
-  OPENWHISK_TMP_DIR=${HOME}/.openwhisk/ansible/tmp
-  ANSIBLE_HOME=${OPENWHISK_HOME}/ansible
-  ANSIBLE_REMOTE_TEMP=${ANSIBLE_HOME}/tmp
-  # Add Global environments variables
-  # Set remote tmp dir for ansible to fix shared folder problems on Windows
-  echo ANSIBLE_HOME=${ANSIBLE_HOME} >> /etc/environment
-  echo ANSIBLE_REMOTE_TEMP=${ANSIBLE_REMOTE_TEMP} >> /etc/environment
-  echo OPENWHISK_HOME=${OPENWHISK_HOME} >> /etc/environment
-  echo OPENWHISK_TMP_DIR=${OPENWHISK_TMP_DIR} >> /etc/environment
-  echo PATH=${PATH}:${HOME}/bin:${OPENWHISK_HOME}/tools/build >> /etc/environment
-
-  cd /home/vagrant/openwhisk
-  cd tools/ubuntu-setup
-  su vagrant -c 'source all.sh'
-  echo "`date`: ubuntu-setup-end" >> /tmp/vagrant-times.txt
-SCRIPT
-
-  config.vm.provision "script_common", type: "shell", keep_color: true, inline: $script_common
+  config.vm.provision "script_common", type: "shell", keep_color: true, inline: <<-SCRIPT
+      set -e
+      set -x
+      echo "`date`: ubuntu-setup-start" >> /tmp/vagrant-times.txt
+      sudo add-apt-repository ppa:git-core/ppa
+      sudo rm -rfv /var/lib/apt/lists/* && sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list
+      printf 'APT::Install-Recommends "1";\nAPT::Install-Suggests "0";\n' | \
+        sudo tee /etc/apt/apt.conf.d/99no-recommends
+      sudo apt-get update
+      sudo apt-get install git swapspace -y
+
+      HOME=/home/vagrant
+      OPENWHISK_HOME=${HOME}/openwhisk
+      OPENWHISK_TMP_DIR=${HOME}/.openwhisk/ansible/tmp
+      ANSIBLE_HOME=${OPENWHISK_HOME}/ansible
+      ANSIBLE_REMOTE_TEMP=${ANSIBLE_HOME}/tmp
+      # Add Global environments variables
+      # Set remote tmp dir for ansible to fix shared folder problems on Windows
+      echo ANSIBLE_HOME=${ANSIBLE_HOME} >> /etc/environment
+      echo ANSIBLE_REMOTE_TEMP=${ANSIBLE_REMOTE_TEMP} >> /etc/environment
+      echo OPENWHISK_HOME=${OPENWHISK_HOME} >> /etc/environment
+      echo OPENWHISK_TMP_DIR=${OPENWHISK_TMP_DIR} >> /etc/environment
+      echo PATH=${PATH}:${HOME}/bin:${OPENWHISK_HOME}/tools/build >> /etc/environment
+
+      cd /home/vagrant/openwhisk
+      cd tools/ubuntu-setup
+      su vagrant -c 'source all.sh'
+      echo "`date`: ubuntu-setup-end" >> /tmp/vagrant-times.txt
+    SCRIPT
 
   # Configure Custom Database
-$script_db = <<SCRIPT
-export ANSIBLE_REMOTE_TEMP=/home/vagrant/openwhisk/ansible/tmp
-export OW_DB=#{ENV['OW_DB']}
-export OW_DB_USERNAME=#{ENV['OW_DB_USERNAME']}
-export OW_DB_PASSWORD=#{ENV['OW_DB_PASSWORD']}
-if [[ $OW_DB == "cloudant" ]]; then
-  export OW_DB="Cloudant"
-  export OW_DB_PROTOCOL="https"
-  export OW_DB_HOST="$OW_DB_USERNAME.cloudant.com"
-  export OW_DB_PORT="443"
-else
-  export OW_DB="CouchDB"
-  export OW_DB_PROTOCOL=#{ENV['OW_DB_PROTOCOL']}
-  export OW_DB_HOST=#{ENV['OW_DB_HOST']}
-  export OW_DB_PORT=#{ENV['OW_DB_PORT']}
-fi
-
-cd /home/vagrant/openwhisk/ansible
-su vagrant -c 'ansible-playbook -i environments/local setup.yml'
-su vagrant -c 'ansible-playbook -i environments/local prereq.yml'
-SCRIPT
-
-  # Configure Default CouchDB
-$couch_db = <<COUCH_DB
-echo "`date`: couchdb-setup-start" >> /tmp/vagrant-times.txt
-export ANSIBLE_REMOTE_TEMP=/home/vagrant/openwhisk/ansible/tmp
-cd /home/vagrant/openwhisk/ansible
-su vagrant -c 'ansible-playbook -i environments/local setup.yml'
-su vagrant -c 'ansible-playbook -i environments/local prereq.yml'
-su vagrant -c 'ansible-playbook -i environments/local couchdb.yml'
-echo "`date`: couchdb-setup-end" >> /tmp/vagrant-times.txt
-COUCH_DB
-
-$init_db = <<INIT_DB
-export ANSIBLE_REMOTE_TEMP=/home/vagrant/openwhisk/ansible/tmp
-cd /home/vagrant/openwhisk/ansible
-su vagrant -c 'ansible-playbook -i environments/local initdb.yml'
-INIT_DB
-
-  if OW_DB
-    config.vm.provision "script_db", type: "shell", keep_color: true, inline: $script_db
-  else
-    config.vm.provision "start_couch", type: "shell", keep_color: true, inline: $couch_db
+  if OW_DB then config.vm.provision "script_db", type: "shell", keep_color: true, inline: <<-SCRIPT
+        export ANSIBLE_REMOTE_TEMP=/home/vagrant/openwhisk/ansible/tmp
+        export OW_DB=#{ENV['OW_DB']}
+        export OW_DB_USERNAME=#{ENV['OW_DB_USERNAME']}
+        export OW_DB_PASSWORD=#{ENV['OW_DB_PASSWORD']}
+        if [[ $OW_DB == "cloudant" ]]; then
+          export OW_DB="Cloudant"
+          export OW_DB_PROTOCOL="https"
+          export OW_DB_HOST="$OW_DB_USERNAME.cloudant.com"
+          export OW_DB_PORT="443"
+        else
+          export OW_DB="CouchDB"
+          export OW_DB_PROTOCOL=#{ENV['OW_DB_PROTOCOL']}
+          export OW_DB_HOST=#{ENV['OW_DB_HOST']}
+          export OW_DB_PORT=#{ENV['OW_DB_PORT']}
+        fi
+
+        cd /home/vagrant/openwhisk/ansible
+        su vagrant -c 'ansible-playbook -i environments/local setup.yml'
+        su vagrant -c 'ansible-playbook -i environments/local prereq.yml'
+    SCRIPT
   end
-  config.vm.provision "initdb", type: "shell", keep_color: true, inline: $init_db
+
+  unless OW_DB then config.vm.provision "start_couch", type: "shell", keep_color: true, inline: <<-COUCHDB
+        echo "`date`: couchdb-setup-start" >> /tmp/vagrant-times.txt
+        export ANSIBLE_REMOTE_TEMP=/home/vagrant/openwhisk/ansible/tmp
+        cd /home/vagrant/openwhisk/ansible
+        su vagrant -c 'ansible-playbook -i environments/local setup.yml'
+        su vagrant -c 'ansible-playbook -i environments/local prereq.yml'
+        su vagrant -c 'ansible-playbook -i environments/local couchdb.yml'
+        echo "`date`: couchdb-setup-end" >> /tmp/vagrant-times.txt
+    COUCHDB
+  end
+
+  config.vm.provision "initdb", type: "shell", keep_color: true, inline: <<-INITDB
+      export ANSIBLE_REMOTE_TEMP=/home/vagrant/openwhisk/ansible/tmp
+      cd /home/vagrant/openwhisk/ansible
+      su vagrant -c 'ansible-playbook -i environments/local initdb.yml'
+  INITDB
 
   # Build and Deploy
-$script_end = <<SCRIPT
-  set -e
-  set -x
-  echo "`date`: build-start" >> /tmp/vagrant-times.txt
-  HOME=/home/vagrant
-  source /etc/environment
-  # Build OpenWhisk using gradle
-  cd ${OPENWHISK_HOME}
-  su vagrant -c './gradlew  distDocker'
-
-  echo "`date`: deploy-start" >> /tmp/vagrant-times.txt
-  # Deploy OpenWhisk using ansible
-  cd ${ANSIBLE_HOME}
-  su vagrant -c 'ansible-playbook -i environments/local wipe.yml'
-  su vagrant -c 'ansible-playbook -i environments/local apigateway.yml'
-  su vagrant -c 'ansible-playbook -i environments/local openwhisk.yml'
-  su vagrant -c 'ansible-playbook -i environments/local postdeploy.yml'
-
-  # Setup OpenWhisk CLI
-  su vagrant -c 'mkdir ${HOME}/bin'
-  su vagrant -c 'ln -s ${OPENWHISK_HOME}/tools/admin/wskadmin ${HOME}/bin/wskadmin'
-  su vagrant -c 'ln -s ${OPENWHISK_HOME}/tools/build/redo ${HOME}/bin/wskdev'
-  echo ${OPENWHISK_HOME}/bin/wsk -i '"$@"' > ${HOME}/bin/wsk
-  chmod +x ${HOME}/bin/wsk
-  chown vagrant:vagrant ${HOME}/bin/wsk
-  PATH=${PATH}:${HOME}/bin
-  echo 'eval "`wsk sdk install bashauto --stdout`"'>>${HOME}/.bashrc
-
-  # Run OpenWhisk CLI
-  touch $HOME/.wskprops
-  chown -R vagrant:vagrant $HOME
-  # This allows user to see how to configure the wsk cli outside the VM
-  wsk property set --apihost ${WHISK_IP} --auth `cat ${ANSIBLE_HOME}/files/auth.guest`
-  echo "Swagger UI URL: https://${WHISK_IP}/api/v1/docs/index.html?url=/api/v1/api-docs"
-  wsk action invoke /whisk.system/utils/echo -p message hello --result
-  echo "`date`: build-deploy-end" >> /tmp/vagrant-times.txt
-SCRIPT
-
-  config.vm.provision "script_end", type: "shell", keep_color: true, inline: $script_end, env: {"WHISK_IP" => MACHINE_IP}
+  config.vm.provision "script_end", type: "shell", keep_color: true, inline: <<-SCRIPT, env: {"WHISK_IP" => MACHINE_IP}
+    set -e
+    set -x
+    echo "`date`: build-start" >> /tmp/vagrant-times.txt
+    HOME=/home/vagrant
+    source /etc/environment
+    # Build OpenWhisk using gradle
+    cd ${OPENWHISK_HOME}
+    su vagrant -c './gradlew  distDocker'
+
+    echo "`date`: deploy-start" >> /tmp/vagrant-times.txt
+    # Deploy OpenWhisk using ansible
+    cd ${ANSIBLE_HOME}
+    su vagrant -c 'ansible-playbook -i environments/local wipe.yml'
+    su vagrant -c 'ansible-playbook -i environments/local apigateway.yml'
+    su vagrant -c 'ansible-playbook -i environments/local openwhisk.yml'
+    su vagrant -c 'ansible-playbook -i environments/local postdeploy.yml'
+
+    # Setup OpenWhisk CLI
+    su vagrant -c 'mkdir ${HOME}/bin'
+    su vagrant -c 'ln -s ${OPENWHISK_HOME}/tools/admin/wskadmin ${HOME}/bin/wskadmin'
+    su vagrant -c 'ln -s ${OPENWHISK_HOME}/tools/build/redo ${HOME}/bin/wskdev'
+    echo ${OPENWHISK_HOME}/bin/wsk -i '"$@"' > ${HOME}/bin/wsk
+    chmod +x ${HOME}/bin/wsk
+    chown vagrant:vagrant ${HOME}/bin/wsk
+    PATH=${PATH}:${HOME}/bin
+    echo 'eval "`wsk sdk install bashauto --stdout`"'>>${HOME}/.bashrc
+
+    # Run OpenWhisk CLI
+    touch $HOME/.wskprops
+    chown -R vagrant:vagrant $HOME
+    # This allows user to see how to configure the wsk cli outside the VM
+    wsk property set --apihost ${WHISK_IP} --auth `cat ${ANSIBLE_HOME}/files/auth.guest`
+    echo "Swagger UI URL: https://${WHISK_IP}/api/v1/docs/index.html?url=/api/v1/api-docs"
+    wsk action invoke /whisk.system/utils/echo -p message hello --result
+    echo "`date`: build-deploy-end" >> /tmp/vagrant-times.txt
+  SCRIPT
 
   if ENV['gui'] == 'true'
     # Install ubuntu-desktop and virtualbox additions


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services