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/kvmmust exist. On a cloud virtual machine, nested virtualisation must be turned on. erofs-utils, formkfs.erofs, ande2fsprogs, formke2fs.iptables.- Where firewalld runs, as on Fedora, RHEL and openSUSE, the
dicerfirewalld 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,curlandzstd. gh, logged in withgh 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:
diceranddicerd, in/usr/bin;- the
dicerdservice; - the configuration,
/etc/dicerd/config.yaml; - a sysctl setting that turns IPv4 forwarding on;
- the
dicerfirewalld 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.dicerdsets a host up as the package does: it adds the repository, turning EPEL on where it is needed, installsdicer, writes/etc/dicerd/config.yaml, and starts the daemon.konradasb.general.dicerinstalls 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:
- 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:
- checks for the build tools,
mkfs.erofs,mke2fs, systemd and KVM; - turns on IPv4 forwarding, now and at every boot;
- builds
diceranddicerdfrom themainbranch, with the hypervisors and guest binaries thatdicerdcarries; - stops the daemon if it is running, and installs both binaries to
/usr/local/bin; - creates the
dicergroup, whose members can use the daemon withoutsudo; - writes a configuration,
/etc/dicerd/config.yaml, unless there is one; - installs
dicerd.service, the same unit the packages install withdicerd’s path changed, and, where firewalld is installed, thedicerzone; - 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.
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.