The goal of this is to provide a fast, efficient utility to manage BSD jails. The CLI is designed to mirror SmartOS's vmadm, and we borrow ideas from other Solaris zone utilities where applicable.
vmadm describes jails as JSON files. These files are compatible with vmadm's files but represent only a subset of the total options.
Data lives in /etc/jails
, being an index file and description file per zone. We do this to mimic the way zomeadm works on Solaris but replaces xml+plaintext with JSON.
Images are ZFS datasets that get cloned for a new jail, both living under a given prefix (that can be defined).
pkg install pkgconf openssl
We need to add bridge0 interface to the /etc/rc.conf
(em0
might differ for you)
# set up a bridge interfaces for jails
cloned_interfaces="bridge0"
# plumb interface em0 into bridge0
ifconfig_bridge0="addm em0"
vnet needs to be enabled in the kerne.
Rctrl needs to be enabled
echo kern.racct.enable=1 >> /boot/loader.conf
We need a dataset for the jails:
zfs create zroot/jails
Some of the steps above require a reboot, there is however no reason not just do it once at the very end.
- Install rust (https://rustup.rs/)
- Clone this repository
- Build the binary
cargo build --release
- Copy the executable
cp target/release/vmadm /usr/local/sbin
- Create the jails folder:
mkdir /etc/jails
- Create the images folder
mkdir -p /var/imgadm/images
- Create the main config file:
echo 'pool = "zroot/jails"\n[networks]\nadmin = "bridge0"' > /etc/vmadm.toml
- Download a/the datase
curl -O https://s3.amazonaws.com/datasets.project-fifo.net/freebsd/e022d0f8-5630-11e7-b660-9b2d243d4404.xz
- Extract the dataset
xzcat e022d0f8-5630-11e7-b660-9b2d243d4404.xz | zfs receive zroot/jails/e022d0f8-5630-11e7-b660-9b2d243d4404
- Create a jail: cat example.json | vmadm create
The devfs ruleset to used can be adjusted in the /etc/vmadm.toml
by adding devfs_ruleset = <rule number>
.
vmadm 0.1.0
Heinz N. Gies <[email protected]>
vmadm compatible jail manager
USAGE:
vmadm [FLAGS] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
--startup
-V, --version Prints version information
-v Sets the level of verbosity
SUBCOMMANDS:
console connects to a jails console
create creates a new jail
delete deletes a jail
get gets a jails configuration
help Prints this message or the help of the given subcommand(s)
images image subcommands
info gets a info for a hardware virtualized vm
list lists jails
reboot reboot a jail
start starts a jail
stop stops a jail
update updates a jail
Travis CI scripts form: https://github.com/japaric/trust