Serverless Functions with Gluon CloudLink and Oracle Fn

Over the last year or so there has been a growing buzz around ‘serverless’ functionality, also known as ‘Functions as a Service’ (or FaaS). This often simply boils down to being able to execute code without going through the hassle of setting up and managing infrastructure (and does indeed still rely on servers! 🙂 ).

In the case of mobile applications, serverless functions add a number of benefits:

  • The less code on the client, the lesser the chance of client-side issues – this reduces the need for deploying hot fixes to customers and end users.
  • Speaking of which – client code is hard to update – and it is more than just sending a new build up to the various app stores. Changes require internal review and acceptance testing, and only then deployment to the various app stores, which typically takes days. In case of hot fixes, this is often not acceptable.
  • Client code works with simple objects, where enterprise code often require more complex calls and flows, using more parameters and configurations. The code to convert the enterprise result into a simple client object can be executed as a Function on a remote server, rather than burdening the client and the network with the overhead.

For this reason, Gluon CloudLink supports remote functions. Up until today, Gluon CloudLink already enabled client apps to call into it to run a remote function, and it could then transparently call zero or more REST endpoints and zero or more Amazon AWS Lambda funcions.

At the JavaOne 2017 conference, Oracle announced the Fn Project, an open source serverless functions platform that runs anywhere and supports running functions in every programming language. One of the major benefits of the Fn Project is that functions can be deployed on any system, including your local development system. That makes it very easy for developers to have short write-test-debug cycles.

As of this week, Gluon CloudLink has support for Fn Functions. Customers can write and build their own Fn functions, push them to a Docker repository, and have them run inside Gluon CloudLink’s infrastructure on a self-hosted Fn platform, when a mobile application requests them.

We will create more samples and tutorials for this. Meanwhile, in a nutshell this is how it works:

  1. Download/Install the Fn Project. This allows you to create and test your function locally, before you push it to a docker repository.
  2. Write your Fn function. A list of examples can be found in the GitHub repository.
    • mkdir myfunction
    • cd myfunction
    • fn init --name myfunction --runtime java
    • fn run
  3. Build and push your Fn function to a public docker repository, i.e. Docker Hub. Make sure you are correctly logged in (using docker login) before pushing the Fn function.
    • fn build
    • fn push --registry DOCKER_HUB_USERNAME
  4. Create a remote function in Gluon CloudLink referencing the image in the docker repository
  5. Test the remote function by clicking the Test button
  6. Call the remote function from a Mobile Application

We will keep extending the integration with more functionality in the near future. We consider serverless functions as a key enabler for the mobile enterprise, and we are making sure our products allow developers to benefit from new developments in this area. Support for Remote Functions has been available in Gluon CloudLink from the very beginning, and we are confident our technology is mature and future-proof.