Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

First Steps

This section will tell you a little bit about what you can do with Clova, as well as how to get set up with a basic working directory to build from.

The Basics

Clova uses the filesystem you create on your local machine to manage and manipulate the state of things on targets. You can use it to synchronise files and run commands on targets.

Because everything revolves around the filesystem, you can create a single source of truth from which you control your entire network. You can also add it to version control, allowing you to maintain consistency if managing targets from multiple machines as well as keep a history of all the changes you’ve made to your network. Made a mistake somewhere? No problem, just undo your changes and re-sync. Git to the rescue!

Fundamentally, you write a small amount of configuration alongside the files necessary to deploy your service and Clova handles the rest!

A Working Directory

Theoretically, so long as you give it the configuration it needs, Clova can work with any directory structure you desire. We recommend something similar to the following to get started:

.
├── clova.toml
├── service1/
│   ├── service.clova.toml
│   └── (other service files)
└── service2/
    ├── service.clova.toml
    └── (other service files)

Here, we have a top-level configuration (clova.toml) and directories representing each service we wish to deploy with names that correspond to the name we’d like to give our service. Each service directory contains a configuration file with a service definition (service.clova.toml) and the other files necessary for the service to function.

When we run a command through Clova on one of these service directories, its entire contents will be synchronised to the configured target at the configured location. Any commands we run will then be executed from this directory on the target.

More on configuration later!

Initialising A Directory

Clova can create a basic working directory for you with the following command:

clova init /path/to/directory

This will do a couple of things:

  • Create the directory you specified if it doesn’t already exist.
  • Create a top-level configuration.
  • Create a sample service directory with a sample service definition.
  • Initialise the directory you specified as a Git repository, unless you specify otherwise with --no-git-init or -g.

Once you’ve done that, cd into the directory and have a look around before moving on to the next section!