35 lines
690 B
Bash
35 lines
690 B
Bash
|
#!/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
|