I recently discovered that the faas-cli
allows you to append your function’s yaml to an existing file when generating a new function. And that faas-cli up
does the build, push and deploy for you.
The way I always did it:
Usually, I will go through this flow: create, build, push, deploy, when creating 2 functions that will be in the same stack:
1 2 3 4 5 6 7 |
|
And for my other function:
1 2 3 4 5 6 7 |
|
And then you are ready to invoke those functions.
The new discovered way
So recently I discovered that you can append the yaml definition of your function to an existing yaml file, and use faas-cli up
to build, push and deploy your functions:
Generating the first function:
1 2 3 4 5 |
|
Now that we have fn-foo.yml
in our current work directory, we will append the second function the that file:
1 2 3 4 5 6 |
|
Now, when using faas-cli up
it expects by default that the filename is stack.yml
which we can change with -f
but to keep this as easy as possible, we will change the filename to stack.yml
:
1
|
|
At the moment, our stack.yml
will look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Deploying our functions is as easy as:
1 2 3 4 5 6 7 8 9 10 11 |
|
Simply amazing. OpenFaaS done a great job in making it as simple and easy as possible to get your functions from zero to deployed in seconds.