Introduction

What is LayerCI?

LayerCI is a cloud-hosted DevOps platform that creates a new VM for every code change in seconds instead of minutes.

What are LayerCI VMs useful for?

Many DevOps tasks can be solved in seconds if you can create a VM quickly:

  • Staging environments are ready in seconds because the new VM contains a cached database.
  • It’s easy to run E2E tests in parallel if you can duplicate the entire test VM.
  • Build and push your container images effortlessly with the same version of Docker you use in production.

How is LayerCI different from a traditional cloud provider?

LayerCI is built as a DevOps platform, and not for hosting production code.

Our VMs use memory snapshotting to work like Docker containers. They’re faster and more developer friendly than a traditional VM.

We can create a VM per-commit because we automatically hibernate them when they’re not be used.

Because the configuration looks like a Dockerfile, you don’t need to configure a complicated build process either.

You simply write a Layerfile, similar to a Dockerfile, and we’ll use memory snapshots to automatically reuse the work done the last time the pipeline ran.

What does installation look like?

We integrate seamlessly with GitHub. Getting a “hello world” VM created only takes three steps:

  1. Log in to LayerCI with your GitHub account
  2. Install LayerCI onto a relevant source code repository.
  3. Create a file named ‘Layerfile’ anywhere in your repository

Try this file to get started:

FROM vm/ubuntu:18.04

RUN echo "hello world!"

The easiest way to get started is to try our interactive tutorial. It takes about five minutes in total.

Use-cases

LayerCI is an all-in-one devops platform, but we provide three main value propositions to our users:

  1. Run e2e tests on every commit.
  2. Collaborate easier with per-PR staging environments.
  3. Set up CI/CD to build and deploy to production

Installation

Layer is very simple to set up. It only takes three steps:

  • Sign up (with buttons to the top right, if not already signed in.)
  • Install Layer onto a relevant source code repository (e.g., GitHub)
  • Create a file named ‘Layerfile’ anywhere in your repository

Per-use-case examples

We’ve built a simple full-stack chat messaging example based on Slack, it includes three layerfiles:

  1. Run e2e tests on every commit:

  2. Per-commit demo environments:

  3. Build and push Docker images:

Configuration

Layerfiles

There are a few ways of thinking about these files named ‘Layerfile’:

  1. Auto-discovered Dockerfiles that build entire virtual machines instead of containers, just as quickly.
  2. Define a tree of virtual machines. Each subsequent layer can inherit all the running processes in its parents.
  3. Trigger specific actions like build, push, test, and deploy in parallel every time you push new code.

A sample


# Start with an ubuntu base image
FROM vm/ubuntu:18.04

# Copy the file named 'file' from the repository to the destination 'hello'
# in the continuous staging environment.
COPY file hello

# 'cat' is a unix directive that prints the contents of a file.
# You could just as easily run a script that runs tests, deploys, or starts a database.
RUN cat hello

Layers

Behind the scenes, Layerfiles define a linear series of “layers” that stack on top of each other starting at the top of the Layerfile. After every 20 seconds, we’ll snapshot all the files and processes in the VM and store them for later. In practice, this means that we’ll be able to avoid re-running repetitive steps like database migrations the next time that you push code.

Unlike the Docker cache, we monitor all the files that are read by any process at the system level. We’ll only re-run a layer if we can’t find a previous one which agrees on your commit with the repository’s files.

Practically, layers mean that all you have to do is put expensive steps as high up in a Layerfile as possible, and we’ll skip as many steps as possible the next time you push code.