Skip to content

Api Gateway support in OpenWhisk Standalone mode#4571

Merged
chetanmeh merged 38 commits intoapache:masterfrom
chetanmeh:standalone-api-gw
Aug 15, 2019
Merged

Api Gateway support in OpenWhisk Standalone mode#4571
chetanmeh merged 38 commits intoapache:masterfrom
chetanmeh:standalone-api-gw

Conversation

@chetanmeh
Copy link
Member

@chetanmeh chetanmeh commented Jul 26, 2019

Enable using api gateway with standalone mode (#4516).

Description

Enables launching api gateway with --api-gw option

java -jar openwhisk-standalone.jar --api-gw 

With -a flag following tasks would be performed

  1. Install route management actions for createApi, deleteApi and getApi
  2. Launch the redis server and wait for it to be ready
  3. Compute the host ip (see Host url logic section below)
  4. Launch the Api gateway container (at 3234 port by default) and pass the redis ip and local host ip

Host url logic

Due to issue in #4523 and apache/openwhisk-apigateway#345 we need to compute the actual ip for host.docker.internal and pass it as part of BACKEND_HOST env variable

Port Handling

This PR requires only 2 ports to be actually free 3233 for main server and 3234 for api gateway management port.

For redis and api gateway api port it tries to use std port (6479 for redis and 9000 for api). If they are not free it would try to allocate a random port and use them. This should minimize port conflict for end users

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@rabbah
Copy link
Member

rabbah commented Jul 26, 2019

Enables launching api gateway with -a option

-a is a little cryptic i think but dont have a better 1 letter suggestion... is there a long form --apigw or --gw option (of course those are longer)

@chetanmeh
Copy link
Member Author

There is long form --api-gw

@chetanmeh
Copy link
Member Author

chetanmeh commented Jul 26, 2019

To try out this feature follow steps below

# Fetch custom docker build of apigateway which has apache/incubator-openwhisk-apigateway#347 fixed
$ docker pull chetanmeh/apigateway

# Download the openwhisk-standalone jar
$ wget https://github.com/chetanmeh/incubator-openwhisk/releases/download/0.11/openwhisk-standalone.jar
$ java -Dwhisk.standalone.api-gateway.image=chetanmeh/apigateway -jar openwhisk-standalone.jar --api-gw

After this follow the steps as mentioned in gateway docs

@chetanmeh chetanmeh marked this pull request as ready for review July 30, 2019 10:22
@chetanmeh chetanmeh force-pushed the standalone-api-gw branch from 93ac4d3 to f1f18fa Compare July 30, 2019 10:24
@chetanmeh
Copy link
Member Author

Build now passed along with testcase for the gateway support in Standalone. @rabbah can you review once more

Copy link
Member

@rabbah rabbah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module Scala nits which I'm not going to write down, LGTM.

@chetanmeh chetanmeh merged commit 1f3504f into apache:master Aug 15, 2019
@chetanmeh chetanmeh deleted the standalone-api-gw branch August 15, 2019 20:19
BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
Enables support for API Gateway in Standalone jar

* Build and copy route management actions to standalone jar
* Install route management packages on startup
* Launches Redis and API Gateway Containers

To enable calls to be routed from within the Api Gateway container to Controller (running out of container) we need to determine the ip address of host. This is handled depending on the host OS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants