Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] hot reload functions #1636

Closed
1 of 3 tasks
mstrYoda opened this issue Feb 25, 2021 · 1 comment
Closed
1 of 3 tasks

[FEATURE REQUEST] hot reload functions #1636

mstrYoda opened this issue Feb 25, 2021 · 1 comment

Comments

@mstrYoda
Copy link

My actions before raising this issue

Expected Behaviour

What about supporting hot-reload functionality for local test purposes? So this allows faster execution cycle for test purposes.

I would like to test my function without rebuilding&pushing an image on every change something like below:

faas-cli up-test my-function -f function.yaml 

I am imagining a behavior like skaffold does.

Current Behaviour

Currently we need to run faas-cli up and it builds & pushes docker image to registry.

Possible Solution

When we run faas-cli up-test -f function.yml it can do the following steps:

  • spawn a pod with a test image like golang:alpine-x
  • watch the current directory
  • push changes to test image
  • run new codes

I am not aware of internals of openfaas so the solution I describe above may sound meaningless. But I believe that functionality can supported.

Context

Testing etc.

@alexellis
Copy link
Member

alexellis commented Feb 25, 2021

Thanks for your interest in OpenFaaS.

A summary of the discussion on Slack with yourself and several others.

There is a WIP but abandoned PR (no changes in 1 year) in the faas-cli for this, to rebuild upon save. Some users also use tilt for the same purpose. openfaas/faas-cli#763

A live-reload feature is beyond the scope of the current roadmap so I'll close this issue out and point you at something like Okteto - they have a few guides for "hot reload" where they do relatively insecure tricks that you won't want in production, but can make development faster. They also have a good debug story.

For the fastest development you may want to build / run the container locally without deploying it to openfaas. Here's an example with the node12 template: https://simonemms.com/blog/2020/08/12/live-reload-for-openfaas/

You should also consider using unit tests to verify your code before doing a build. That's one of the fastest options available.

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

No branches or pull requests

2 participants