Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openfaas-faas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Team Jaz CS 598 CCC Final Project
openfaas-faas
Commits
46507778
Commit
46507778
authored
7 years ago
by
Alex Ellis
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add tips for adding functions.
parent
f78e1cde
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
TestDrive.md
+49
-0
49 additions, 0 deletions
TestDrive.md
with
49 additions
and
0 deletions
TestDrive.md
+
49
−
0
View file @
46507778
...
...
@@ -83,6 +83,55 @@ The original blog post also walks through creating a function:
*
[
FaaS blog post
](
http://blog.alexellis.io/functions-as-a-service/
)
## Add new functions to FaaS 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"`
}
```
Example:
For a quote-of-the-day type of application:
```
curl localhost:8080/system/functions -d '
{"service": "oblique", "image": "vielmetti/faas-oblique", "envProcess": "/usr/bin/oblique", "network": "func_functions"}'
```
For a hashing algorithm:
```
curl localhost:8080/system/functions -d '
{"service": "stronghash", "image": "functions/alpine", "envProcess": "sha512sum", "network": "func_functions"}'
```
### Delete a function at runtime
No support through UI at the moment, but the Docker CLI supports this:
```
$ docker service rm func_echoit
```
### Exploring the functions with `curl`
**Sample function: Docker Hub Stats (hubstats)**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment