Running Node.JS Unikernels

Javascript developers were some of the earliest adopters of things like containers, serverless and other infrastructure patterns so it's not surprising that unikernels interest them too.

Ready to run your first javascript unikernel using Node.JS? Great! Let's start. First download OPS:

curl -sSfL | sh
You can also build from the source if you prefer. This will install OPS the unikernel builder and orchestator. Now let's create a working directory:
mkdir testing && cd testing
Throw this single line of javascript into a file called hi.js:
console.log("hello from inside a unikernel!");
Now let's load up node and run this!
ops pkg load node_v11.15.0 -a hi.js
This loads up your unikernel inside of qemu, runs it and then exits. Cool! You just ran your first javascript unikernel. Want to try something bigger? Let's run a small http server. This time we'll specify a port of 8083.
ops pkg load node_v11.15.0 -p 8083 -f -n -a hi.js
Throw this code into the same file:
var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(8083, "");
console.log('Server running at');
Now we can hit it up with curl:
curl -XGET
It's important to note that in these samples we were actually using a node package but there are many more packages and more are being added - you can view them via the list command:
ops list
If you want to learn more or contribute check out OPS - star it, fork it, download it and let us know what you build!

Deploy Your First Open Source Unikernel In Seconds

Get Started Now.