Add example of developing multiple functions locally#99
Conversation
grant
left a comment
There was a problem hiding this comment.
Looks like a good skaffold example.
I'm going to approve but ask that we specifically don't suggest that this solves the multiple functions on a single port issue. This example is an opinionated way to achieve that but requires many dependencies that an existing Functions user is likely not going to want in their application.
| @@ -0,0 +1,138 @@ | |||
| # Multiple Cloud Functions, Same Host | |||
There was a problem hiding this comment.
The H1 here and example content are not exactly what I would imagine.
Similar to #98 (comment), I wouldn't expect that the minimum requirement to run multiple functions on the same host involves Kubernetes/minikube/skaffold. I'd expect a lighter weight setup, like how the FF is very lightweight – maybe require 1 dependency like Docker.
That said, can we change this example / PR title to something more aligned to the content, like "Developing Multiple Functions using Minikube and Skaffold"
|
|
||
| ## Introduction | ||
|
|
||
| This example shows you how to deploy multiple Cloud Functions to a single host. |
There was a problem hiding this comment.
This example shows how to develop multiple functions on a Kubernetes cluster with a single host.
- We're not using the Cloud Functions product anymore (FF's can be deployed to many environments).
- This seems like an opinionated way for a multiple function, single host app. Let's label that, as we may want a simpler multiple function, single host app in a different example.
|
Hi all, Just want to provide some insights on our in-house solution to enable supporting multiple functions on the same Those two requests would both be executed by the Now we are invoking the functions-framework like this: functions-framework --target dispatcher --port 8081 --debug The def dispatcher(request):
path = request.path
path = path[1:] # Remove prefix / from path
# Introspect all methods for potential execution
potential_methods = globals().copy()
potential_methods.update(locals())
# Try to acquire corresponding method associated to the URL path
method = potential_methods.get(path)
if not method:
raise NotImplementedError("URL Path %s not implemented" % path)
return method(request) |
Fixes #98.