Docker image listening on modification in a Minio bucket and calling an openfaas function
352
Easy deployment of Deep Learning predictions as functions thanks to OpenFaas awesome projet :-)
List of current functions :
More to come...
You can create a single-host Docker Swarm on your laptop with a single command. You don't need any additional software to Docker 17.05 or greater. You can also run these commands on a Linux VM or cloud host.
This is how you initialize your master node:
# docker swarm init
If you have more than one IP address you may need to pass a string like --advertise-addr eth0 to this command.
Take a note of the join token
Log into your worker node and type in the output from docker swarm init on the master. If you've lost this info then type in docker swarm join-token worker and then enter that on the worker.
It's also important to pass the --advertise-addr string to any hosts which have a public IP address.
Note: check whether you need to enable firewall rules for the Docker Swarm ports listed here.
git clone https://github.com/yogeek/deeplearning-as-a-function.git
./install.sh
Your functions are available !
Classify an image with darknet :
wget https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/%C3%81guila_calva.jpg/1200px-%C3%81guila_calva.jpg -O eagle.jpg
curl localhost:8080/function/darknet --data-binary @eagle.jpg
or with faas-cli
cat eagle.jpg | faas-cli invoke darknet
To use in production mode, follow the guide to lock-down OpenFaas with a reverse proxy like Traefik for example.
The following script will :
chmod u+x install.sh
./install-secure.sh
Test :
curl -X POST http://localhost/function/darknet --data-binary @eagle.jpg
401 : Acces Denied
curl -u user:password -X POST http://localhost/function/darknet --data-binary @eagle.jpg
OK !
Content type
Image
Digest
Size
28.3 MB
Last updated
over 8 years ago
docker pull yogeek/filelistener