From commits-return-8154-archive-asf-public=cust-asf.ponee.io@openwhisk.apache.org Mon Oct 7 09:02:07 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id B55991804BB for ; Mon, 7 Oct 2019 11:02:06 +0200 (CEST) Received: (qmail 39943 invoked by uid 500); 7 Oct 2019 09:02:06 -0000 Mailing-List: contact commits-help@openwhisk.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openwhisk.apache.org Delivered-To: mailing list commits@openwhisk.apache.org Received: (qmail 39934 invoked by uid 99); 7 Oct 2019 09:02:06 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Oct 2019 09:02:05 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id D3DF3890A3; Mon, 7 Oct 2019 09:02:05 +0000 (UTC) Date: Mon, 07 Oct 2019 09:02:05 +0000 To: "commits@openwhisk.apache.org" Subject: [openwhisk] branch master updated: Standalone God mode (#4670) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <157043892498.32473.10940169094161346682@gitbox.apache.org> From: chetanm@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: openwhisk X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: f4590aac8e66dbdce4ba8ac6144efc0c22a23169 X-Git-Newrev: b7614dfea2183ce9121652e6f52ba189e1773bd9 X-Git-Rev: b7614dfea2183ce9121652e6f52ba189e1773bd9 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. chetanm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openwhisk.git The following commit(s) were added to refs/heads/master by this push: new b7614df Standalone God mode (#4670) b7614df is described below commit b7614dfea2183ce9121652e6f52ba189e1773bd9 Author: Chetan Mehrotra AuthorDate: Mon Oct 7 14:31:56 2019 +0530 Standalone God mode (#4670) Enables starting standalone server along with all optional services like CouchDB, Kafka etc --- core/standalone/README.md | 22 ++++++++++-------- .../openwhisk/standalone/ApiGwLauncher.scala | 6 ++--- .../openwhisk/standalone/CouchDBLauncher.scala | 5 +++- .../openwhisk/standalone/StandaloneOpenWhisk.scala | 27 ++++++++++++++++++++-- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/core/standalone/README.md b/core/standalone/README.md index 1fa0af7..d74a554 100644 --- a/core/standalone/README.md +++ b/core/standalone/README.md @@ -75,29 +75,33 @@ $ java -jar openwhisk-standalone.jar -h \ \ / \/ \___/| .__/ \___|_| |_|__/\__|_| |_|_|___/_|\_\ \___\/ tm |_| - --api-gw Enable API Gateway support - --api-gw-port Api Gateway Port - --clean Clean any existing state like database + -m, --manifest Manifest JSON defining the supported runtimes -c, --config-file application.conf which overrides the default standalone.conf + --api-gw Enable API Gateway support --couchdb Enable CouchDB support + --user-events Enable User Events along with Prometheus and + Grafana + --kafka Enable embedded Kafka support + --kafka-ui Enable Kafka UI + + --all Enables all the optional services supported + by Standalone OpenWhisk like CouchDB, Kafka + etc + --api-gw-port API Gateway Port + --clean Clean any existing state like database -d, --data-dir Directory used for storage --dev-mode Developer mode speeds up the startup by disabling preflight checks and avoiding explicit pulls. --disable-color-logging Disables colored logging - --kafka Enable embedded Kafka support --kafka-docker-port Kafka port for use by docker based services. If not specified then 9091 or some random free port (if 9091 is busy) would be used --kafka-port Kafka port. If not specified then 9092 or some random free port (if 9092 is busy) would be used - --kafka-ui Enable Kafka UI - -m, --manifest Manifest json defining the supported runtimes -p, --port Server port - --user-events Enable User Events along with Prometheus and - Grafana -v, --verbose --zk-port Zookeeper port. If not specified then 2181 or some random free port (if 2181 is busy) would @@ -106,8 +110,6 @@ $ java -jar openwhisk-standalone.jar -h --version Show version of this program OpenWhisk standalone server - - ``` Sections below would illustrate some of the supported options diff --git a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/ApiGwLauncher.scala b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/ApiGwLauncher.scala index 2f44249..14f62f6 100644 --- a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/ApiGwLauncher.scala +++ b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/ApiGwLauncher.scala @@ -57,7 +57,7 @@ class ApiGwLauncher(docker: StandaloneDockerClient, apiGwApiPort: Int, apiGwMgmt val name = containerName("redis") val args = createRunCmd(name, dockerRunParameters = params) val f = docker.runDetached(redisConfig.image, args, shouldPull = true) - val sc = ServiceContainer(redisPort, "Redis", name) + val sc = ServiceContainer(redisPort, s"http://localhost:$redisPort", name) f.map(c => (c, Seq(sc))) } @@ -102,8 +102,8 @@ class ApiGwLauncher(docker: StandaloneDockerClient, apiGwApiPort: Int, apiGwMgmt val pull = apiGwConfig.image.startsWith("openwhisk") val f = docker.runDetached(apiGwConfig.image, args, pull) val sc = Seq( - ServiceContainer(apiGwApiPort, "Api Gateway - Api Service", name), - ServiceContainer(apiGwMgmtPort, "Api Gateway - Management Service", name)) + ServiceContainer(apiGwApiPort, s"http://localhost:$apiGwApiPort", s"$name, Api Gateway - Api Service "), + ServiceContainer(apiGwMgmtPort, s"http://localhost:$apiGwMgmtPort", s"$name, Api Gateway - Management Service")) f.map(c => (c, sc)) } diff --git a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/CouchDBLauncher.scala b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/CouchDBLauncher.scala index c34027d..d62d376 100644 --- a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/CouchDBLauncher.scala +++ b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/CouchDBLauncher.scala @@ -96,7 +96,10 @@ class CouchDBLauncher(docker: StandaloneDockerClient, port: Int, dataDir: File)( val name = containerName("couch") val args = createRunCmd(name, env, params) val f = docker.runDetached(dbConfig.image, args, shouldPull = true) - val sc = ServiceContainer(port, "CouchDB", name) + val sc = ServiceContainer( + port, + s"http://localhost:$port/_utils", + s"$name, Username: [${dbConfig.user}], Password: [${dbConfig.password}]") f.map(c => (c, sc)) } diff --git a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneOpenWhisk.scala b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneOpenWhisk.scala index 854f8c6..e677faa 100644 --- a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneOpenWhisk.scala +++ b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneOpenWhisk.scala @@ -41,10 +41,9 @@ import scala.concurrent.duration._ import scala.concurrent.{Await, ExecutionContext} import scala.io.AnsiColor import scala.util.{Failure, Success, Try} - import KafkaLauncher._ -class Conf(arguments: Seq[String]) extends ScallopConf(arguments) { +class Conf(arguments: Seq[String]) extends ScallopConf(Conf.expandAllMode(arguments)) { banner(StandaloneOpenWhisk.banner) footer("\nOpenWhisk standalone server") StandaloneOpenWhisk.gitInfo.foreach(g => version(s"Git Commit - ${g.commitId}")) @@ -96,6 +95,12 @@ class Conf(arguments: Seq[String]) extends ScallopConf(arguments) { val userEvents = opt[Boolean](descr = "Enable User Events along with Prometheus and Grafana", noshort = true) + val all = opt[Boolean]( + descr = "Enables all the optional services supported by Standalone OpenWhisk like CouchDB, Kafka etc", + noshort = true) + + mainOptions = Seq(manifest, configFile, apiGw, couchdb, userEvents, kafka, kafkaUi) + verify() val colorEnabled = !disableColorLogging() @@ -103,6 +108,24 @@ class Conf(arguments: Seq[String]) extends ScallopConf(arguments) { def serverUrl: Uri = Uri(s"http://${StandaloneDockerSupport.getLocalHostName()}:${port()}") } +object Conf { + def expandAllMode(args: Seq[String]): Seq[String] = { + if (args.contains("--all")) { + val svcs = Seq("api-gw", "couchdb", "user-events", "kafka", "kafka-ui") + val buf = args.toBuffer + svcs.foreach { s => + val arg = "--" + s + if (!buf.contains(arg)) { + buf += arg + } + } + buf.toList + } else { + args + } + } +} + case class GitInfo(commitId: String, commitTime: String) object StandaloneConfigKeys {