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 <[email protected]>
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 <arg> Api Gateway Port
- --clean Clean any existing state like database
+ -m, --manifest <arg> Manifest JSON defining the supported
runtimes
-c, --config-file <arg> 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 <arg> API Gateway Port
+ --clean Clean any existing state like database
-d, --data-dir <arg> 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 <arg> 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 <arg> 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 <arg> Manifest json defining the supported
runtimes
-p, --port <arg> Server port
- --user-events Enable User Events along with Prometheus and
- Grafana
-v, --verbose
--zk-port <arg> 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 {