You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by md...@apache.org on 2018/08/09 14:08:57 UTC

[incubator-openwhisk] branch master updated: Separate routemgmt.yml out from openwhisk.yml playbook (#3760)

This is an automated email from the ASF dual-hosted git repository.

mdeuser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 9ae7a84  Separate routemgmt.yml out from  openwhisk.yml playbook (#3760)
9ae7a84 is described below

commit 9ae7a848f14a86add3c99cfc8ff9894de2cd9e23
Author: rodric rabbah <ro...@gmail.com>
AuthorDate: Thu Aug 9 10:08:54 2018 -0400

    Separate routemgmt.yml out from  openwhisk.yml playbook (#3760)
    
    * Seperate route management package for API gateway from openwhisk.yml.
    
    Update documentation for deployment.
    Add API gateway to redo.
    
    * Install routemgmt package when running API gateway playbook.
    
    The routemgmt playbook remains its own independent playbook so that it may be installed seperately when necessary.
    
    * Revert "Install routemgmt package when running API gateway playbook."
    
    This reverts commit ae278f6a9cf3d0301d0acca098c5e12f9fb383ea.
    
    * Fix Ruby example to use puts, adding a new line.
---
 ansible/README.md                                  | 45 +++++++++++++---------
 ansible/README_DISTRIBUTED.md                      |  6 +++
 ansible/{routemgmt.yml => downloadcli.yml}         |  5 +--
 ansible/openwhisk.yml                              |  7 ++--
 ansible/roles/cli-install/tasks/clean.yml          |  2 +-
 ansible/roles/cli-install/tasks/deploy.yml         |  4 +-
 ansible/roles/couchdb/tasks/deploy.yml             |  2 +-
 ansible/roles/routemgmt/files/installRouteMgmt.sh  |  6 ++-
 .../roles/routemgmt/files/uninstallRouteMgmt.sh    |  8 +++-
 ansible/routemgmt.yml                              |  3 --
 tools/build/redo                                   | 11 ++++++
 tools/travis/setupSystem.sh                        |  3 +-
 tools/vagrant/Vagrantfile                          |  3 +-
 13 files changed, 68 insertions(+), 37 deletions(-)

diff --git a/ansible/README.md b/ansible/README.md
index 04cf9ff..d9e4a87 100644
--- a/ansible/README.md
+++ b/ansible/README.md
@@ -150,27 +150,31 @@ cd ansible
 ansible-playbook -i environments/<environment> couchdb.yml
 ansible-playbook -i environments/<environment> initdb.yml
 ansible-playbook -i environments/<environment> wipe.yml
-ansible-playbook -i environments/<environment> apigateway.yml
 ansible-playbook -i environments/<environment> openwhisk.yml
+
+# installs a catalog of public packages and actions
 ansible-playbook -i environments/<environment> postdeploy.yml
+
+# to use the API gateway
+ansible-playbook -i environments/<environment> apigateway.yml
+ansible-playbook -i environments/<environment> routemgmt.yml
 ```
 
-You need to run `initdb.yml` **every time** you do a fresh deploy CouchDB to initialize the subjects database.
-The playbooks `wipe.yml` and `postdeploy.yml` should be run on a fresh deployment only, otherwise all transient
-data that include actions and activations are lost.
+- You need to run `initdb.yml` **every time** you do a fresh deploy CouchDB to initialize the subjects database.
+- The `wipe.yml` playbook should be run on a fresh deployment only, otherwise actions and activations will be lost.
+- Run `postdeploy.yml` after deployment to install a catalog of useful packages.
+- To use the API Gateway, you'll need to run `apigateway.yml` and `routemgmt.yml`.
+- Use `ansible-playbook -i environments/<environment> openwhisk.yml` to avoid wiping the data store. This is useful to start OpenWhisk after restarting your Operating System.
 
 #### Limitation
 
-You can not run multiple CouchDB nodes on a single machine.
-This limitation comes from Erlang EPMD.
-When CouchDB forms a cluster, it counts on EPMD to find other nodes.
-If we want to run multiple nodes on a single machine, we must differentiate EPMD port(`4369`) for each nodes. But if this port is different on each nodes, they cannot find each other.
-So if you want to deploy multiple CouchDB nodes, all nodes should be placed on different machines respectively.
+You cannot run multiple CouchDB nodes on a single machine. This limitation comes from Erlang EPMD which CouchDB relies on to find other nodes.
+To deploy multiple CouchDB nodes, they should be placed on different machines respectively otherwise their ports will clash.
 
 
 ### Deploying Using Cloudant
--   Make sure your `db_local.ini` file is set up for Cloudant. See [Setup](#setup)
--   Then execute
+-   Make sure your `db_local.ini` file is set up for Cloudant. See [Setup](#setup).
+-   Then execute:
 
 ```
 cd <openwhisk_home>
@@ -180,16 +184,21 @@ ansible-playbook -i environments/<environment> initdb.yml
 ansible-playbook -i environments/<environment> wipe.yml
 ansible-playbook -i environments/<environment> apigateway.yml
 ansible-playbook -i environments/<environment> openwhisk.yml
-ansible-playbook -i environments/<environment> postdeploy.yml
-```
 
-You need to run `initdb` on Cloudant **only once** per Cloudant database to initialize the subjects database.
-The `initdb.yml` playbook will only initialize your database if it is not initialized already, else it will skip initialization steps.
+# installs a catalog of public packages and actions
+ansible-playbook -i environments/<environment> postdeploy.yml
 
-The playbooks `wipe.yml` and `postdeploy.yml` should be run on a fresh deployment only, otherwise all transient
-data that include actions and activations are lost.
+# to use the API gateway
+ansible-playbook -i environments/<environment> apigateway.yml
+ansible-playbook -i environments/<environment> routemgmt.yml
+```
 
-Use `ansible-playbook -i environments/<environment> openwhisk.yml` to avoid wiping the data store. This is useful to start OpenWhisk after restarting your Operating System.
+- You need to run `initdb` on Cloudant **only once** per Cloudant database to initialize the subjects database.
+- The `initdb.yml` playbook will only initialize your database if it is not initialized already, else it will skip initialization steps.
+- The `wipe.yml` playbook should be run on a fresh deployment only, otherwise actions and activations will be lost.
+- Run `postdeploy.yml` after deployment to install a catalog of useful packages.
+- To use the API Gateway, you'll need to run `apigateway.yml` and `routemgmt.yml`.
+- Use `ansible-playbook -i environments/<environment> openwhisk.yml` to avoid wiping the data store. This is useful to start OpenWhisk after restarting your Operating System.
 
 ### Configuring the installation of `wsk` CLI
 There are two installation modes to install `wsk` CLI: remote and local.
diff --git a/ansible/README_DISTRIBUTED.md b/ansible/README_DISTRIBUTED.md
index 2aa408e..3b859ad 100644
--- a/ansible/README_DISTRIBUTED.md
+++ b/ansible/README_DISTRIBUTED.md
@@ -85,7 +85,13 @@ ansible-playbook -i environments/<environment> couchdb.yml
 ansible-playbook -i environments/<environment> initdb.yml
 ansible-playbook -i environments/<environment> wipe.yml
 ansible-playbook -i environments/<environment> openwhisk.yml
+
+# installs a catalog of public packages and actions
 ansible-playbook -i environments/<environment> postdeploy.yml
+
+# to use the API gateway
+ansible-playbook -i environments/<environment> apigateway.yml
+ansible-playbook -i environments/<environment> routemgmt.yml
 ```
 
 Setup your CLI and verify that OpenWhisk is working.
diff --git a/ansible/routemgmt.yml b/ansible/downloadcli.yml
similarity index 61%
copy from ansible/routemgmt.yml
copy to ansible/downloadcli.yml
index 4c99436..4e2679c 100644
--- a/ansible/routemgmt.yml
+++ b/ansible/downloadcli.yml
@@ -1,11 +1,8 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor
 # license agreements; and to You under the Apache License, Version 2.0.
 ---
-# This playbook deploys the Openwhisk API Gateway route management actions.
-
-- import_playbook: properties.yml
+# This playbook downloads the Openwhisk cli aka wsk from the API host.
 
 - hosts: ansible
   roles:
   - cli-install
-  - routemgmt
diff --git a/ansible/openwhisk.yml b/ansible/openwhisk.yml
index 41f433b..11111e1 100644
--- a/ansible/openwhisk.yml
+++ b/ansible/openwhisk.yml
@@ -2,8 +2,9 @@
 # license agreements; and to You under the Apache License, Version 2.0.
 ---
 # This playbook deploys an Openwhisk stack.
-# It assumes you have already set up your database with the respective db provider playbook (currently cloudant.yml or couchdb.yml)
-# It assumes that wipe.yml have being deployed at least once
+# It assumes you have already set up your database with the respective db provider
+# playbook (currently cloudant.yml or couchdb.yml).
+# It assumes that wipe.yml have being deployed at least once.
 
 - import_playbook: kafka.yml
 
@@ -13,4 +14,4 @@
 
 - import_playbook: edge.yml
 
-- import_playbook: routemgmt.yml
+- import_playbook: downloadcli.yml
diff --git a/ansible/roles/cli-install/tasks/clean.yml b/ansible/roles/cli-install/tasks/clean.yml
index 1a92799..757b2b0 100644
--- a/ansible/roles/cli-install/tasks/clean.yml
+++ b/ansible/roles/cli-install/tasks/clean.yml
@@ -2,7 +2,7 @@
 # license agreements; and to You under the Apache License, Version 2.0.
 ---
 
-- name: remove cli nginx directory
+- name: remove wsk binary
   file:
     path: "{{ openwhisk_home }}/bin/{{ wsk }}"
     state: absent
diff --git a/ansible/roles/cli-install/tasks/deploy.yml b/ansible/roles/cli-install/tasks/deploy.yml
index 9c0523f..0d6589e 100644
--- a/ansible/roles/cli-install/tasks/deploy.yml
+++ b/ansible/roles/cli-install/tasks/deploy.yml
@@ -1,9 +1,9 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor
 # license agreements; and to You under the Apache License, Version 2.0.
 ---
-# Install the appropriate CLI into the ansible host for the routemgmt tasks
+# Install the appropriate CLI into the ansible host
 
-- name: "Grab the local CLI from the binaries unarchived into nginx"
+- name: grab the local CLI from the binaries unarchived into nginx
   get_url:
     url: "https://{{host}}/cli/go/download/{{os}}/{{arch}}/{{wsk}}"
     dest: "{{ openwhisk_home }}/bin"
diff --git a/ansible/roles/couchdb/tasks/deploy.yml b/ansible/roles/couchdb/tasks/deploy.yml
index 499440b..0bf5170 100644
--- a/ansible/roles/couchdb/tasks/deploy.yml
+++ b/ansible/roles/couchdb/tasks/deploy.yml
@@ -3,7 +3,7 @@
 ---
 # This role will run a CouchDB server on the db group
 
-- name: "Set the coordinator to the first node"
+- name: set the coordinator to the first node
   set_fact:
     coordinator: "{{ groups['db'][0] }}"
 
diff --git a/ansible/roles/routemgmt/files/installRouteMgmt.sh b/ansible/roles/routemgmt/files/installRouteMgmt.sh
index 9355689..79d932b 100755
--- a/ansible/roles/routemgmt/files/installRouteMgmt.sh
+++ b/ansible/roles/routemgmt/files/installRouteMgmt.sh
@@ -13,7 +13,6 @@
 # WSK_CLI="$OPENWHISK_HOME/bin/wsk"
 
 set -e
-set -x
 
 if [ $# -eq 0 ]
 then
@@ -42,6 +41,11 @@ if [ -f "$AUTH" ]; then
     AUTH=`cat $AUTH`
 fi
 
+if [ ! -f $WSK_CLI ]; then
+    echo $WSK_CLI is missing
+    exit 1
+fi
+
 export WSK_CONFIG_FILE= # override local property file to avoid namespace clashes
 
 echo Installing apimgmt package
diff --git a/ansible/roles/routemgmt/files/uninstallRouteMgmt.sh b/ansible/roles/routemgmt/files/uninstallRouteMgmt.sh
index a612556..53404ca 100755
--- a/ansible/roles/routemgmt/files/uninstallRouteMgmt.sh
+++ b/ansible/roles/routemgmt/files/uninstallRouteMgmt.sh
@@ -8,12 +8,11 @@
 # automatically
 #
 # To run this command
-# ./installRouteMgmt.sh  <AUTH> <APIHOST> <NAMESPACE> <WSK_CLI>
+# ./uninstallRouteMgmt.sh  <AUTH> <APIHOST> <NAMESPACE> <WSK_CLI>
 # AUTH, APIHOST and NAMESPACE are found in $HOME/.wskprops
 # WSK_CLI="$OPENWHISK_HOME/bin/wsk"
 
 set -e
-set -x
 
 if [ $# -eq 0 ]
 then
@@ -31,6 +30,11 @@ if [ -f "$AUTH" ]; then
     AUTH=`cat $AUTH`
 fi
 
+if [ ! -f $WSK_CLI ]; then
+    echo $WSK_CLI is missing
+    exit 1
+fi
+
 export WSK_CONFIG_FILE= # override local property file to avoid namespace clashes
 
 function deleteAction
diff --git a/ansible/routemgmt.yml b/ansible/routemgmt.yml
index 4c99436..6bb1abf 100644
--- a/ansible/routemgmt.yml
+++ b/ansible/routemgmt.yml
@@ -3,9 +3,6 @@
 ---
 # This playbook deploys the Openwhisk API Gateway route management actions.
 
-- import_playbook: properties.yml
-
 - hosts: ansible
   roles:
-  - cli-install
   - routemgmt
diff --git a/tools/build/redo b/tools/build/redo
index b421a18..cb81b26 100755
--- a/tools/build/redo
+++ b/tools/build/redo
@@ -269,10 +269,21 @@ Components = [
     makeComponent('edge',
                   'deploy edge'),
 
+    makeComponent('cli',
+                  'download cli from api host',
+                  modes = 'clean',
+                  yaml = 'downloadcli.yml'),
+
     makeComponent('catalog',
                   'install catalog',
                   yaml = 'postdeploy.yml'),
 
+    makeComponent('apigw',
+                  'deploy api gateway',
+                  gradle = False,
+                  modes = 'clean',
+                  yaml = 'routemgmt.yml apigateway.yml'),
+
     # the following (re)build images via gradle
     makeComponent('runtime:([\w.-]+)',
                   'build a runtime action container, matching name using the regex; NOTE: must use --dir for path to runtime directory',
diff --git a/tools/travis/setupSystem.sh b/tools/travis/setupSystem.sh
index 557e0e0..55c78ec 100755
--- a/tools/travis/setupSystem.sh
+++ b/tools/travis/setupSystem.sh
@@ -25,7 +25,8 @@ ROOTDIR="$SCRIPTDIR/../.."
 
 cd $ROOTDIR/ansible
 
-$ANSIBLE_CMD apigateway.yml
 $ANSIBLE_CMD openwhisk.yml
+$ANSIBLE_CMD apigateway.yml
+$ANSIBLE_CMD routemgmt.yml
 
 echo "Time taken for ${0##*/} is $SECONDS secs"
diff --git a/tools/vagrant/Vagrantfile b/tools/vagrant/Vagrantfile
index 77764a5..2466e35 100644
--- a/tools/vagrant/Vagrantfile
+++ b/tools/vagrant/Vagrantfile
@@ -149,9 +149,10 @@ Vagrant.configure('2') do |config|
     echo "`date`: deploy-start" >> /tmp/vagrant-times.txt
     cd ${ANSIBLE_HOME}
     su vagrant -c 'ansible-playbook -i environments/vagrant wipe.yml'
-    su vagrant -c 'ansible-playbook -i environments/vagrant apigateway.yml'
     su vagrant -c 'ansible-playbook -i environments/vagrant openwhisk.yml -e invoker_use_runc=False'
     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'