[incubator-openwhisk] branch master updated: Make ConfigKeys and its keys shorter for convenience. (#3157)

2018-01-08 Thread markusthoemmes
This is an automated email from the ASF dual-hosted git repository.

markusthoemmes 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 a92208b  Make ConfigKeys and its keys shorter for convenience. (#3157)
a92208b is described below

commit a92208b3a50c849ff76c29292140880f3b9c6ac7
Author: David Grove 
AuthorDate: Mon Jan 8 13:11:14 2018 -0500

Make ConfigKeys and its keys shorter for convenience. (#3157)
---
 .../whisk/connector/kafka/KafkaMessagingProvider.scala   |  6 +++---
 common/scala/src/main/scala/whisk/core/WhiskConfig.scala | 16 +---
 .../main/scala/whisk/core/entity/WhiskActivation.scala   |  4 ++--
 .../src/main/scala/whisk/core/entity/WhiskStore.scala|  4 ++--
 .../whisk/core/loadBalancer/LoadBalancerService.scala|  4 ++--
 .../whisk/core/containerpool/docker/DockerClient.scala   |  4 ++--
 .../whisk/core/containerpool/docker/RuncClient.scala |  4 ++--
 7 files changed, 22 insertions(+), 20 deletions(-)

diff --git 
a/common/scala/src/main/scala/whisk/connector/kafka/KafkaMessagingProvider.scala
 
b/common/scala/src/main/scala/whisk/connector/kafka/KafkaMessagingProvider.scala
index e8eab40..7fd82c5 100644
--- 
a/common/scala/src/main/scala/whisk/connector/kafka/KafkaMessagingProvider.scala
+++ 
b/common/scala/src/main/scala/whisk/connector/kafka/KafkaMessagingProvider.scala
@@ -30,7 +30,7 @@ import org.apache.kafka.clients.admin.NewTopic
 import org.apache.kafka.common.errors.TopicExistsException
 
 import whisk.common.Logging
-import whisk.core.PureConfigKeys
+import whisk.core.ConfigKeys
 import whisk.core.WhiskConfig
 import whisk.core.connector.MessageConsumer
 import whisk.core.connector.MessageProducer
@@ -61,8 +61,8 @@ object KafkaMessagingProvider extends MessagingProvider {
 new KafkaProducerConnector(config.kafkaHosts, ec)
 
   def ensureTopic(config: WhiskConfig, topic: String, topicConfig: 
String)(implicit logging: Logging): Boolean = {
-val kc = loadConfigOrThrow[KafkaConfig](PureConfigKeys.whiskKafka)
-val tc = loadConfigOrThrow[TopicConfig](PureConfigKeys.whiskKafkaTopics + 
s".$topicConfig")
+val kc = loadConfigOrThrow[KafkaConfig](ConfigKeys.kafka)
+val tc = loadConfigOrThrow[TopicConfig](ConfigKeys.kafkaTopics + 
s".$topicConfig")
 val props = new Properties
 props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, config.kafkaHosts)
 val client = AdminClient.create(props)
diff --git a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala 
b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
index c2094d6..f0db605 100644
--- a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
+++ b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
@@ -237,14 +237,16 @@ object WhiskConfig {
   val controllerHighAvailability = "controller.ha"
 }
 
-object PureConfigKeys {
-  val whiskLoadbalancer = "whisk.loadbalancer"
+object ConfigKeys {
+  val loadbalancer = "whisk.loadbalancer"
 
-  val whiskKafka = "whisk.kafka"
-  val whiskKafkaTopics = "whisk.kafka.topics"
+  val kafka = "whisk.kafka"
+  val kafkaTopics = s"$kafka.topics"
 
-  val whiskDB = "whisk.db"
+  val db = "whisk.db"
 
-  val whiskDockerTimeouts = "whisk.docker.timeouts"
-  val whiskRuncTimeouts = "whisk.runc.timeouts"
+  val docker = "whisk.docker"
+  val dockerTimeouts = s"$docker.timeouts"
+  val runc = "whisk.runc"
+  val runcTimeouts = s"$runc.timeouts"
 }
diff --git 
a/common/scala/src/main/scala/whisk/core/entity/WhiskActivation.scala 
b/common/scala/src/main/scala/whisk/core/entity/WhiskActivation.scala
index fedec4c..cde7507 100644
--- a/common/scala/src/main/scala/whisk/core/entity/WhiskActivation.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/WhiskActivation.scala
@@ -25,7 +25,7 @@ import scala.util.Try
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import whisk.common.TransactionId
-import whisk.core.PureConfigKeys
+import whisk.core.ConfigKeys
 import whisk.core.database.ArtifactStore
 import whisk.core.database.DocumentFactory
 import whisk.core.database.StaleParameter
@@ -148,7 +148,7 @@ object WhiskActivation
 
   override val collectionName = "activations"
 
-  private val dbConfig = loadConfigOrThrow[DBConfig](PureConfigKeys.whiskDB)
+  private val dbConfig = loadConfigOrThrow[DBConfig](ConfigKeys.db)
   private val mainDdoc = dbConfig.activationsDdoc
   private val filtersDdoc = dbConfig.activationsFilterDdoc
 
diff --git a/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala 
b/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
index b935efb..94be958 100644
--- a/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
@@ -29,7 +29,7 @@ import spray.json.JsString
 import spray.json.RootJsonFormat
 import whisk.common.Logging
 import 

[incubator-openwhisk-devtools] branch master updated: Fixes a few linux issues with the makefile (#77)

2018-01-08 Thread dragos
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 2137a83  Fixes a few linux issues with the makefile (#77)
2137a83 is described below

commit 2137a835d63a9c22e3661d19e0c8f44ac85a96d3
Author: dan mcweeney 
AuthorDate: Mon Jan 8 11:20:47 2018 -0500

Fixes a few linux issues with the makefile (#77)

* Fix #78 - update docker compose version

* Make ansible also setup couchdb during compose quickstart

* Updates to make this work on Linux

* Remove commented line

* Fix docker and runc binary detection for linux
---
 docker-compose/Makefile | 50 +++--
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index 190c1fb..69d73dd 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -1,8 +1,14 @@
+UNAME_STR ?= $(shell uname)
+
 # detect local ip of host as this is needed within containers to find the 
openwhisk API container
-LOCAL_IP ?= $(shell ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\  -f2 
| head -1)
-# if no IP was found, fallback to "localhost"
-ifeq ($(LOCAL_IP), )
-   LOCAL_IP = "localhost"
+ifeq ("$(UNAME_STR)","Linux")
+   LOCAL_IP=$(shell route | grep default | tr -s " " | cut -d " " -f 8 | 
xargs ifconfig | grep "inet addr:" | cut -d ":" -f 2 | cut -d " " -f 1)
+else
+   LOCAL_IP ?= $(shell ifconfig | grep "inet " | grep -v 127.0.0.1 | cut 
-d\  -f2 | head -1)
+   # if no IP was found, fallback to "localhost"
+   ifeq ($(LOCAL_IP), )
+   LOCAL_IP = "localhost"
+   endif
 endif
 
 DOCKER_HOST_IP ?= $(shell echo ${DOCKER_HOST} | grep -o 
"[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" || echo ${LOCAL_IP})
@@ -14,12 +20,13 @@ WSK_CLI ?= $(PROJECT_HOME)/bin/wsk
 OPEN_WHISK_DB_PREFIX ?= local_
 
 DOCKER_KERNEL ?= $(shell docker version --format "{{.Server.KernelVersion}}")
-RUNC_BINARY   ?= $(shell if [[ $(DOCKER_KERNEL) == *-moby || $(DOCKER_KERNEL) 
==  *-boot2docker ]]; then (docker run --rm --privileged --pid=host debian 
nsenter -t 1 -m -u -n -i sh -c "which runc || which docker-runc"); else (which 
runc || which docker-runc); fi)
-DOCKER_BINARY ?= $(shell if [[ $(DOCKER_KERNEL) == *-moby || $(DOCKER_KERNEL) 
==  *-boot2docker ]]; then (docker run --rm --privileged --pid=host debian 
nsenter -t 1 -m -u -n -i sh -c "which docker"); else (which docker); fi)
-
-
-UNAME_STR ?= $(shell uname)
-
+ifeq ("$(UNAME_STR)","Linux")
+   RUNC_BINARY   ?= $(shell (which runc || which docker-runc))
+   DOCKER_BINARY ?= $(shell (which docker))
+else 
+   RUNC_BINARY   ?= $(shell if [[ $(DOCKER_KERNEL) == *-moby || 
$(DOCKER_KERNEL) ==  *-boot2docker ]]; then (docker run --rm --privileged 
--pid=host debian nsenter -t 1 -m -u -n -i sh -c "which runc || which 
docker-runc"); else (which runc || which docker-runc); fi)
+   DOCKER_BINARY ?= $(shell if [[ $(DOCKER_KERNEL) == *-moby || 
$(DOCKER_KERNEL) ==  *-boot2docker ]]; then (docker run --rm --privileged 
--pid=host debian nsenter -t 1 -m -u -n -i sh -c "which docker"); else (which 
docker); fi)
+endif
 ifndef VERBOSE
 .SILENT:
 endif
@@ -136,19 +143,22 @@ rm:
 
 .PHONY: init-couchdb
 init-couchdb:
-   echo "waiting for the database to come up ... "
+   echo "waiting for the database to come up ... on $(DOCKER_HOST_IP)"
until $$(curl --output /dev/null --silent --head --fail 
http://$(DOCKER_HOST_IP):5984/_all_dbs); do printf '.'; sleep 5; done
-
-   echo "initializing the database ... "
+   echo "initializing the database ... on $(DOCKER_HOST_IP)"
# make sure the src files are in a shared folder for docker
mkdir -p ~/tmp/openwhisk
rm -rf ~/tmp/openwhisk/src
rsync -a $(PROJECT_HOME)/* ~/tmp/openwhisk/src --exclude .git --exclude 
build --exclude tests
+   echo 'Setting up db using ansible container'; \
+compose_network=$$(docker-compose --project-name openwhisk ps -q db 
2>/dev/null | xargs docker inspect -f '{{range $$index, $$element := 
.NetworkSettings.Networks}}{{$$index}}{{end}}' | head -n 1); \
+db_ip_address=$$(docker-compose --project-name openwhisk ps -q db 
2>/dev/null | xargs docker inspect -f 
"{{.NetworkSettings.Networks.$${compose_network}.IPAddress}}"); \
docker run --rm -v ~/tmp/openwhisk/src:/openwhisk -w /openwhisk/ansible 
\
-   --network="host" -t \
-   ddragosd/ansible:2.3.1.0-debian8  \
-   ansible-playbook setup.yml couchdb.yml initdb.yml wipe.yml 
--tags=ini \
-   -e db_host=$(DOCKER_HOST_IP) -e openwhisk_home=/openwhisk 
-e db_prefix=$(OPEN_WHISK_DB_PREFIX)
+   --network="$${compose_network}" -t \
+   

[incubator-openwhisk] branch master updated: move PureConfig strings to PureConfigKeys singleton (#3156)

2018-01-08 Thread rabbah
This is an automated email from the ASF dual-hosted git repository.

rabbah 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 149f8d9  move PureConfig strings to PureConfigKeys singleton (#3156)
149f8d9 is described below

commit 149f8d948ed0db6293c1dc3be168e9322d71dd0a
Author: David Grove 
AuthorDate: Mon Jan 8 11:20:20 2018 -0500

move PureConfig strings to PureConfigKeys singleton (#3156)
---
 common/scala/src/main/scala/whisk/core/WhiskConfig.scala   | 3 +++
 .../src/main/scala/whisk/core/containerpool/docker/DockerClient.scala  | 3 ++-
 .../src/main/scala/whisk/core/containerpool/docker/RuncClient.scala| 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala 
b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
index 471ea67..c2094d6 100644
--- a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
+++ b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
@@ -244,4 +244,7 @@ object PureConfigKeys {
   val whiskKafkaTopics = "whisk.kafka.topics"
 
   val whiskDB = "whisk.db"
+
+  val whiskDockerTimeouts = "whisk.docker.timeouts"
+  val whiskRuncTimeouts = "whisk.runc.timeouts"
 }
diff --git 
a/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
 
b/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
index 4ed631d..7cc1d27 100644
--- 
a/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
+++ 
b/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
@@ -36,6 +36,7 @@ import pureconfig.loadConfigOrThrow
 import whisk.common.Logging
 import whisk.common.LoggingMarkers
 import whisk.common.TransactionId
+import whisk.core.PureConfigKeys
 import whisk.core.containerpool.ContainerId
 import whisk.core.containerpool.ContainerAddress
 
@@ -74,7 +75,7 @@ case class DockerClientTimeoutConfig(run: Duration,
  */
 class DockerClient(dockerHost: Option[String] = None,
timeouts: DockerClientTimeoutConfig =
- 
loadConfigOrThrow[DockerClientTimeoutConfig]("whisk.docker.timeouts"))(
+ 
loadConfigOrThrow[DockerClientTimeoutConfig](PureConfigKeys.whiskDockerTimeouts))(
   executionContext: ExecutionContext)(implicit log: Logging, as: ActorSystem)
 extends DockerApi
 with ProcessRunner {
diff --git 
a/core/invoker/src/main/scala/whisk/core/containerpool/docker/RuncClient.scala 
b/core/invoker/src/main/scala/whisk/core/containerpool/docker/RuncClient.scala
index 526bfc4..b8970ec 100644
--- 
a/core/invoker/src/main/scala/whisk/core/containerpool/docker/RuncClient.scala
+++ 
b/core/invoker/src/main/scala/whisk/core/containerpool/docker/RuncClient.scala
@@ -27,6 +27,7 @@ import whisk.common.TransactionId
 import scala.util.Success
 import whisk.common.LoggingMarkers
 import whisk.common.Logging
+import whisk.core.PureConfigKeys
 import akka.event.Logging.ErrorLevel
 import pureconfig.loadConfigOrThrow
 import whisk.core.containerpool.ContainerId
@@ -46,7 +47,7 @@ case class RuncClientTimeouts(pause: Duration, resume: 
Duration)
  *
  * You only need one instance (and you shouldn't get more).
  */
-class RuncClient(timeouts: RuncClientTimeouts = 
loadConfigOrThrow[RuncClientTimeouts]("whisk.runc.timeouts"))(
+class RuncClient(timeouts: RuncClientTimeouts = 
loadConfigOrThrow[RuncClientTimeouts](PureConfigKeys.whiskRuncTimeouts))(
   executionContext: ExecutionContext)(implicit log: Logging, as: ActorSystem)
 extends RuncApi
 with ProcessRunner {

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" '].


[incubator-openwhisk-devtools] branch master updated: Make ansible also setup couchdb during compose quickstart (#74)

2018-01-08 Thread dragos
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new c419ee1  Make ansible also setup couchdb during compose quickstart 
(#74)
c419ee1 is described below

commit c419ee1763093765c27eafe4857774006b8c0cd6
Author: dan mcweeney 
AuthorDate: Mon Jan 8 10:32:00 2018 -0500

Make ansible also setup couchdb during compose quickstart (#74)

* Fix #78 - update docker compose version
* Make ansible also setup couchdb during compose quickstart
---
 .travis.yml | 2 +-
 docker-compose/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index cc06797..1d678b6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@ sudo: required
 
 env:
   global:
-- DOCKER_COMPOSE_VERSION: 1.13
+- DOCKER_COMPOSE_VERSION: 1.13.0
   matrix:
 - TOOL: docker-compose
 
diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index 9967078..190c1fb 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -147,7 +147,7 @@ init-couchdb:
docker run --rm -v ~/tmp/openwhisk/src:/openwhisk -w /openwhisk/ansible 
\
--network="host" -t \
ddragosd/ansible:2.3.1.0-debian8  \
-   ansible-playbook setup.yml initdb.yml wipe.yml \
+   ansible-playbook setup.yml couchdb.yml initdb.yml wipe.yml 
--tags=ini \
-e db_host=$(DOCKER_HOST_IP) -e openwhisk_home=/openwhisk 
-e db_prefix=$(OPEN_WHISK_DB_PREFIX)
 
 .PHONY: init-whisk-cli

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" '].


[incubator-openwhisk] branch master updated: Use cache invalidation policy based on access time. (#3146)

2018-01-08 Thread markusthoemmes
This is an automated email from the ASF dual-hosted git repository.

markusthoemmes 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 bd84ab5  Use cache invalidation policy based on access time. (#3146)
bd84ab5 is described below

commit bd84ab57c3dadcddcead1699bc016bdf01cd27e6
Author: James Dubee 
AuthorDate: Mon Jan 8 10:15:43 2018 -0500

Use cache invalidation policy based on access time. (#3146)

* Use cache invalidation policy based on access time

* Allow multiple cache policies and do not create cache if caching is 
disabled
- Add per-cache configration for eviction
- Lazily instantiate cache
- Prevents cache from being instantiate when fromCache is false
---
 .../MultipleReadersSingleWriterCache.scala | 35 +-
 .../main/scala/whisk/core/entity/Identity.scala|  3 ++
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git 
a/common/scala/src/main/scala/whisk/core/database/MultipleReadersSingleWriterCache.scala
 
b/common/scala/src/main/scala/whisk/core/database/MultipleReadersSingleWriterCache.scala
index 6fa76d2..5866355 100644
--- 
a/common/scala/src/main/scala/whisk/core/database/MultipleReadersSingleWriterCache.scala
+++ 
b/common/scala/src/main/scala/whisk/core/database/MultipleReadersSingleWriterCache.scala
@@ -91,12 +91,18 @@ private object MultipleReadersSingleWriterCache {
 
 trait CacheChangeNotification extends (CacheKey => Future[Unit])
 
+sealed trait EvictionPolicy
+
+case object AccessTime extends EvictionPolicy
+case object WriteTime extends EvictionPolicy
+
 trait MultipleReadersSingleWriterCache[W, Winfo] {
   import MultipleReadersSingleWriterCache._
   import MultipleReadersSingleWriterCache.State._
 
   /** Subclasses: Toggle this to enable/disable caching for your entity type. 
*/
   protected val cacheEnabled = true
+  protected val evictionPolicy: EvictionPolicy = AccessTime
 
   private object Entry {
 def apply(transid: TransactionId, state: State, value: Option[Future[W]]): 
Entry = {
@@ -438,14 +444,27 @@ trait MultipleReadersSingleWriterCache[W, Winfo] {
   }
 
   /** This is the backing store. */
-  private val cache: ConcurrentMapBackedCache[Entry] = new 
ConcurrentMapBackedCache(
-Caffeine
-  .newBuilder()
-  .asInstanceOf[Caffeine[Any, Future[Entry]]]
-  .expireAfterWrite(5, TimeUnit.MINUTES)
-  .softValues()
-  .build()
-  .asMap())
+  private lazy val cache: ConcurrentMapBackedCache[Entry] = evictionPolicy 
match {
+case AccessTime =>
+  new ConcurrentMapBackedCache(
+Caffeine
+  .newBuilder()
+  .asInstanceOf[Caffeine[Any, Future[Entry]]]
+  .expireAfterAccess(5, TimeUnit.MINUTES)
+  .softValues()
+  .build()
+  .asMap())
+
+case _ =>
+  new ConcurrentMapBackedCache(
+Caffeine
+  .newBuilder()
+  .asInstanceOf[Caffeine[Any, Future[Entry]]]
+  .expireAfterWrite(5, TimeUnit.MINUTES)
+  .softValues()
+  .build()
+  .asMap())
+  }
 }
 
 /**
diff --git a/common/scala/src/main/scala/whisk/core/entity/Identity.scala 
b/common/scala/src/main/scala/whisk/core/entity/Identity.scala
index 358b60f..e1b2526 100644
--- a/common/scala/src/main/scala/whisk/core/entity/Identity.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/Identity.scala
@@ -27,6 +27,7 @@ import whisk.common.TransactionId
 import whisk.core.database.MultipleReadersSingleWriterCache
 import whisk.core.database.NoDocumentException
 import whisk.core.database.StaleParameter
+import whisk.core.database.WriteTime
 import whisk.core.entitlement.Privilege
 
 case class UserLimits(invocationsPerMinute: Option[Int] = None,
@@ -50,6 +51,8 @@ object Identity extends 
MultipleReadersSingleWriterCache[Identity, DocInfo] with
   private val viewName = "subjects/identities"
 
   override val cacheEnabled = true
+  override val evictionPolicy = WriteTime
+
   implicit val serdes = jsonFormat5(Identity.apply)
 
   /**

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" '].


[incubator-openwhisk-package-deploy] branch master updated: env variable instead of param for installCatalog (#8)

2018-01-08 Thread dubeejw
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new ece847f  env variable instead of param for installCatalog (#8)
ece847f is described below

commit ece847f342cea8e741bd2cc241cb31d31b2afa5b
Author: Belinda Vennam 
AuthorDate: Mon Jan 8 09:22:02 2018 -0500

env variable instead of param for installCatalog (#8)

* env variable instead of param for installCatalog

* remove skip deploy param

* updating skip_deploy to true
---
 packages/installCatalog.sh | 16 +---
 tools/travis/build.sh  |  4 ++--
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/packages/installCatalog.sh b/packages/installCatalog.sh
index ae1ca14..098a0ff 100755
--- a/packages/installCatalog.sh
+++ b/packages/installCatalog.sh
@@ -13,25 +13,19 @@ set -x
 
 if [ $# -eq 0 ]
   then
-  echo "Usage: ./installCatalog.sh
 "
+  echo "Usage: ./installCatalog.sh
"
 fi
 
 AUTH="$1"
 EDGE_HOST="$2"
 WSK_CLI="$3"
-SKIP_DEPLOY="${4:-False}"
-DOCKER="$5"
+DOCKER="$4"
+SKIP_DEPLOY="${SKIP_DEPLOY:-True}"
 
 # If docker is not provided, set to default version.
-if [ -z "$5" ]
-  then
-  if [ $SKIP_DEPLOY = False ] || [ $SKIP_DEPLOY = True ]
+if [ -z "$4" ]
   then
 DOCKER="openwhisk/wskdeploy:0.8.10"
-  else
-SKIP_DEPLOY=False
-DOCKER=$4
-  fi
 fi
 
 # If the auth key file exists, read the key in the file. Otherwise, take the
@@ -44,7 +38,7 @@ PACKAGE_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd 
)"
 
 export WSK_CONFIG_FILE= # override local property file to avoid namespace 
clashes
 
-#clone all Blueprints
+# clone all Blueprints
 for bp in blueprint-hello-world blueprint-cloudant-trigger 
blueprint-messagehub-trigger
 do
   if [ -e actions/blueprints/$bp ]
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index 9b1b61b..19f6208 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -37,6 +37,7 @@ $ANSIBLE_CMD openwhisk.yml
 
 # Set Environment
 export OPENWHISK_HOME=$WHISKDIR
+export SKIP_DEPLOY="True"
 
 cd $WHISKDIR
 
@@ -50,12 +51,11 @@ cat whisk.properties
 WSK_CLI=$WHISKDIR/bin/wsk
 AUTH_KEY=$(cat $WHISKDIR/ansible/files/auth.whisk.system)
 EDGE_HOST=$(grep '^edge.host=' $WHISKPROPS_FILE | cut -d'=' -f2)
-SKIP_DEPLOY="True"
 
 # Install Package
 
 cd $ROOTDIR/packages
-./installCatalog.sh $AUTH_KEY $EDGE_HOST $WSK_CLI $SKIP_DEPLOY
+./installCatalog.sh $AUTH_KEY $EDGE_HOST $WSK_CLI
 
 # Test
 cd $ROOTDIR

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" '].


[incubator-openwhisk] branch master updated: Bound docker/runc commands in their allowed runtime. (#3094)

2018-01-08 Thread cbickel
This is an automated email from the ASF dual-hosted git repository.

cbickel 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 ec8148f  Bound docker/runc commands in their allowed runtime. (#3094)
ec8148f is described below

commit ec8148fbba3bf8142853fa2aee0bcfb92fd7a5ae
Author: Markus Thömmes 
AuthorDate: Mon Jan 8 12:54:09 2018 +0100

Bound docker/runc commands in their allowed runtime. (#3094)

Docker can cause hanging commands which never finish. Essentially those 
break the invoker and it needs to be restarted to recover. This adds a timeout 
to each of those commands to detect this problem.
---
 core/invoker/src/main/resources/application.conf   | 22 
 .../core/containerpool/docker/DockerClient.scala   | 61 ++
 .../docker/DockerClientWithFileAccess.scala|  9 ++--
 .../docker/DockerContainerFactory.scala|  2 +-
 .../core/containerpool/docker/ProcessRunner.scala  | 26 ++---
 .../core/containerpool/docker/RuncClient.scala | 30 ---
 .../docker/test/DockerClientTests.scala| 25 ++---
 .../test/DockerClientWithFileAccessTests.scala | 28 ++
 .../docker/test/ProcessRunnerTests.scala   | 24 ++---
 .../docker/test/RuncClientTests.scala  | 12 +++--
 10 files changed, 173 insertions(+), 66 deletions(-)

diff --git a/core/invoker/src/main/resources/application.conf 
b/core/invoker/src/main/resources/application.conf
new file mode 100644
index 000..e7ed0a6
--- /dev/null
+++ b/core/invoker/src/main/resources/application.conf
@@ -0,0 +1,22 @@
+# common logging configuration see common scala
+include "logging"
+include "akka-http-version"
+
+whisk {
+  # Timeouts for docker commands. Set to "Inf" to disable timeout.
+  docker.timeouts {
+run: 1 minute
+rm: 1 minute
+pull: 10 minutes
+ps: 1 minute
+inspect: 1 minute
+pause: 10 seconds
+unpause: 10 seconds
+  }
+
+  # Timeouts for runc commands. Set to "Inf" to disable timeout.
+  runc.timeouts {
+pause: 10 seconds
+resume: 10 seconds
+  }
+}
\ No newline at end of file
diff --git 
a/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
 
b/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
index e6b3dab..4ed631d 100644
--- 
a/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
+++ 
b/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
@@ -22,6 +22,8 @@ import java.nio.file.Files
 import java.nio.file.Paths
 import java.util.concurrent.Semaphore
 
+import akka.actor.ActorSystem
+
 import scala.collection.concurrent.TrieMap
 import scala.concurrent.blocking
 import scala.concurrent.ExecutionContext
@@ -30,13 +32,15 @@ import scala.util.Failure
 import scala.util.Success
 import scala.util.Try
 import akka.event.Logging.ErrorLevel
-
+import pureconfig.loadConfigOrThrow
 import whisk.common.Logging
 import whisk.common.LoggingMarkers
 import whisk.common.TransactionId
 import whisk.core.containerpool.ContainerId
 import whisk.core.containerpool.ContainerAddress
 
+import scala.concurrent.duration.Duration
+
 object DockerContainerId {
 
   val containerIdRegex = """^([0-9a-f]{64})$""".r
@@ -50,6 +54,17 @@ object DockerContainerId {
 }
 
 /**
+ * Configuration for docker client command timeouts.
+ */
+case class DockerClientTimeoutConfig(run: Duration,
+ rm: Duration,
+ pull: Duration,
+ ps: Duration,
+ pause: Duration,
+ unpause: Duration,
+ inspect: Duration)
+
+/**
  * Serves as interface to the docker CLI tool.
  *
  * Be cautious with the ExecutionContext passed to this, as the
@@ -57,7 +72,10 @@ object DockerContainerId {
  *
  * You only need one instance (and you shouldn't get more).
  */
-class DockerClient(dockerHost: Option[String] = None)(executionContext: 
ExecutionContext)(implicit log: Logging)
+class DockerClient(dockerHost: Option[String] = None,
+   timeouts: DockerClientTimeoutConfig =
+ 
loadConfigOrThrow[DockerClientTimeoutConfig]("whisk.docker.timeouts"))(
+  executionContext: ExecutionContext)(implicit log: Logging, as: ActorSystem)
 extends DockerApi
 with ProcessRunner {
   implicit private val ec = executionContext
@@ -95,14 +113,12 @@ class DockerClient(dockerHost: Option[String] = 
None)(executionContext: Executio
   }
 }.flatMap { _ =>
   // Iff the semaphore was acquired successfully
-  runCmd((Seq("run", "-d") ++ args ++ Seq(image)): _*)
+  runCmd(Seq("run", "-d") ++ args ++ Seq(image), timeouts.run)
 .andThen {
   // 

[incubator-openwhisk] branch master updated: Use alpakka's FileRotator instead of the copied one. (#3102)

2018-01-08 Thread cbickel
This is an automated email from the ASF dual-hosted git repository.

cbickel 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 b485c5e  Use alpakka's FileRotator instead of the copied one. (#3102)
b485c5e is described below

commit b485c5e249ed45e0395f2e8056972adb737f0353
Author: Markus Thömmes 
AuthorDate: Mon Jan 8 12:53:45 2018 +0100

Use alpakka's FileRotator instead of the copied one. (#3102)
---
 common/scala/build.gradle  |   2 +
 .../containerpool/logging/LogRotatorSink.scala | 176 -
 core/invoker/build.gradle  |   1 -
 3 files changed, 2 insertions(+), 177 deletions(-)

diff --git a/common/scala/build.gradle b/common/scala/build.gradle
index 31781f4..2c04731 100644
--- a/common/scala/build.gradle
+++ b/common/scala/build.gradle
@@ -21,6 +21,8 @@ dependencies {
 compile 'com.typesafe.akka:akka-http-core_2.11:10.0.10'
 compile 'com.typesafe.akka:akka-http-spray-json_2.11:10.0.10'
 
+compile 'com.lightbend.akka:akka-stream-alpakka-file_2.11:0.15'
+
 compile 'ch.qos.logback:logback-classic:1.2.3'
 compile 'org.slf4j:jcl-over-slf4j:1.7.25'
 compile 'org.slf4j:log4j-over-slf4j:1.7.25'
diff --git 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/LogRotatorSink.scala
 
b/common/scala/src/main/scala/whisk/core/containerpool/logging/LogRotatorSink.scala
deleted file mode 100644
index 6c5681b..000
--- 
a/common/scala/src/main/scala/whisk/core/containerpool/logging/LogRotatorSink.scala
+++ /dev/null
@@ -1,176 +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.
- */
-
-// TO BE TAKEN OUT AFTER ALPAKKA 0.15 RELEASE
-
-/*
- * Copyright (C) 2016-2017 Lightbend Inc. 
- */
-
-package akka.stream.alpakka.file.scaladsl
-
-import java.nio.file.{OpenOption, Path, StandardOpenOption}
-
-import akka.Done
-import akka.stream.ActorAttributes.SupervisionStrategy
-import akka.stream._
-import akka.stream.impl.fusing.MapAsync.{Holder, NotYetThere}
-import akka.stream.scaladsl.{FileIO, Sink, Source}
-import akka.stream.stage._
-import akka.util.ByteString
-
-import scala.concurrent.{ExecutionContext, Future, Promise}
-import scala.util.{Failure, Success}
-
-object LogRotatorSink {
-  def apply(functionGeneratorFunction: () => ByteString => Option[Path],
-fileOpenOptions: Set[OpenOption] = Set(StandardOpenOption.APPEND, 
StandardOpenOption.CREATE))
-: Sink[ByteString, Future[Done]] =
-Sink.fromGraph(new LogRotatorSink(functionGeneratorFunction, 
fileOpenOptions))
-}
-
-final private[scaladsl] class LogRotatorSink(functionGeneratorFunction: () => 
ByteString => Option[Path],
- fileOpenOptions: Set[OpenOption])
-extends GraphStageWithMaterializedValue[SinkShape[ByteString], 
Future[Done]] {
-
-  val in = Inlet[ByteString]("FRotator.in")
-  override val shape = SinkShape.of(in)
-
-  override def createLogicAndMaterializedValue(inheritedAttributes: 
Attributes): (GraphStageLogic, Future[Done]) = {
-val promise = Promise[Done]()
-val logic = new GraphStageLogic(shape) {
-  val pathGeneratorFunction: ByteString => Option[Path] = 
functionGeneratorFunction()
-  var sourceOut: SubSourceOutlet[ByteString] = _
-  var fileSinkCompleted: Seq[Future[IOResult]] = Seq.empty
-  val decider =
-
inheritedAttributes.get[SupervisionStrategy].map(_.decider).getOrElse(Supervision.stoppingDecider)
-
-  def failThisStage(ex: Throwable): Unit =
-if (!promise.isCompleted) {
-  if (sourceOut != null) {
-sourceOut.fail(ex)
-  }
-  cancel(in)
-  promise.failure(ex)
-}
-
-  def generatePathOrFailPeacefully(data: ByteString): Option[Path] = {
-var ret = Option.empty[Path]
-try {
-  ret = pathGeneratorFunction(data)
-} catch {
-  case ex: Throwable =>
-failThisStage(ex)
-}
-ret
-  }
-
-  def fileSinkFutureCallbackHandler(future: Future[IOResult])(h: