Skip to content
This is the documentation for main, which is not released yet. Read the latest.

Installation

Dicer runs on one Linux host. The daemon, dicerd, runs as a systemd service, and the dicer command line talks to it. There are three ways to install them:

  • From packages, on Debian, Ubuntu, Fedora, RHEL and its rebuilds, and openSUSE.
  • With Ansible, which installs the same packages.
  • From source, with the install script, on any other distribution.

Requirements

The host

  • Linux on x86_64 or aarch64, with systemd.
  • KVM: /dev/kvm must exist. On a cloud virtual machine, nested virtualisation must be turned on.
  • erofs-utils, for mkfs.erofs, and e2fsprogs, for mke2fs.
  • iptables.
  • Where firewalld runs, as on Fedora, RHEL and openSUSE, the dicer firewalld zone. The package and the install script both install it. See Networking.

The package brings erofs-utils, e2fsprogs and iptables with it. For a production server, see Choosing hardware and Tuning a host first: the filesystem under /var/lib/dicer decides how fast snapshots and forks are.

To build from source

  • Go 1.27.2 or later, git, make, curl and zstd.
  • gh, logged in with gh auth login. The build downloads the default kernel from the private releases of dicer-kernel, so the account needs access to that repository.

Distributions often carry an older Go, so install it from go.dev/dl. Install gh as its instructions say. Install everything else, the host’s tools included, with the distribution’s package manager:

$ sudo apt install erofs-utils e2fsprogs iptables git make curl zstd

Check that KVM is there:

$ ls -l /dev/kvm
crw-rw---- 1 root kvm 10, 232 Sep 24 09:12 /dev/kvm

Install from packages

Releases are published to apt and RPM repositories at pkg.dicer.sh, signed with Dicer’s key. Add the repository, then install the dicer package:

$ sudo install -d -m 0755 /etc/apt/keyrings
$ curl -fsSL https://pkg.dicer.sh/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/dicer.gpg
$ echo "deb [signed-by=/etc/apt/keyrings/dicer.gpg] https://pkg.dicer.sh/deb stable main" \
    | sudo tee /etc/apt/sources.list.d/dicer.list
$ sudo apt update
$ sudo apt install dicer

The package enables and starts the daemon.

The package installs:

  • dicer and dicerd, in /usr/bin;
  • the dicerd service;
  • the configuration, /etc/dicerd/config.yaml;
  • a sysctl setting that turns IPv4 forwarding on;
  • the dicer firewalld zone;
  • shell completions for bash, zsh and fish.

It also creates the dicer group. Files and environment lists where each file goes. The package files are also attached to each release.

Install with Ansible

The konradasb.general collection sets hosts up with Ansible, from the packages above. Install it where you run Ansible:

$ ansible-galaxy collection install konradasb.general

It has two roles:

  • konradasb.general.dicerd sets a host up as the package does: it adds the repository, turning EPEL on where it is needed, installs dicer, writes /etc/dicerd/config.yaml, and starts the daemon.
  • konradasb.general.dicer installs only the command line, from the release archives, on a Linux or macOS machine that manages hosts elsewhere, and writes its users’ remotes.

Example playbook:

dicer.yml
- name: Set up the Dicer hosts
  hosts:
  - dicer_hosts
  become: true
  roles:
  - role: konradasb.general.dicerd
    vars:
      dicerd_group_members:
      - alice
      dicerd_config:
        server:
          listen: 0.0.0.0:7443
$ ansible-playbook -i inventory dicer.yml

dicerd_config holds the keys of the configuration. The role checks it with dicerd validate before it replaces the file. When the file changes, the role restarts the daemon, which leaves the instances running.

Each role’s README lists its variables, and so does ansible-doc -t role konradasb.general.dicerd.

Use the role on a host that has no Dicer yet, or that has the package. Don’t use it on a host the install script set up: the script’s service, in /etc/systemd/system, takes precedence over the package’s, so the daemon would go on running the binaries the script built.

Install from source

$ curl -fsSL https://raw.githubusercontent.com/hostinger/dicer/main/scripts/install.sh | bash

The script asks for sudo when it needs it. Then it:

  1. checks for the build tools, mkfs.erofs, mke2fs, systemd and KVM;
  2. turns on IPv4 forwarding, now and at every boot;
  3. builds dicer and dicerd from the main branch, with the hypervisors and guest binaries that dicerd carries;
  4. stops the daemon if it is running, and installs both binaries to /usr/local/bin;
  5. creates the dicer group, whose members can use the daemon without sudo;
  6. writes a configuration, /etc/dicerd/config.yaml, unless there is one;
  7. installs dicerd.service, the same unit the packages install with dicerd’s path changed, and, where firewalld is installed, the dicer zone;
  8. enables and starts the daemon.

--ref builds a branch, tag or commit instead of main:

$ curl -fsSL https://raw.githubusercontent.com/hostinger/dicer/main/scripts/install.sh | bash -s -- --ref v0.3.0

Use Dicer without sudo

The daemon’s socket belongs to root and the dicer group. Join the group, then start a new login shell, or run newgrp dicer in this one:

$ sudo usermod -aG dicer $USER
$ newgrp dicer

The rest of these docs assume you are in the group. If you are not, run each dicer command with sudo.

A member of the dicer group can do anything with the daemon, which amounts to root on the host. Add only users you would give root.

Verify

$ systemctl status dicerd
$ dicer version
$ dicer info
$ dicer doctor

The service should be active (running). dicer version shows the command line’s version and the daemon’s. dicer info shows the daemon, the hypervisors it carries, its default kernel and network, and how much of the host’s CPU, memory and disk it may give instances.

dicer doctor checks that the host can run instances: KVM, IPv4 forwarding, the firewall, the tools the daemon needs, the uplink and the free disk space. It then boots a small test instance, checks that the instance can run a command and reach the internet, and deletes it. The test instance boots on Cloud Hypervisor, unless --hypervisor-type names another hypervisor:

$ dicer doctor
compute-1 (dicer 0.4.0)

Host
  ✓ KVM                              /dev/kvm is usable
  ✓ IP forwarding                    IPv4 forwarding is on
  ✓ Firewall                         iptables (nf_tables) works
  ✓ Tools                            mkfs.erofs and mke2fs are installed
  ✓ Uplink                           eth0, by the default route
  ✓ Disk                             212 GiB free in /var/lib/dicer

Instances
  ✓ Boot (cloud-hypervisor v53.0.0)  booted, ran a command and stopped in 1.1s
  ✓ Internet access                  the test instance reached the internet

No problems found.

When a check finds a problem, dicer doctor says what to do about it, where it can. If any check fails, it exits with an error. Warnings, such as little free disk space, do not make it fail.

To manage the host from another machine, see Remote access.

Upgrade and remove

Operating the daemon shows how to upgrade Dicer, without stopping running instances, and how to uninstall it, for each way of installing it.

Next steps