faas/build.sh

37 lines
825 B
Bash
Raw Normal View History

2022-07-16 19:56:35 +00:00
#!/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
2022-07-19 08:49:10 +00:00
ssh -o "StrictHostKeyChecking no" root@$IP mkdir -p /var/lib/faasd/secrets
ssh root@$IP "echo $(pass faas.ralsina.me) > /var/lib/faasd/secrets/basic-auth-password"
scp setup.sh root@$IP:
2022-07-16 19:56:35 +00:00
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