Skip to main content

Announcing Fenrir - Hypi's Serverless Platform

written by:
Courtney Robinson

Today, the Hypi team is proud to announce the availability of Fenrir. Our new serverless platform, designed to with simplicity and performance in mind!

Fenrir is built to be as simple, performant and un-intrusive as possible.

With today's announcement, we're making available support for Java, Python and NodeJS functions. We plan to release support for other languages like Ruby, Rust and others over the next few months.

What's more, we're making serverless accessible on our free plan. So you can test it out before deploying production workloads.

A set of complete examples are available in the Hypi serverless examples repository on Github We encourage you to give it a try today!

Hypi Container registry

At the center of our Fenrir platform is Docker. As Docker and container technologies have become a de-facto standard for packaging and deploying applications, we decided to leverage this. Customers will now have access to Hypi's Container Registry for deploying serverless functions.

To use it, login to Hypi's container registry using:

docker login hcr.hypi.app -u hypi

The username is always hypi, do not change it. When prompted for a password, copy the token from here.

Example Python

Create src/main.py with the content:

# request.env and request.args are available
# return the object you want the function to send as a response
# throw exceptions to indicate an error
async def invoke(request: dict):
print(request)
return request

Create a Dockerfile

FROM hypi/fenrir-runtime-python:v1

COPY src/main.py /home/hypi/fenrir/function/main.py
#If you have dependencies specified in requirements.txt then add a line like this
#RUN cd /home/hypi/fenrir/function; pip install -r requirements.txt
#OR just run pip install
#RUN pip install my-dependency

Example NodeJS

If you create src/main.js with the content:

/**
* @param input has env and args
* @param callback accepts two params, 1st one is the response to return and second is error if there is one
*/
function hellWorld(input, callback) {
console.log('Yeah, we got some input', input, input.env, input.args);
callback(input, null);
}

// Must export `main`
exports.main = hellWorld;

package.json

{
"name": "fenrir-runtime-nodejs-example",
"version": "0.1.0",
"scripts": {
"build": "docker build . -t hcr.hypi.app/nodejs-example/$VERSION",
"deploy": "docker push hcr.hypi.app/nodejs-example/$VERSION"
},
"dependencies": {
}
}

Dockerfile

FROM hypi/fenrir-runtime-nodejs:v1

ADD src/main.js /home/hypi/fenrir/function/
RUN /home/hypi/fenrir/build.sh

WORKDIR /home/hypi/fenrir/function

Example Java

package app.hypi.fn;

import java.util.Map;

public class Main {
public Map<String, Object> invoke(Map<String, Object> input) {
System.out.printf("ENV: %s", input.get("env"));
System.out.printf("ARGS: %s", input.get("args"));
System.out.flush();
return input;
}
}

Dockerfile

FROM hypi/fenrir-runtime-java:v1

ADD target/fn-*.jar /home/hypi/fenrir/function/fn.jar
#ADD target/lib/* /home/hypi/fenrir/function

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>app.hypi.fenrir.google</groupId>
<artifactId>fn-google-places</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>fn-google-places</name>
<url>http://maven.apache.org</url>

<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.google.maps</groupId>
<artifactId>google-maps-services</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>compile</includeScope><!--Don't include test dependencies-->
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<release>17<!--${java.version}--></release>
</configuration>
</plugin>
</plugins>
</build>
</project>

Build & Deploy

  1. Build your function docker build . -t hcr.hypi.app/my-fn:v1
  2. Deploy your function docker push hcr.hypi.app/my-fn:v1
  3. In your Hypi app at console.hypi.app reference your function in the schema like
type Query {
myFnName(a: Int, b: String, c: Float, d: Boolean, e: Json, f: MyType): Json @fn(name:"my-fn", version: "v1", env: ["abc"])
}
  1. Call the function with the GraphQL or REST API

Limits

The existing billing model for serverless remains unchanged and any remaining serverless time you have on your account is unaffected by this release. There is a new limit being introduced on the number of functions you can deploy to an account.

The limit is based on what the largest plan is within the account. For example, if you currently have 1 app with 1 API instance on the free plan, you will be allowed to deploy 1 function.

If you're a customer one one of our paid plans then regardless of how many instances you have, you get the limit from below based on the largest subscription on the account. So if you have two apps with 1 API instance each using the launch and scale plans, you will be allowed 50 functions. See the table below for how many functions are allowed depending on the largest plan in the account.

FreeLaunchGrowthScale
151550

Deprecating OpenWhisk

Our current customers have already been notified about the deprecation of OpenWhisk support in Jan 23. Existing customers will continue to have access to OpenWhisk until Dec 31 2024. Customers registering from Fri Nov 10th 2023 will not be able to deploy OpenWhisk based functions.

Why?

Hypi currently has support for serverless functions that is based on the open source framework OpenWhisk. Openwhisk was a great way to get advanced serverless capabilities across many runtimes into our platform but a few notable things lead to the decision to roll our own. First, the pace of OpenWhisk releases is dramatically slower than we'd like. Second, OpenWhisk backup is relatively complex and requires too much manual intervention from our team at times. Third, we needed tighter integration into our platform and we found ourselves at odds with the available OpenWhisk options.

Why not use an alternative? We considered others including KNative but opted not to after evaluating them. Complexity and the friction with our platform is a common reason.

Conclusion

In conclusion, serverless is a long term party of the Hypi platform. Today we're presenting the next iteration of that.

  • Tight integration with other parts of the platform
  • Leveraging Docker for packaging, distribution and runtime meant it is dramatically simpler for us and customers to use and operate.
  • Greater control and management of the release cycle to better fit out cadence
  • Little to no limit on what can be used as a function which makes it easier to address a wider set of use cases

Did I mention how simple it was for customers to use? Give Hypi Fenrir a try today.

Powered By Hypi.
Loading...
X

Still not convinced? Contact our sales team for a free demo, we’ll get you started

Make it happen! Access scalable platform for your customers needs.

Phone

By registering you agree to the Terms & Conditions