Contents

Awesomify anything or anyone with OpenFaaS!

Updated on 2023-03-28

While I’ve been lurking about the OpenFaaS Community I haven’t really had the wherewithal to actually get myself knuckled-down to build something that might be classed as useful or fun. To remedy that I finally came up with a new idea for a function that I can publish into the FaaS Store. I’m calling this function “Awesomify”. It will take any text you throw at it and make it awesome!

A photo of a sign pointing to ‘awesome’ on the right, and ‘less awesome’ on the left

Photo by Jon Tyson on Unsplash

First thing I need is a Kubernetes cluster. After a quick trip down to Marks and Sparks to fill my trolly with juicy servers, I remembered that this is supposed to be serverless computing, plus M&S is a clothing store so I wouldn’t get servers there anyway. Putting the servers back on the shelves I instead fired up Google Cloud’s dashboard and ordered some Kubernetes with a side order of Chips (Fries for folk over the pond).

Following the OpenFaaS documentation and my serverless system is now fully deployed, and it was easy (mostly, I had a couple of hiccups from following the docs too closely which I’ve filed bugs about so they should get resolved soon).

Now to my function. Which language or framework should I use to build it? NodeJS? Pass. Go? Hmm, interesting idea, but nah. BASH? Now you’re talking; you can’t get more esoteric than that! Let’s write an entire function using BASH…

Photo of a laptop showing a text editor with computer source code

Photo by Luca Bravo on Unsplash

For my function to work, I need some sound clips. So pulling out my scissors I found a cassette of Tegan and Sara’s greatest hits and started hacking away. After 36 hours of toil, I finally had a series of clips that are usable and a large pile of wasted audio tape.

The only thing missing now is a voice generator. While I could use a cloudy serverless service such as Amazon’s Polly or Google’s Cloud TTS I decided that open source was the way forward. There’s a little-known project called Mycroft which creates a completely open source Intelligent Assistant like Amazon Echo, Google Assistant, or Apple Siri. They have released a piece of code they named “Mimic” to perform text to speech duties.

As an aside, my good friend Alan Pope from Canonical lent his voice to the Mimic TTS engine and the Mycroft assistant so this choice of engine was even more fun for me.

With the function taking shape I felt ready to publish a trial run onto my test cluster on Google Cloud. Two hours after publishing it and tweeting a few times the function has been hit 396 times and nobody has complained since I increased the timeouts and minimum instance count from their defaults.

Photo of an athlete getting ready to run in a sprint race

Photo by William Stitt on Unsplash

A Pull Request is now into the OpenFaaS Store GitHub repository to add the function for anybody to use with a simple clickity-doodle. If you don’t have or want your own instance of the function you may use the test that is still operational. You just need to point your web browser to https://openfaas.bowlhat.net/function/awesomify?q=OpenFaaS. By changing the text after the “?” you can tailor what is awesome to your own needs. (Make sure you replace spaces in the text with a + symbol because addresses need to be “URL Encoded”)

A few examples I’ve tried are:


My source code is published at GitHub.

Lucy is a prominent member of the WordPress, Ubuntu, WSL, and Snapcraft communities. She currently sits on the Ubuntu Membership Board and is a former Microsoft MVP.
Lucy is a prominent member of the WordPress, Ubuntu, WSL, and Snapcraft communities. She currently sits on the Ubuntu Membership Board and is a former Microsoft MVP.