Giter Club home page Giter Club logo

Comments (10)

alexellis avatar alexellis commented on May 13, 2024

Add a new function at runtime.

Option 1

Edit the docker-compose stack file, then run ./deploy_stack.sh - this will only update changed/added services, not existing ones.

Option 2

To attach a function at runtime you can use the "New function" button on the portal UI at http://localhost:8080/

Option 3

A HTTP post can also be sent via curl etc to the endpoint used by the UI (HTTP post to /system/functions)

// CreateFunctionRequest create a function in the swarm.
type CreateFunctionRequest struct {
	Service    string `json:"service"`
	Image      string `json:"image"`
	Network    string `json:"network"`
	EnvProcess string `json:"envProcess"`
}

Delete a function at runtime

No support through UI at the moment, but the Docker CLI supports this:

$ docker service rm func_echoit

from faas.

vielmetti avatar vielmetti commented on May 13, 2024

Working!

screen shot 2017-03-24 at 10 39 48 am

from faas.

alexellis avatar alexellis commented on May 13, 2024

Great! Here's the curl method:

curl localhost:8080/system/functions -d '
{"service": "oblique", "image": "vielmetti/faas-oblique", "envProcess": "/usr/bin/oblique", "network": "func_functions"}'

or

curl localhost:8080/system/functions -d '
{"service": "stronghash", "image": "functions/alpine", "envProcess": "sha512sum", "network": "func_functions"}'

from faas.

vielmetti avatar vielmetti commented on May 13, 2024

Blog post writeup, which points back here:

http://vielmetti.github.io/post/2017/2017-W12-4-oblique-strategy-as-a-service/

from faas.

alexellis avatar alexellis commented on May 13, 2024

Hi @vielmetti , thanks for this blog!

I had a couple of additional ideas:

  • Do you want to add a link in community.md? (PR)
  • Please could you put a screenshot of the Gateway API on your blog post?
  • Do you have a link to the Dockerfile or repo containing the oblique ideas code or recipe?

Thanks,

Alex

from faas.

vielmetti avatar vielmetti commented on May 13, 2024

Thanks Alex! I'll add some screen shots and will get the repo set up. When that is all properly handled I will do a PR for community.md .

from faas.

alexellis avatar alexellis commented on May 13, 2024

I've also added the feedback to the TestDrive guide. https://github.com/alexellis/faas/blob/master/TestDrive.md

from faas.

vielmetti avatar vielmetti commented on May 13, 2024

Alex, have you seen ever the issue of replicas spinning down? See this snapshot of the two functions I added through the API:

ID            NAME                   MODE        REPLICAS  IMAGE
4eg36gwkpx5i  func_base64            replicated  1/1       functions/alpine:latest
9jmsdlqjuobf  func_echoit            replicated  1/1       functions/alpine:latest
eof3v1jxszwl  func_markdown          replicated  1/1       alexellis2/faas-markdownrender:latest
fned1yerhdyf  func_alertmanager      replicated  1/1       quay.io/prometheus/alertmanager:latest
jyymi2er04hx  func_decodebase64      replicated  1/1       functions/alpine:latest
kpbu0ktf0iqc  func_nodeinfo          replicated  1/1       alexellis2/faas-nodeinfo:latest
lj7j5sas6j0q  func_webhookstash      replicated  1/1       alexellis2/faas-webhookstash:latest
pjc92ptpu8vx  func_prometheus        replicated  1/1       quay.io/prometheus/prometheus:latest
pt6kncp6fyc4  func_alexacolorchange  replicated  1/1       alexellis2/faas-alexachangecolorintent:latest
sbzwtyxgotmv  stronghash             replicated  0/1       functions/alpine:latest
se05h62iawvc  func_wordcount         replicated  1/1       functions/alpine:latest
xm4trevb2n2v  func_hubstats          replicated  1/1       alexellis2/faas-dockerhubstats:latest
yithgmf2il1r  oblique                replicated  0/1       vielmetti/faas-oblique:latest
zesojp59a4ao  func_gateway           replicated  1/1       functions/gateway:latest

Is the func_ prefix meaningful in this case to make sure things start up properly, or keep running?

from faas.

alexellis avatar alexellis commented on May 13, 2024

If you enable experimental mode you can look at the logs with docker service logs. Have you left this running on your laptop since Friday?

The func_ prefix is added by Docker when using the stack file to create the initial set of functions, it's not used by FaaS to identify functions.

Temporarily you could try docker service rm and re-creating.

from faas.

alexellis avatar alexellis commented on May 13, 2024

Docs updated, thanks for this issue @vielmetti . Closing now.

from faas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.