From f418c251107c987ab422590ed7d7a26489bc828b Mon Sep 17 00:00:00 2001 From: rodric rabbah Date: Thu, 9 Jan 2020 11:20:17 -0500 Subject: [PATCH] Remove Vagrant mentions. (#4779) --- .gitattributes | 1 - .github/ISSUE_TEMPLATE.md | 4 +- .gitignore | 4 - README.md | 32 --- ansible/README.md | 5 - tools/db/README.md | 6 +- tools/ubuntu-setup/docker-xenial.sh | 4 - tools/ubuntu-setup/docker.sh | 7 +- tools/vagrant/README.md | 320 ---------------------------- tools/vagrant/Vagrantfile | 199 ----------------- tools/vagrant/hello.cmd | 24 --- tools/vagrant/hello.sh | 26 --- 12 files changed, 5 insertions(+), 627 deletions(-) delete mode 100644 tools/vagrant/README.md delete mode 100644 tools/vagrant/Vagrantfile delete mode 100644 tools/vagrant/hello.cmd delete mode 100755 tools/vagrant/hello.sh diff --git a/.gitattributes b/.gitattributes index e902326c312..be585a83b5e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -24,7 +24,6 @@ tools/cli/wsk text eol=lf tools/cli/wskadmin text eol=lf # bash files not having the .sh extension -tools/vagrant/simple/wsk text eol=lf gradlew text eol=lf core/javaAction/proxy/gradlew text eol=lf sdk/docker/client/action text eol=lf diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 00ec40db78e..33bc8e8dd37 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -24,8 +24,8 @@ You do not have to include this information if this is a feature request. ## Environment details: -* local deployment, vagrant, native ubuntu, Mac OS, Bluemix, ... -* version of docker, vagrant, ubuntu, ... +* local deployment, native ubuntu, Mac OS, Bluemix, ... +* version of docker, ubuntu, ... ## Steps to reproduce the issue: diff --git a/.gitignore b/.gitignore index da4204e04d9..fbccf480933 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ results !/ansible/environments/docker-machine !/ansible/environments/local !/ansible/environments/mac -!/ansible/environments/vagrant # Eclipse bin/ @@ -47,9 +46,6 @@ build/ # NodeJS node_modules -# Vagrant -.vagrant* - # IntelliJ .idea *.class diff --git a/README.md b/README.md index 7b433ab5d65..78fb778fcfb 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ OpenWhisk is a cloud-first distributed event-based programming service. It provi * [Quick Start](#quick-start) (Docker-Compose) * [Native development](#native-development) (Mac and Ubuntu) * [Kubernetes](#kubernetes-setup) -* [Vagrant](#vagrant-setup) * [Learn concepts and commands](#learn-concepts-and-commands) * [Issues](#issues) * [Slack](#slack) @@ -57,37 +56,6 @@ git clone https://github.com/apache/openwhisk-deploy-kube.git Then follow the instructions in the [OpenWhisk on Kubernetes README.md](https://github.com/apache/openwhisk-deploy-kube/blob/master/README.md). -### Vagrant Setup -A [Vagrant](http://vagrantup.com) machine is also available to run OpenWhisk on Mac, Windows PC or GNU/Linux but isn't used by as much of the dev team so sometimes lags behind. -Download and install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) and [Vagrant](https://www.vagrantup.com/downloads.html) for your operating system and architecture. - -**Note:** For Windows, you may need to install an ssh client in order to use the command `vagrant ssh`. Cygwin works well for this, and Git Bash comes with an ssh client you can point to. If you run the command and no ssh is installed, Vagrant will give you some options to try. - -Follow these step to run your first OpenWhisk Action: -``` -# Clone openwhisk -git clone --depth=1 https://github.com/apache/openwhisk.git openwhisk - -# Change directory to tools/vagrant -cd openwhisk/tools/vagrant - -# Run script to create vm and run hello action -./hello.sh -``` - -Wait for hello action output: -``` -wsk action invoke /whisk.system/utils/echo -p message hello --result -{ - "message": "hello" -} -``` - -These steps were tested on Mac OS X El Capitan, Ubuntu 14.04.3 LTS and Windows using Vagrant. -For more information about using OpenWhisk on Vagrant see the [tools/vagrant/README.md](tools/vagrant/README.md) - -During the Vagrant setup, the Oracle JDK 8 is used as the default Java environment. If you would like to use OpenJDK 8, please change the line "su vagrant -c 'source all.sh oracle'" into "su vagrant -c 'source all.sh'" in tools/vagrant/Vagrantfile. - ### Native development Docker must be natively installed in order to build and deploy OpenWhisk. diff --git a/ansible/README.md b/ansible/README.md index 373e3f4e715..25955e5955b 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -31,11 +31,6 @@ sudo pip install ansible==2.5.2 sudo pip install jinja2==2.9.6 ``` -#### Vagrant users -Nothing to be done, Ansible is already installed during vagrant provisioning. -You can skip setup and prereq steps as those have been done by vagrant for you. -You may jump directly to [Deploying Using CouchDB](#deploying-using-couchdb) - #### Docker for Mac users ``` sudo easy_install pip diff --git a/tools/db/README.md b/tools/db/README.md index 128b0444470..4767ff5d1e4 100644 --- a/tools/db/README.md +++ b/tools/db/README.md @@ -23,7 +23,7 @@ Before you can build and deploy OpenWhisk, you must configure a backing data sto ## Using CouchDB -If you are using your own installation of CouchDB, make a note of the host, port, username and password. Then provision a [custom Vagrant box](../vagrant/README.md) by following the instructions for a persistent CouchDB. In case you already have a Vagrant box, maybe using default settings you can simply adjust the existing db settings. Within your `openwhisk/ansible` directory, edit the file `db_local.ini` as appropriate. If you do not find `db_local.ini`, refer to [Setup](../../ansible/README.md#setup) to create it. Note that: +If you are using your own installation of CouchDB, make a note of the host, port, username and password, and adjust the properties in `openwhisk/ansible/db_local.ini` accordingly. If you do not find `db_local.ini`, refer to [Setup](../../ansible/README.md#setup) to create it. Note that: * the username must have administrative rights * the CouchDB instance must be accessible over `http` or `https` (the latter requires a valid certificate) @@ -62,9 +62,7 @@ Make note of the Cloudant `username` and `password` from the last `cf` command s ### Setting the Cloudant credentials -Provision a [custom Vagrant box](../vagrant/README.md) by following the instructions for Cloudant. - -If you already have an existing box, you can simply modify the settings in the VM. Within your `openwhisk/ansible` directory, edit the file `db_local.ini` as appropriate. +Edit the file `openwhisk/ansible/db_local.ini` to provide the required database properties. Note that: diff --git a/tools/ubuntu-setup/docker-xenial.sh b/tools/ubuntu-setup/docker-xenial.sh index fa3a3148d8c..3b0e889812d 100644 --- a/tools/ubuntu-setup/docker-xenial.sh +++ b/tools/ubuntu-setup/docker-xenial.sh @@ -52,7 +52,3 @@ sudo -E bash -c 'echo '\''DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/ sudo gpasswd -a "$(whoami)" docker 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 6a01fae0e23..702dd38e672 100755 --- a/tools/ubuntu-setup/docker.sh +++ b/tools/ubuntu-setup/docker.sh @@ -31,7 +31,7 @@ sudo add-apt-repository \ sudo apt-get -y update # AUFS -# Use '-virtual' package to support docker tests of the script and still run under Vagrant +# Use '-virtual' package to support docker tests of the script sudo apt-get --no-install-recommends -y install linux-image-extra-virtual # DOCKER @@ -42,9 +42,4 @@ sudo apt-mark hold docker-ce sudo -E bash -c 'echo '\''DOCKER_OPTS="-H unix:///var/run/docker.sock --storage-driver=aufs"'\'' >> /etc/default/docker' sudo gpasswd -a "$(whoami)" docker - 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/vagrant/README.md b/tools/vagrant/README.md deleted file mode 100644 index 1f50ae135c2..00000000000 --- a/tools/vagrant/README.md +++ /dev/null @@ -1,320 +0,0 @@ - - -# OpenWhisk on Vagrant - -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 6.0.2) -- Install [Vagrant](https://www.vagrantup.com/downloads.html) (tested with version 2.2.3) - -*There is an issue with the `ubuntu/xenial64` image (v20190118.0.0 at the time of writing this) on MacOS Mojave 10.14.2 and VirtualBox 6. This can be fixed by replacing this image with `bento/ubuntu-16.04`. See below the "Override Vagrant Box" section to find out how to use another image.* - -## Setup - -### Clone the repository and change directory to `tools/vagrant` - -``` -git clone --depth=1 https://github.com/apache/openwhisk.git openwhisk -cd openwhisk/tools/vagrant -``` - -### Create a Vagrant VM - -#### Option A: Using the default local CouchDB container -**Important** We advise that you use this method for development of OpenWhisk. - -``` -# Configure with couchdb docker container running inside the VM -./hello.sh -``` -#### 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. - -##### Option B.1 - Setting a remote Cloudant DB -``` -# Provide credentials for cloudant database with admin permissions -OW_DB=cloudant OW_DB_USERNAME=xxxxx OW_DB_PASSWORD=yyyyyy ./hello.sh -``` - -##### Option B.2 - Setting a remote CouchDB - -``` -# Provide credentials for couchdb database with admin permissions -export OW_DB=couchdb -export OW_DB_USERNAME= -export OW_DB_PASSWORD= -export OW_DB_PROTOCOL=http -export OW_DB_HOST= -export OW_DB_PORT=5984 ./hello.sh -``` - -**Note:** -Data will persist after [safe re-deploy](#safe-re-deploy-after-vm-restart), -but will be destroyed if you -initialize the DB. For more information on data store configurations see -[tools/db/README.md](../db/README.md). - - -### Wait for hello action output -``` -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:** -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). - - -### 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`. -The CLI `../../bin/wsk` is for Linux amd64. -The CLI for all other operating systems and architectures (as well as Linux) can be -downloaded in a compressed format from [https://github.com/apache/openwhisk-cli/releases](https://github.com/apache/openwhisk-cli/releases) . -For more details, please consult the relevant [documentation](https://openwhisk.apache.org/documentation.html) section "Download and -install the wsk CLI from (Linux, Mac or Windows):". - -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 (and that you are using -Powershell if your deployment is hosted in Windows). -``` -# Set your OpenWhisk Authorization Key. - -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 -{ - "message": "hello" -} -``` - -**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.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.16 sdk -{command}` in this case. - - -**Note:** -To connect to a different host API (i.e. openwhisk.example.com) 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. - -Calling the wsk CLI via `vagrant ssh` directly -``` -vagrant ssh -- wsk action invoke /whisk.system/utils/echo -p message hello --result -``` -Calling the wsk CLI by login into the Vagrant VM -``` -vagrant ssh -wsk action invoke /whisk.system/utils/echo -p message hello --result -``` - -## Running OpenWhisk tests -``` -vagrant ssh -cd ${OPENWHISK_HOME} -# run all tests -./gradlew tests:test -# or run a subset of tests using the --tests flag -./gradlew tests:test --tests system.basic.ConsoleTests -``` - -## Building OpenWhisk -Use Gradle to build docker images from inside the VM, this is done automatically -once at VM creation. - -``` -vagrant ssh -cd ${OPENWHISK_HOME} -./gradlew distDocker -``` - -## Using docker-runc -Only for experimental use: -To use docker-runc in the invoker, the version of docker-runc needs to match the version of docker engine on the host. -Get the version of the docker engine on the host like the following: -``` -$ docker version | grep Version -Version: 18.03.0-ce -``` -You need to use the same version for docker-runc in the Invoker, to use a newer version of docker-runc in the invoker, update the invoker Dockerfile. -1. compare the docker-runc version obtained on the local system against the docker-runc configured for the invoker -2. if the versions are different, only then do you need to update the invoker dockerfile to point to the matching docker download - -Edit the [core/invoker/Dockefile](../../core/invoker/Dockefile) -Update the variable with the version -``` -ENV DOCKER_VERSION 18.03.0-ce -``` -Then update line with the curl download command like -``` -RUN curl -sSL -o docker-${DOCKER_VERSION}.tgz https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz && \ -``` -Notice that the hostname where to download the CLI is different for newer versions. - -Then update the Ansible configuration to enable the use of runc, edit [](../../ansible/environments/vagrant/group_vars/all) -``` -invoker_use_runc: true -``` - -Then rebuild and redeploy the invoker component -``` -wskdev invoker -``` - -### Teardown and Deploy -The following commands are helpful to deploy a fresh OpenWhisk and data store -``` -vagrant ssh -cd ${ANSIBLE_HOME} -# teardown all containers -wskdev teardown -# deploy openwhisk containers -wskdev fresh -``` -**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` exists. - -**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`. - -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 -``` -For more information on `wskadmin` check the [documentation](../admin). - -## 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`. - -Do not use these certificates in production: replace with your own and modify -the configuration to use trusted certificates instead. - -## Misc commands -``` -# Suspend Vagrant VM when done having fun - vagrant suspend - -# Resume Vagrant VM to have fun again - vagrant up - -# Do not restart via Virtual Box, use Vagrant reload to mount $HOME/openwhisk as a shared directory - vagrant reload - -# Read the help for wsk CLI - vagrant ssh -- wsk -h - vagrant ssh -- wsk -h -``` -**Tip**: -Don't use `vagrant resume`. See -[here](https://github.com/mitchellh/vagrant/issues/6787) for related issue. - -## Override Vagrant Box -By default the Vagrant VM will use `ubuntu/xenial64` if you want to use `ubuntu/trusty64` you can override with an environment variable `BOX_OS`. -``` -BOX_OS="ubuntu/trusty64" ./hello.sh -``` - -## Using Vagrant VM in GUI mode (Optional) -Create VM with Desktop GUI. The `username` and `password` are both set to -`vagrant` by default. - -``` - gui=true ./hello.sh - 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. - -## Lean Setup -To have a lean setup (no Kafka, Zookeeper and no Invokers as separate entities) - -Set environment variable LEAN to true before creating vagrant VM -``` -export LEAN=true -``` - diff --git a/tools/vagrant/Vagrantfile b/tools/vagrant/Vagrantfile deleted file mode 100644 index ced5983506b..00000000000 --- a/tools/vagrant/Vagrantfile +++ /dev/null @@ -1,199 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Custom OpenWhisk - -# vagrant resume issue https://github.com/mitchellh/vagrant/issues/6787 -# 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 = ENV['BOX_OS'] || "ubuntu/xenial64" -BOX_MEMORY = ENV['BOX_MEMORY'] || '4096' -BOX_CPUS = ENV['BOX_CPUS'] || '4' -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| - config.vm.box = BOX - config.disksize.size = '50GB' - config.vm.network :private_network, ip: MACHINE_IP - - # If true, then any SSH connections made will enable agent forwarding. - # Default value: false - config.ssh.forward_agent = true - - config.vm.provider :virtualbox do |vb| - 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', '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| - s.privileged = false - s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile" - end - - # Install Software - 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_CLI=${OPENWHISK_HOME}/bin/openwhisk-cli - 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_CLI=${OPENWHISK_CLI} >> /etc/environment - echo OPENWHISK_TMP_DIR=${OPENWHISK_TMP_DIR} >> /etc/environment - echo PATH=${PATH}:${HOME}/bin:${OPENWHISK_HOME}/tools/build >> /etc/environment - cd ${OPENWHISK_HOME} - cd tools/ubuntu-setup - su vagrant -c 'source all.sh oracle' - echo "`date`: ubuntu-setup-end" >> /tmp/vagrant-times.txt - SCRIPT - - # Configure Custom Database - 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/vagrant setup.yml' - su vagrant -c 'ansible-playbook -i environments/vagrant prereq.yml' - SCRIPT - end - - 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/vagrant setup.yml' - su vagrant -c 'ansible-playbook -i environments/vagrant prereq.yml' - su vagrant -c 'ansible-playbook -i environments/vagrant 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/vagrant initdb.yml' - INITDB - - # Build and Deploy - config.vm.provision "script_end", type: "shell", keep_color: true, inline: <<-SCRIPT, env: {"WHISK_IP" => MACHINE_IP} - set -e - set -x - HOME=/home/vagrant - source /etc/environment - - # Build OpenWhisk using gradle - echo "`date`: build-core-start" >> /tmp/vagrant-times.txt - cd ${OPENWHISK_HOME} - su vagrant -c './gradlew distDocker' - echo "`date`: build-core-end" >> /tmp/vagrant-times.txt - - # Deploy OpenWhisk using ansible - echo "`date`: deploy-start" >> /tmp/vagrant-times.txt - cd ${ANSIBLE_HOME} - su vagrant -c 'ansible-playbook -i environments/vagrant wipe.yml' - - export LEAN=#{ENV['LEAN']} || "false" - if [[ $LEAN == "true" ]]; then - # Deploy Lean Openwhisk (consolidated controller + invoker without kafka, zookeeper etc.) - su vagrant -c 'ansible-playbook -i environments/vagrant openwhisk.yml -e invoker_use_runc=False -e controller_akka_provider=local -e lean=true' - else - # Deploy full Openwhisk stack - su vagrant -c 'ansible-playbook -i environments/vagrant openwhisk.yml -e invoker_use_runc=False' - fi - - su vagrant -c 'ansible-playbook -i environments/vagrant postdeploy.yml' - su vagrant -c 'ansible-playbook -i environments/vagrant apigateway.yml' - su vagrant -c 'ansible-playbook -i environments/vagrant routemgmt.yml' - - # Setup OpenWhisk CLI - su vagrant -c 'mkdir ${HOME}/bin' - su vagrant -c 'ln -s ${OPENWHISK_HOME}/tools/admin/wskadmin ${HOME}/bin/wskadmin' - echo ${OPENWHISK_HOME}/tools/build/redo -t vagrant '"$@"' > ${HOME}/bin/wskdev - chmod +x ${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 - config.vm.provision "shell", keep_color: true, inline: "apt-get update" - config.vm.provision "shell", keep_color: true, inline: "apt-get install -y xfce4" - config.vm.provision "shell", keep_color: true, inline: "apt-get install -y virtualbox-guest-dkms" - config.vm.provision "shell", keep_color: true, inline: "apt-get install -y virtualbox-guest-utils" - config.vm.provision "shell", keep_color: true, inline: "apt-get install -y virtualbox-guest-x11" - config.vm.provision "shell", keep_color: true, inline: "touch /etc/X11/Xwrapper.config" - config.vm.provision "shell", keep_color: true, inline: "sed -i 's/allowed_users=.*$/allowed_users=anybody/' /etc/X11/Xwrapper.config" - #the ; true is used to ignore errors from ubuntu-desktop, vagrant reload should be done after provisioning - config.vm.provision "shell", keep_color: true, inline: "sudo sh -c 'apt-get install -y ubuntu-desktop ; true'" - end - -end diff --git a/tools/vagrant/hello.cmd b/tools/vagrant/hello.cmd deleted file mode 100644 index e00378b8264..00000000000 --- a/tools/vagrant/hello.cmd +++ /dev/null @@ -1,24 +0,0 @@ -@ -@ Licensed to the Apache Software Foundation (ASF) under one or more -@ contributor license agreements. See the NOTICE file distributed with -@ this work for additional information regarding copyright ownership. -@ The ASF licenses this file to You under the Apache License, Version 2.0 -@ (the "License"); you may not use this file except in compliance with -@ the License. You may obtain a copy of the License at -@ -@ http://www.apache.org/licenses/LICENSE-2.0 -@ -@ Unless required by applicable law or agreed to in writing, software -@ distributed under the License is distributed on an "AS IS" BASIS, -@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@ See the License for the specific language governing permissions and -@ limitations under the License. -@ - -@REM Start with a new VM -IF NOT EXIST .vagrant\ GOTO SKIPDESTROY -vagrant destroy -:SKIPDESTROY - -vagrant plugin install vagrant-disksize -vagrant up diff --git a/tools/vagrant/hello.sh b/tools/vagrant/hello.sh deleted file mode 100755 index 0edda1c7449..00000000000 --- a/tools/vagrant/hello.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Start with a new VM -if [ -d ".vagrant" ]; then - vagrant destroy -fi - -vagrant plugin install vagrant-disksize -vagrant up