working state
This commit is contained in:
parent
464a4d32d5
commit
881b698966
18
README.md
18
README.md
@ -1,9 +1,13 @@
|
|||||||
|
# WHAT?
|
||||||
|
|
||||||
Automate creating a [Faasd](https://github.com/openfaas/faasd/) image.
|
Automate creating a [Faasd](https://github.com/openfaas/faasd/) image.
|
||||||
|
|
||||||
Goal is to run this image via
|
Goal is to run this image via
|
||||||
[ignite](https://github.com/weaveworks/ignite) which runs it in a
|
[ignite](https://github.com/weaveworks/ignite) which runs it in a
|
||||||
[firecracker](https://firecracker-microvm.github.io) microvm.
|
[firecracker](https://firecracker-microvm.github.io) microvm.
|
||||||
|
|
||||||
|
# WHY?
|
||||||
|
|
||||||
I need to do this because I need to run Faasd in the same machine as
|
I need to do this because I need to run Faasd in the same machine as
|
||||||
dockerized services and according to its documentation that shouldn't
|
dockerized services and according to its documentation that shouldn't
|
||||||
be done because both use incompatible versions of underlying dependencies.
|
be done because both use incompatible versions of underlying dependencies.
|
||||||
@ -11,3 +15,17 @@ be done because both use incompatible versions of underlying dependencies.
|
|||||||
Also in this way resource usage of Faasd and all "lambdas" in it is capped
|
Also in this way resource usage of Faasd and all "lambdas" in it is capped
|
||||||
by the VM resources, and the rest of the system is sort-of-protected
|
by the VM resources, and the rest of the system is sort-of-protected
|
||||||
by the VM sandbox.
|
by the VM sandbox.
|
||||||
|
|
||||||
|
# HOW?
|
||||||
|
|
||||||
|
Assuming you have ignite and faas-cli installed:
|
||||||
|
* replace `id_rsa.pub` with yours
|
||||||
|
* run setup.sh
|
||||||
|
|
||||||
|
You will end up with:
|
||||||
|
|
||||||
|
* A running ubuntu-based VM with faasd installed and running
|
||||||
|
* Ssh enabled and accessible via that key
|
||||||
|
* The faasd port exposed as localhost:8082
|
||||||
|
* Your account logged into faasd
|
||||||
|
* The figlet function installed and working
|
||||||
|
34
build.sh
Executable file
34
build.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh -x
|
||||||
|
# Create and configure a VM with faasd in it
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NAME=faas
|
||||||
|
|
||||||
|
waitport() {
|
||||||
|
while ! nc -z $1 $2 ; do sleep 1 ; done
|
||||||
|
}
|
||||||
|
|
||||||
|
sudo ignite create weaveworks/ignite-ubuntu \
|
||||||
|
--cpus 1 \
|
||||||
|
--memory 1GB \
|
||||||
|
--size 10GB \
|
||||||
|
--ssh=id_rsa.pub \
|
||||||
|
-p 8082:8081 \
|
||||||
|
--name $NAME
|
||||||
|
|
||||||
|
sudo ignite vm start $NAME
|
||||||
|
|
||||||
|
IP=$(sudo ignite vm ls | grep faas | cut -f9 -d\ )
|
||||||
|
waitport $IP 22
|
||||||
|
|
||||||
|
scp -o "StrictHostKeyChecking no" setup.sh root@$IP:
|
||||||
|
ssh root@$IP sh setup.sh
|
||||||
|
|
||||||
|
# Login
|
||||||
|
export OPENFAAS_URL=http://localhost:8082
|
||||||
|
ssh root@$IP cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login --password-stdin
|
||||||
|
|
||||||
|
# Setup test function
|
||||||
|
faas-cli store deploy figlet
|
||||||
|
|
||||||
|
echo 'Success!' | faas-cli invoke figlet
|
1
id_rsa.pub
Normal file
1
id_rsa.pub
Normal file
@ -0,0 +1 @@
|
|||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCiU1I8w5Uc7OFBYRpUHHepel78QHchU8Sw8FdXMiDAhZ1e8Kr3W4zk8JUQzXYYGbzvgLgRpcNzPSar3X0FV5YBdYXgstJEfjGuadA1ZooH1epIMhjrcmJHchLk19QdenNahWpngg58Hn9ysKhXrXnR4ppppyzIO3sSNBETSk2z2lD+sqVH1sWKCJCEo8wcAat7nA7oY//N57qe2c/KQ+RcKnWYIZZU5943NkGfFn+WmEygeRZPUbZjFR3w+WYiFD9Vn2Xp8BLzeCfId7B0wtLvEo8VIcTvi+GaQur9Pdu/SPUvyRkkllIXspwORlx7gd5tV5JzqzYwXrD4A9BABO0ny4Akae4gpUz2SWnH8EDI1BiQFBhk++7XgmC/E+caSN5qVISF/RMemiVBumSeifiG1OcZettk3/O6O6349nxUMHBZ8TVjk2Vl/u9N2eTGLc3puS0ixXmJqr4pSouoqQIH5sJFeLY71/bjLFz33VWqRg/++CcVcQySUpASlS5386c= ralsina@pinky
|
Loading…
Reference in New Issue
Block a user