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!
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…
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.
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.
And we’re off to the races!
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:
- and of course, I had to add one
formy friend whose voice I used https://openfaas.bowlhat.net/function/awesomify?q=Alan+Pope