Mirage is a programming framework for constructing secure, high-performance network applications across a variety of cloud computing and mobile platforms. Code can be developed on a normal OS such as Linux or MacOS X, and then compiled into a fully-standalone, specialised unikernel that runs under the Xen hypervisor. Since Xen powers most public cloud computing infrastructure such as Amazon EC2, this lets your servers run more cheaply, securely and finer control than with a full software stack.
This repository includes:
- a command-line tool to create and deploy applications with Mirage; and
types/, a library of type signatures that compliant applications use.
To work with Mirage, you'll need the following prerequisites installed:
- a working OCaml compiler (4.01.0 or higher).
- the OPAM source package manager (1.2.0 or higher).
- an x86_64 or armel Linux host to compile Xen kernels, or FreeBSD, OpenBSD or MacOS X for the userlevel version.
There are two stages to using
- a configure phase where OPAM package dependencies are satisfied.
- a build phase where the compiler and any support scripts are run.
mirage currently uses a configuration file to build a Mirage unikernel. While
we're documenting it all, please see the
lib_test directory in this repository
for the regression examples. The latest instructions are also to be found at
Configuring Mirage Applications
Provided that one and only one file of name
<foo> can be
any string) is present in the current working directory, the command:
will configure your project. It will generate a
the appropriate boilerplate for your chosen platform.
To configure for the Unix-direct target (using tap interfaces), do:
mirage configure --unix
To build for the Xen target, do:
mirage configure --xen
Building Mirage Applications
To compile your application, use:
Running Mirage Applications
Every mirage backend will have a different way to be deployed. On Unix, the unikernel will run as a Unix process, using a virtual interface (tap) if needed:
On Xen, the unikernel will run as a virtual machine. For instance, using the
xl command-line tool:
xl create <project-name>.xl
Configuration files for
libvirt are also generated by the tool (see
<project-name>.xe in the build
Compiling to Xen and deploying to the cloud
In order to deploy a Mirage unikernel to Amazon EC2, you need to install the AWS
tools on your machine, build a unikernel with the
--xen option and then use
ec2.sh script (in directory
script) in order to register your kernel
with AWS. Then you can start your kernel with the web interface to AWS or any
other means AWS provides to start EC2 instances.