FreeBSD virtual environment management and repository

Attention! Current pages describe CBSD version 12.1.x. If you are using an older version, please update first.

Using CBSDfile

You can use CBSDFile to create and destroy CBSD environments with a single command. If you are looking for Vagrant for jail or bhyve, you might like the native FreeBSD/CBSD mechanism.

We did not begin to reinvent the wheel regarding the CBSDFile format and use a shell script-style that is familiar to most people: describe your environment configuration in a function named jail_XXX or bhyve_YYY. One function - one environment. You can use any parameters from jcreate/jconstruct-tui/jconfig and bcreate/bconstruct-tui/bconfig commands.

If you need to perform a series of actions when creating an environment, use the functions called postcreate_XXX.

Example

Example for jail. Create a requirents.txt file in the directory - it will contain a list of pip modules for python, with the follow contents:

	requests
	

Create a CBSDfile with the contents:

	jail_pyjail1()
	{
		ip4_addr="DHCP"
		host_hostname="${jname}.example.com"
		pkg_bootstrap="1"
		pkglist="www/nginx python37 security/sudo security/ca_root_nss devel/py-pip devel/py-websockets"
	}

	postcreate_pyjail1()
	{
		jscp ${CBSD_PWD}/requirements.txt ${jname}:/tmp/requirements.txt
		jexec jname=${jname} pip install -r /tmp/requirements.txt
		jexec jname=${jname} rm /tmp/requirements.txt
	}
	

Lets create pyjail1:

	cbsd up
	

or:

	cbsd up pyjail1
	

For destroy pyjail1:

	cbsd destory
	

or:

	cbsd destroy pyjail1
	

Another sample of CBSDfile

See a demo of how this might look for hybrid environments with jail and bhyve being created at the same time.