Serverless architectural design for IoT systems
Install Docker CE for Ubuntu here
Install Docker CE for Raspbian here
Install faas-cli. Instructions here
Python3 installed with the yml module (this is used to create the configuration files)
Template for my_rig_config.json
{
"name" : " pi001" ,
"maxCapacity" : 1001 ,
"thing" : true ,
"localUrl" : " http://192.168.78.1" ,
"localPort" : 8080 ,
"serverUrl" : " http://192.168.78.130" ,
"serverPort" : " 8080" ,
"prometheusPort" :9090 ,
"write_timeout" : 10 ,
"read_timeout" : 10 ,
"mongo" : " openfaas-db-mongodb"
}
Clone the openfaas repository
$ git clone https://github.com/openfaas/faas && \
cd faas && \
git checkout 0.7.7 && \
cd ..
Initiate a docker swarm. In some cases, the flag --advertise-addr might be needed to specify the advertised address.
Deploy faas and remove unnecessary functions that come preinstalled.
Continue instalation process process for IoT swarm or Cloud swarm
(Cont.) Instalation for local swarm (IoT)
Create a mongodb Docker Service
$ docker service create --network=func_functions --name openfaas-db-mongodb --publish 27017:27017 mongo mongod
Create configuration files
$ python3 create_my_functions.py sample-functions/stack.yml
Deploy my functions.
$ sudo ./deploy_my_functions.sh
(Cont.) Instalation in the cloud swarm (Server)
Create configuration files
$ python3 create_my_functions.py sample-functions/stack.yml
Deploy my functions.
$ sudo ./deploy_my_functions.sh --server