Web Development 701 ~ Deploying with Digital Ocean
Now that we have built the function, which was covered in the last post, it’s time to deploy it. For deployment we will be using digital ocean for a couple of reasons. First it’s much easier than setting up instances in the larger cloud providers like GCP, AWS, or Azure. Second digital ocean has an OpenFaas one-click droplet.
The first thing to do is to ssh into the droplet via ssh root@<IP address>
. Then we are prompted to press enter to start the installation process. After the installation process finishes we run the command curl -sSL https://cli.openfaas.com | sudo sh
. Now to log into the webui via <IP address>:8080
and authenticating with the credentials given in the terminal.
To deploy the function we created all we need to is to go to deploy new function
in the webui -> click manually
-> specify the docker image that we uploaded when creating the function (oglinuk/sbh
). That’s it!
Now to test the function invocation by going to ~
<IP address>:8080/function/sbh?query=plaintext=test,nrots=3,seed=3
.
We get 3abb07b98dff27c0cae03ed4f13b9f0f1a2e6b25230ea26626cc941d9a4ea2c9
which indicates it worked!
All done!