Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit 226d123

Browse files
author
olevole
committed
13.x branch
1 parent 1d0ca91 commit 226d123

File tree

278 files changed

+8147
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+8147
-5
lines changed

_version.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!--#set var="version" value="12.2.x" -->
1+
<!--#set var="version" value="13.0.x" -->

en/13.0.x/currentver.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<center><p style="color:RED">Attention! Current pages describe <strong>CBSD</strong> version <b>10.3.0</b>. If you are using an older version, please update first.</p></center>

en/13.0.x/ezjail2cbsd.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<h1><span>Migration jails from ezjail</span></h1>
2+
3+
<p>Author: Nikita Druba aka <strong><a target="_blank" href="https://github.com/cbsd/cbsd/issues/412">LordNicky</strong></a>
4+
<p>Original: via <a target="_blank" href="https://github.com/cbsd/cbsd/issues/412">Issue#412</a>
5+
<p>Notes: this is ZFS-only solution</p>
6+
<hr>
7+
<p>Migration from <strong>ezjail</strong> with basejail to <strong>CBSD</strong> with basejail can be doing at least by this easy way:</p>
8+
9+
<ul>
10+
<li>Install <strong>CBSD</strong> and do an initial setup, like in the <a target="https://www.bsdstore.ru/en/installing_cbsd.html#initenv">manual</a></li>
11+
<li>Create an empty jail with any name, for example: "jail1", make sure, that you uncheck "astart" option.; (https://www.bsdstore.ru/en/12.0.x/wf_jcreate_ssi.html;</li>
12+
<li>Stop the jail from <strong>ezjail</strong>, that you want to migrate and do a snapshot of it filesystem:
13+
<pre class="brush:bash;ruler:true;">ezjail stop MyJail</pre>
14+
<pre class="brush:bash;ruler:true;">zfs snapshot mypool/path/to/ezjail/MyJail@migrating</pre></li>
15+
<li>Create jail in <strong>CBSD</strong> by jconstruct-tui and put to "zfs_snapsrc" field path to snapshot of you jail:
16+
<pre class="brush:bash;ruler:true;">mypool/path/to/ezjail/MyJail@migrating</pre></li>
17+
<li>Check all other fields to set same ip, name and other settings. For network you can use syntax of ezjail, but instead "|" you need to use "#".</li>
18+
<li>Proceed you new jail. If creation of jail was successfully, then go to the next step</li>
19+
<li>Run <strong>migrating_ezjail_cbsd.sh</strong> script from <a target="_blank" href="https://github.com/cbsd/cbsd_useful_stuff/tree/master/ezjail2cbsd">ezjail2cbsd/</a>. You can specify paths to directories of "migrating" and "example" jails in command:
20+
<pre class="brush:bash;ruler:true;">migrating_ezjail_cbsd.sh path/to/cbsd/jail1 path/to/cbsd/MyJail</pre>
21+
or use dialog interface and enter paths there.</li>
22+
<li>Run you migrated jail by cbsd command and enjoy.</li>
23+
<li>Also you can be needed to destroy <strong>ezjail</strong> filesystems, but before destroying them you need to promote clones in <strong>CBSD</strong> directory:</li>
24+
<pre class="brush:bash;ruler:true;">zfs promote mypool/path/to/cbsd/MyJail</pre>
25+
<pre class="brush:bash;ruler:true;">zfs destroy -r mypool/path/to/ezjail/MyJail</pre> (Be carefully with [-R] parameter, you need [-r].)</li>
26+
</ul>

en/13.0.x/ezjail2cbsd_ssi.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!--# include file="/en/_start.html" -->
2+
<!--# include file="/en/currentver.html" -->
3+
<!--# include file="/en/translate.html" -->
4+
<!--# include file="ezjail2cbsd.html" -->
5+
<!--# include file="/en/_end.html" -->

en/13.0.x/modules/bsdconf.d.html

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<h1><span>Working with passwd(1), sysrc(8), service(8) in jail via CBSD</span></h1>
2+
3+
<h2><a name="bsdconf_cmd">Commands: passwd, sysrc, service</a></h2>
4+
<div class="block">
5+
<pre class="brush:bash;ruler:true;">
6+
% cbsd passwd
7+
</pre>
8+
<pre class="brush:bash;ruler:true;">
9+
% cbsd sysrc
10+
</pre>
11+
<pre class="brush:bash;ruler:true;">
12+
% cbsd service
13+
</pre>
14+
<p><strong>Description</strong>:</p>
15+
<p>Commands from <strong>bsdconf.d</strong> module - is a wrapper around the standard FreeBSD <a href="http://man.freebsd.org/sysrc/8" target="_blank">sysrc(8)</a>, <a href="http://man.freebsd.org/service/8" target="_blank">service(8)</a>, <a href="http://man.freebsd.org/passwd/1" target="_blank">passwd(1)</a> for adding <strong>jname</strong> argument for more convenient work with the services and password in jail from the master host.</p>
16+
<p>Via <strong>jname=</strong> argument specified jail, all that comes after (except passwd, which has yet possible user= ) - not analyzed and treated appropriately utitites as is.</p>
17+
<p><strong>Example1:</strong> Mark sshd service in jail1 as active:</p>
18+
<pre class="brush:bash;ruler:true;">
19+
% cbsd sysrc jname=jail1 sshd_enable="YES"
20+
</pre>
21+
<p><strong>Example2:</strong> Get list of services from jail1:</p>
22+
<pre class="brush:bash;ruler:true;">
23+
% cbsd sysrc jname=jail1 service -l
24+
</pre>
25+
<p><strong>Example3:</strong> Enable sshd service in jail1:</p>
26+
<pre class="brush:bash;ruler:true;">
27+
% cbsd service mode=action jname=jail1 sshd enable
28+
</pre>
29+
<p><strong>Example4:</strong> Start sshd service in all jails started with jail* jname :</p>
30+
<pre class="brush:bash;ruler:true;">
31+
% cbsd service mode=action jname='jail*' sshd start
32+
% cbsd service mode=action jname='jail*' sshd onestart
33+
% cbsd service mode=action jname='jail*' sshd status
34+
</pre>
35+
<p><strong>Example5:</strong> Change password for root user in jail1:</p>
36+
<pre class="brush:bash;ruler:true;">
37+
% cbsd passwd jname=jail1
38+
</pre>
39+
<p><strong>Example6:</strong> Change password for web user in jail1:</p>
40+
<pre class="brush:bash;ruler:true;">
41+
% cbsd passwd jname=jail1 login=web
42+
</pre>
43+
</div>

en/13.0.x/modules/bsdconf.d_ssi.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!--# include file="/en/_start.html" -->
2+
<!--# include file="/en/currentver.html" -->
3+
<!--# include file="/en/translate.html" -->
4+
<!--# include file="bsdconf.d.html" -->
5+
<!--# include file="/en/_end.html" -->

en/13.0.x/modules/pkg.d.html

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<h1><span>Wirking with packages and pkg(7) in jail via CBSD </span></h1>
2+
3+
<h2><a name="pkd_cmd">Command: pkg</a></h2>
4+
<div class="block">
5+
<pre class="brush:bash;ruler:true;">
6+
% cbsd pkg
7+
</pre>
8+
<p><strong>Description</strong>:</p>
9+
<p><strong>cbsd pkg</strong> - is wrapper around standart FreeBSD <a href="http://man.freebsd.org/pkg/7" target="_blank">pkg(7)</a> tools to use <strong>jname</strong> argument for more comfort work with the jail from the master host</p>
10+
<p>Via <strong>mode=</strong> argument indicating a needet action. Values can be:</p>
11+
<ul>
12+
<li><strong>add, install</strong> - to install packages</li>
13+
<li><strong>remove</strong> - to remove packages</li>
14+
<li><strong>bootstrap</strong> - init pkg (normally done in the jail one times on creating)</li>
15+
<li><strong>info, query</strong> - execute queries <em>info</em> or <em>query</em> with the same syntax pkg</li>
16+
<li><strong>update</strong> - execute pkg update</li>
17+
<li><strong>upgrade</strong> - execute upgrade</li>
18+
<li><strong>clean</strong> - execute clean to purge pkg cache</li>
19+
</ul>
20+
<p>For some commands (clean, update, upgrade) it is permissible jname= to specify as mask for performing the operation simultaneously in several jails</p>
21+
<p>Keep in mind that must first be specified parameters <strong>mode</strong> and <strong>jname</strong>. All that comes after - not analyzed and treated <a href="http://man.freebsd.org/pkg/7" target="_blank">pkg(7)</a> as is.</p>
22+
<p>In addition, please note that all operations are performed with the set environment variables <strong>ASSUME_ALWAYS_YES=yes</strong> and <strong>IGNORE_OSVERSION=yes</strong> to suppress the interactivity that basically, you need to work in automated scripts. If for some reason this does not work for you, use <a href="/<!--#echo var="lang" -->/<!--#echo var="version" -->/wf_jexec_ssi.html">cbsd rexe</a> to work with pkg directly.</p>
23+
<p><strong>Example1:</strong> Update pkg index files inside ALL containers:</p>
24+
<pre class="brush:bash;ruler:true;">
25+
% cbsd pkg mode=update jname='*'
26+
</pre>
27+
<p><strong>Example2:</strong> Update ALL packages inside containers, whose name starts with redis*:</p>
28+
<pre class="brush:bash;ruler:true;">
29+
% cbsd pkg mode=upgrade jname='redis*'
30+
</pre>
31+
<p><strong>Example3:</strong> Clear pkg cache in ALL containers:</p>
32+
<pre class="brush:bash;ruler:true;">
33+
% cbsd pkg mode=clean jname='*'
34+
</pre>
35+
<p><strong>Example4:</strong> Get installed packages for box1 and for all jails with jname mask 'jail*' (in <strong>CBSD 11.2.1+</strong>):</p>
36+
<pre class="brush:bash;ruler:true;">
37+
% cbsd pkg mode=query jname=box1 %o
38+
% cbsd pkg mode=query jname='jail*' %o
39+
</pre>
40+
<p><strong>Example5:</strong> Install <strong>bash, mc, wget</strong> in mytest1 jail and <strong>nginx-devel,mysql57-server,postgresql96-server,mc</strong> for all jails with jname mask 'jail*' (in <strong>CBSD 11.2.1+</strong>:</p>
41+
<pre class="brush:bash;ruler:true;">
42+
% cbsd pkg mode=install jname=mytest1 bash mc wget
43+
% cbsd pkg jname='jail*' mode=install nginx-devel mysql57-server postgresql96-server mc
44+
</pre>
45+
<p>or that much better (in order to avoid the same name in different categories) indicate origin package, not the name:</p>
46+
<pre class="brush:bash;ruler:true;">
47+
% cbsd pkg mode=install jname=mytest1 shells/bash ftp/wget misc/mc
48+
</pre>
49+
<p><strong>Example6:</strong> Upgrade mc package in jail1:</p>
50+
<pre class="brush:bash;ruler:true;">
51+
% cbsd pkg mode=upgrade jname=jail1 mc
52+
</pre>
53+
<p><strong>Example7:</strong> Remove wget and lsof packages in box1 and mc from all jails with jname mask 'jail*' (in <strong>CBSD 11.2.1+</strong>:</p>
54+
<pre class="brush:bash;ruler:true;">
55+
% cbsd pkg mode=remove jname=box1 wget lsof
56+
% cbsd pkg jname='jail*' mode=remove mc
57+
</pre>
58+
</div>

en/13.0.x/modules/pkg.d_ssi.html

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!--# include file="/en/_start.html" -->
2+
<!--# include file="/en/currentver.html" -->
3+
<!--# include file="/en/jname_as_mask.html" -->
4+
<!--# include file="/en/translate.html" -->
5+
<!--# include file="pkg.d.html" -->
6+
<!--# include file="/en/_end.html" -->

en/13.0.x/wf_bcheckpoint.html

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<h1><span>Checkpoints, hibernation and pauses of the bhyve virtual machine</span></h1>
2+
3+
<h2><a name="bcheckpoint_cmd">Commands bcheckpoint, bsuspend, bpause</a></h2>
4+
<p>The implementation of this feature in <strong>bhyve</strong> is grateful to the Politehnica University of Bucharest and in particular: Elena Mihailescu and Mihai Carabaș</p>
5+
<p>At the time this page was published, this functionality was not available in the FreeBSD codebase and was obtained from the project page on <a href="https://github.com/FreeBSD-UPB">GitHub (FreeBSD-UPB)</a></p>
6+
<p>The functionality of checkpoints and suspend of a virtual machine is the freezing of the virtual environment, saving the entire state to disk, from which you can return the system to its previous state without having to reboot the environment<p>
7+
<h2>Checkpoints</h2>
8+
<p>In <strong>CBSD</strong> to work with checkpoints use the <strong>bcheckpoint</strong> command, which has the following syntax:</p>
9+
<pre class="brush:bash;ruler:true;">
10+
cbsd bcheckpoint [jname=] [mode=] [name=] [poweroff=]
11+
</pre>
12+
<p>where:</p>
13+
<p>
14+
<ul>
15+
<li>- <strong>jname</strong>: (required) the name of the environment, for example: freebsd1</li>
16+
<li>- <strong>mode</strong>: (required) action relative to the environment: create (create checkpoint), list (list of checkpoints created), destroyall (destroy all checkpoints)</li>
17+
<li>- <strong>name</strong>: (optional) specify an alternate checkpoint name, by default: checkpoint</li>
18+
<li>- <strong>poweroff</strong>: (optional). When poweroff=1, <strong>CBSD</strong> will automatically shut down the virtual machine instantly
19+
(via <a href="/<!--#echo var="lang" -->/<!--#echo var="version" -->/wf_bstop_bstart_ssi.html">bstop</a> <strong>noacpi=1</strong>) on the fact of checkpoint creation.</li>
20+
</ul>
21+
</p>
22+
<p>
23+
<pre class="cli;">
24+
% cbsd bls
25+
JNAME JID VM_RAM VM_CURMEM VM_CPUS PCPU VM_OS_TYPE IP4_ADDR STATUS VNC_PORT
26+
freebsd1 21923 1024 24 1 0 freebsd DHCP On 127.0.0.1:5900
27+
28+
% cbsd bcheckpoint mode=create jname=freebsd1
29+
Waiting and sure that the info is written on the disk: 1/5
30+
Waiting and sure that the info is written on the disk: 2/5
31+
Waiting and sure that the info is written on the disk: 3/5
32+
Waiting and sure that the info is written on the disk: 4/5
33+
Waiting and sure that the info is written on the disk: 5/5
34+
Checkpoint was created!: /usr/jails/jails-system/freebsd1/checkpoints/checkpoint.ckp
35+
36+
% cbsd bcheckpoint mode=create jname=freebsd1 name=after_update
37+
Waiting and sure that the info is written on the disk: 1/5
38+
Waiting and sure that the info is written on the disk: 2/5
39+
Waiting and sure that the info is written on the disk: 3/5
40+
Waiting and sure that the info is written on the disk: 4/5
41+
Waiting and sure that the info is written on the disk: 5/5
42+
Checkpoint was created!: /usr/jails/jails-system/freebsd1/checkpoints/after_update.ckp
43+
44+
% cbsd bcheckpoint mode=list jname=freebsd1
45+
Created checkpoint for freebsd1:
46+
after_update
47+
checkpoint
48+
</pre>
49+
</p>
50+
<p>Having created checkpoints, you can return to the desired state via the command <strong>bstart</strong> with <strong>checkpoint</strong> args</p>
51+
<p>A short demo at an early stage of development on <a href="https://youtu.be/cyFDnmTKY_c" target="_blank">Youtube</a>
52+
</p>
53+
<h2>Suspend mode</h2>
54+
<p>WIP</p>
55+
<h2>VM Pauses</h2>
56+
<p>WIP</p>

en/13.0.x/wf_bcheckpoint_ssi.html

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!--# include file="/en/_start.html" -->
2+
<!--# include file="/en/currentver.html" -->
3+
<!--# include file="/en/jname_as_mask.html" -->
4+
<!--# include file="/en/translate.html" -->
5+
<!--# include file="wf_bcheckpoint.html" -->
6+
<!--# include file="/en/_end.html" -->

en/13.0.x/wf_bclone.html

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h1><span>Cloning a Virtual Machine</span></h1>
2+
3+
<h2><a name="bclone_cmd">command: bclone</a></h2>
4+
<div class="block">
5+
<pre class="brush:bash;ruler:true;">
6+
% cbsd bclone
7+
</pre>
8+
<pre class="brush:bash;ruler:true;">
9+
% cbsd brclone
10+
</pre>
11+
<p><strong>Description</strong>:</p>
12+
<p>Performs cloning a virtual machine to a new one. As required arguments, specify source/original VM through <strong>old</strong> and a new name as an argument <strong>new</strong></p>
13+
<div class="warning">
14+
<p><strong>Attention:</strong> Since 11.0.10 version, CBSD on ZFS-based hosters will be use ZFS clone features!</p>
15+
</div>
16+
<p>ZFS clone features is ultra fast operation (thanks to Copy-on-write), but imposes some restrictions - you will be dependent on the parent snapshot. If you try to remove parent environment, CBSD automatically executes the <strong>zfs promote</strong> command,
17+
but when you works with snapshot independently - just keep it in your mind</p>
18+
<p>You can control this behaviour via <strong>clone_method=</strong> argument or, to set it globally, use <i>rclone.conf</i> and <i>bclone.conf</i> to overwrite settings from 'auto' to 'rsync':
19+
<pre class="brush:bash;ruler:true;">
20+
% echo 'clone_method="rsync"' > ~cbsd/etc/rclone.conf
21+
% echo 'clone_method="rsync"' > ~cbsd/etc/bclone.conf
22+
<pre>
23+
<p>When <i>~cbsd/etc/bclone.conf</i> (for bclone) and <i>~cbsd/etc/rclone.conf</i> contain:
24+
<pre>
25+
clone_method="rsync"
26+
</pre>
27+
<p>Clone will not use zfs clone even on ZFS filesystem and you will get full copy via rsync</p>
28+
<p><strong>Example:</strong> Cloning a virtual machine in debian1 to debian2:</p>
29+
<pre class="brush:bash;ruler:true;">
30+
% cbsd bclone old=debian1 new=debian2
31+
</pre>
32+
</div>

en/13.0.x/wf_bclone_ssi.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!--# include file="/en/_start.html" -->
2+
<!--# include file="/en/currentver.html" -->
3+
<!--# include file="/en/translate.html" -->
4+
<!--# include file="wf_bclone.html" -->
5+
<!--# include file="/en/_end.html" -->

en/13.0.x/wf_bconfig.html

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h1><span>Virtual Machine Configuring</span></h1>
2+
<h2><a name="bconfig_cmd">commands: bconfig, bset</a></h2>
3+
<div class="block">
4+
<pre class="brush:bash;ruler:true;">
5+
% cbsd bconfig
6+
% cbsd bset
7+
</pre>
8+
<p><strong>Description</strong>:</p>
9+
<p>Configuring the Virtual Machine Settings</p>
10+
<p>Each virtual machine <strong>CBSD</strong> stores the settings in the SQLite3 database. To change the settings of a VM can serve command <strong>cbsd bconfig</strong>, TUI launches menu for changing the basic settings.</p>
11+
<p>Description of relevant parameters, you can read on the page <a href="/<!--#echo var="lang" -->/<!--#echo var="version" -->/wf_bcreate_ssi.html">VM create</a>
12+
</div>
13+
<h2><a name="execscript">Custom scripts for starting and stopping action on jail</a></h2>
14+
<div class="block">
15+
<p>You can write your own scripts to be executed within the jail and in the master host on startup and shutdown of the environment. For this, the system directory of jail ( <em><strong>$workdir</strong>/jails-system/<strong>$jname</strong>/</em> ) have the following directories:</p>
16+
<ul>
17+
<li><strong>master_poststart.d</strong> - scripts for executing in the master host after jail starts (<em>Be careful, because the scripts are is not jailed</em>)</li>
18+
<li><strong>master_poststop.d</strong> - scripts for executiong in the master host after jail stops (<em>Be careful, because the scripts are is not jailed</em>)</li>
19+
<li><strong>master_prestart.d</strong> - scripts for executing in master host before jail starts (<em>Be careful, because the scripts are is not jailed</em>)</li>
20+
<li><strong>master_prestop.d</strong> - scripts for execution in master host after jail stops (<em>Be careful, because the scripts are is not jailed</em>)</li>
21+
<li><strong>start.d</strong> - scripts for execution within jail when jail is starts. Analog of parameter <strong>exec.start</strong> from original <em>jail.conf</em></li>
22+
<li><strong>stop.d</strong> - scripts for execution within jail when jail is starts. Analog of parameter <strong>exec.stop</strong> from original <em>jail.conf</em></li>
23+
<li><strong>remove.d</strong> - (since CBSD 11.0.10) scripts for execution on remove command</li>
24+
</ul>
25+
<p>Write scripts to the <em>master_\*</em> directories can be useful if at the start-stop jail you need to perform some action is not associated with content of environment - for example, create a ZFS snapshot, put rules in IPFW and etc.</p>
26+
<p>In scripts, you can use CBSD variables, such as <strong>$jname, $path, $data, $ip4_addr</strong>, for example, by placing a script (with execute permission) in <em>/usr/jails/jails-system/jail1/master_poststart.d/notify.sh</em>:</p>
27+
<pre class="brush:bash;ruler:true;">
28+
#!/bin/sh
29+
echo "Jail $jname started with $ip4_addr IP and placed on $path path" | mail -s "$jname started" [email protected]
30+
</pre>
31+
<p>You will receive notification upon startup cells by email: [email protected]</p>
32+
<p>The functionality of execution custom scripts and the availability of variables in environments can play a big role in the integration of <strong>CBSD</strong> and external applications, such as <strong>Consul</strong></p>
33+
<p>As an example of use, see the article <a href="/<!--#echo var="lang" -->/articles/cbsd_vm_hook_dhcpd.html">Example of using CBSD/bhyve and ISC-DHCPD (Serve IP address in bhyve through pre/post hooks)</a></p>
34+
<p>As an example of use, see the article <a href="/<!--#echo var="lang" -->/articles/cbsd_jail_hook_consul.html">Example of using CBSD/jail and Consul (Register/unregister jail's via pre/post hooks, in Consul)</a></p>
35+
</div>

en/13.0.x/wf_bconfig_ssi.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!--# include file="/en/_start.html" -->
2+
<!--# include file="/en/currentver.html" -->
3+
<!--# include file="/en/translate.html" -->
4+
<!--# include file="wf_bconfig.html" -->
5+
<!--# include file="/en/_end.html" -->

0 commit comments

Comments
 (0)