40 lines
981 B
Bash
Executable File
40 lines
981 B
Bash
Executable File
#!/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 2 \
|
|
--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
|
|
|
|
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:
|
|
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
|
|
pass iol-user | faas-cli secret create iol-user
|
|
pass iol-pass | faas-cli secret create iol-pass
|
|
pass iol-api-secret | faas-cli secret create iol-api-secret
|
|
|
|
echo 'Success!' | faas-cli invoke figlet
|