updating template docs to include limits

This commit is contained in:
Christer Edwards
2020-01-26 12:43:45 -07:00
parent 7c5436c740
commit a60c678036
2 changed files with 35 additions and 25 deletions

View File

@@ -543,7 +543,8 @@ Templates](https://gitlab.com/BastilleBSD-Templates)?
Bastille supports a templating system allowing you to apply files, pkgs and Bastille supports a templating system allowing you to apply files, pkgs and
execute commands inside the container automatically. execute commands inside the container automatically.
Currently supported template hooks are: `INCLUDE`, `PRE`, `FSTAB`, `OVERLAY`, `PKG`, `SYSRC`, `SERVICE`, `CMD`. Currently supported template hooks are: `LIMITS`, `INCLUDE`, `PRE`, `FSTAB`,
`PKG`, `OVERLAY`, `SYSRC`, `SERVICE`, `CMD`.
Planned template hooks include: `PF`, `LOG` Planned template hooks include: `PF`, `LOG`
Templates are created in `${bastille_prefix}/templates` and can leverage any of Templates are created in `${bastille_prefix}/templates` and can leverage any of
@@ -568,6 +569,7 @@ work as expected. This table outlines that order and those requirements:
| SUPPORTED | format | example | | SUPPORTED | format | example |
|-----------|---------------------|------------------------------------------------| |-----------|---------------------|------------------------------------------------|
| LIMITS | resource value | memoryuse 1G |
| INCLUDE | template path/URL | http?://TEMPLATE_URL or username/base-template | | INCLUDE | template path/URL | http?://TEMPLATE_URL or username/base-template |
| PRE | /bin/sh command | mkdir -p /usr/local/path | | PRE | /bin/sh command | mkdir -p /usr/local/path |
| FSTAB | fstab syntax | /host/path container/path nullfs ro 0 0 | | FSTAB | fstab syntax | /host/path container/path nullfs ro 0 0 |

View File

@@ -1,12 +1,15 @@
======== ========
Template Template
======== ========
Looking for ready made CI/CD validated [Bastille
Templates](https://gitlab.com/BastilleBSD-Templates)?
Bastille supports a templating system allowing you to apply files, pkgs and Bastille supports a templating system allowing you to apply files, pkgs and
execute commands inside the containers automatically. execute commands inside the containers automatically.
Currently supported template hooks are: `PRE`, `OVERLAY`, `PKG`, `SYSRC`, `CMD`. Currently supported template hooks are: `LIMITS`, `INCLUDE`, `PRE`, `FSTAB`,
Planned template hooks include: `FSTAB`, `PF`, `LOG`. `PKG`, `OVERLAY`, `SYSRC`, `SERVICE`, `CMD`.
Planned template hooks include: `PF`, `LOG`.
Templates are created in `${bastille_prefix}/templates` and can leverage any of Templates are created in `${bastille_prefix}/templates` and can leverage any of
the template hooks. Simply create a new directory named after the template. eg; the template hooks. Simply create a new directory named after the template. eg;
@@ -22,27 +25,33 @@ template directory named after the hook you want to execute. eg;
echo "zsh vim-console git-lite htop" > /usr/local/bastille/templates/username/base/PKG echo "zsh vim-console git-lite htop" > /usr/local/bastille/templates/username/base/PKG
echo "/usr/bin/chsh -s /usr/local/bin/zsh" > /usr/local/bastille/templates/username/base/CMD echo "/usr/bin/chsh -s /usr/local/bin/zsh" > /usr/local/bastille/templates/username/base/CMD
echo "etc\nrootjn usr" > /usr/local/bastille/templates/username/base/OVERLAY echo "usr" > /usr/local/bastille/templates/username/base/OVERLAY
Template hooks are executed in specific order and require specific syntax to Template hooks are executed in specific order and require specific syntax to
work as expected. This table outlines those requirements: work as expected. This table outlines those requirements:
+---------+------------------+--------------------------------------+ +---------+-------------------+-----------------------------------------+
| HOOK | format | example | | HOOK | format | example |
+=========+==================+======================================+ +=========+===================+=========================================+
| PRE | /bin/sh command | mkdir -p /usr/local/my_app/html | | LIMITS | resource value | memoryuse 1G |
+---------+------------------+--------------------------------------+ +---------+-------------------+-----------------------------------------+
| OVERLAY | path(s) | etc root usr (one per line) | | INCLUDE | template path/URL | http?://TEMPLATE_URL or project/path |
+---------+------------------+--------------------------------------+ +---------+-------------------+-----------------------------------------+
| PKG | port/pkg name(s) | vim-console zsh git-lite tree htop | | PRE | /bin/sh command | mkdir -p /usr/local/my_app/html |
+---------+------------------+--------------------------------------+ +---------+-------------------+-----------------------------------------+
| SYSRC | sysrc command(s) | nginx_enable=YES | | FSTAB | fstab syntax | /host/path container/path nullfs ro 0 0 |
+---------+------------------+--------------------------------------+ +---------+-------------------+-----------------------------------------+
| SERVICE | service command | 'nginx start' OR 'postfix reload' | | PKG | port/pkg name(s) | vim-console zsh git-lite tree htop |
+---------+------------------+--------------------------------------+ +---------+-------------------+-----------------------------------------+
| CMD | /bin/sh command | /usr/bin/chsh -s /usr/local/bin/zsh | | OVERLAY | path(s) | etc root usr (one per line) |
+---------+------------------+--------------------------------------+ +---------+-------------------+-----------------------------------------+
| SYSRC | sysrc command(s) | nginx_enable=YES |
+---------+-------------------+-----------------------------------------+
| SERVICE | service command | 'nginx start' OR 'postfix reload' |
+---------+-------------------+-----------------------------------------+
| CMD | /bin/sh command | /usr/bin/chsh -s /usr/local/bin/zsh |
+---------+-------------------+-----------------------------------------+
Note: SYSRC requires that NO quotes be used or that quotes (`"`) be escaped Note: SYSRC requires that NO quotes be used or that quotes (`"`) be escaped
ie; (`\\"`) ie; (`\\"`)
@@ -61,17 +70,16 @@ overlayed template files will be in `usr/local`. The few general
exceptions are the `etc/hosts`, `etc/resolv.conf`, and exceptions are the `etc/hosts`, `etc/resolv.conf`, and
`etc/rc.conf.local`. `etc/rc.conf.local`.
After populating `usr/local/` with custom config files that your container will After populating `usr/local` with custom config files that your container will
use, be sure to include `usr` in the template OVERLAY definition. eg; use, be sure to include `usr` in the template OVERLAY definition. eg;
.. code-block:: shell .. code-block:: shell
echo "etc\nusr" > /usr/local/bastille/templates/username/base/OVERLAY echo "usr" > /usr/local/bastille/templates/username/base/OVERLAY
The above example "etc usr" will include anything under "etc" and "usr" The above example "usr" will include anything under "usr" inside the template.
inside the template. You do not need to list individual files. Just You do not need to list individual files. Just include the top-level directory
include the top-level directory name. List these top-level directories one per name. List these top-level directories one per line.
line.
Applying Templates Applying Templates
------------------ ------------------