Provisioning Configs

A guide detailing the concept and use of provisioning configurations within the Bunnyshell platform


Aside from the ability to add packages to your environment and configuring them to suit your needs, there will be times when additional actions are required for specific goals. To address this need, we developed the concept of provisioning configs. These are templates for performing either specific actions like adding a nginx virtual host, or general actions like executing a bash script or adding a cron entry. You can add multiple configs to be executed on a single deployment. The deployment action can include packages or not. If packages are included, the provisioning configs will be executed first.

Types of Provisioning Configs

To get to the provisioning configs templates, go to your environment then hit Provisioning -> Go to Package Bundle -> Provisioning Configs -> +add new template action

The templates are structured in multiple sections depending on the nature of the config. There are some common fields ("Enable plugin", "Action title", "User", "Description" and "Script Editor") and some specific ones for each of the templates.

The "system cron" template under crons offers fields for "Minute", "Hour", "Day of week", "Day of month", "Month"

The "System directory" template under directory offers "Directory path", "Directory permissions", "Directory owner" and "Directory group".

The exec section offers an array of specific action templates like: "linux_install_composer", "linux_install_redis_tools", "Install docker _ docker compose" that do as their title suggests. Each of them can be edited in the script editor as well as modifying the working directory or the user under which they are executed.

The file section offers templates to add NGINX virtual host and config as well as a template for a general system file. The "NGINX virtual host - ssl fcgi pagespeed conf" template will create a .conf entry in "/etc/nginx/sites-enabled/". You can specify the permissions, owner and group. The "NGINX - conf" template will have similar fields but the default file path would be "/etc/nginx/nginx.conf". The script editor is populated with default values that can be edited as needed.

The "System link file" template under the link section offers the "Link path" and "Link source directory".

With the "System package" template under the package section you can specify system packages to install upon the next deploy. Here a "Install/uninstall" option is offered under the "Action" field, the name of the package must be specified under the "Package name" field, the package provider specified under "Software used to install the application (OS default is used)" and other installation options under "Installation options separated by comma".

Finally, the "System service" template under the service section lets the user control a specific system service by specifying its name under "Service name", have the service either running or stopped under "Service name", enable or disable start at boot and provide a custom start/restart/status/stop command.

Additional controls

Below the Script Editor on each template there is the "Environments whitelist" dropdown. If "-" is selected, then the provision config will be executed on ALL environments. To execute the config on ONE environment, it must be selected from the dropdown list.

Hit "Save Changes" button on the bottom of the page to view the config as box with an On/Off switch. If the switch is set to On, the script to be executed upon the next deployment. If set on Off, it will not execute. You can view the script by hitting the down arrow on the right of the box. To edit the config, hit the three vertical dots on the right and "Edit". You can add another config by hitting the "+" button on the left, just below the config box.

To execute the config, hit "Deployment", tick or untick the installed packages the hit "Deploy" on the bottom of the page.


Mount a disk

To exemplify, we'll use the "Execute bash/ssh commands" template. The resulting page will have the following fields:

"Enable plugin" - true/false dropdown

"Action title" - the name of the specific provision config action

"Cwd" - the path of the directory in which the command will be executed

"Timeout(s)" - The number of seconds to wait until the command stops from execution

"User to run the command as" - root by default

"Exec description" - optional text

Below enter the bash commands to execute in the script editor. In this example, we'll create a new file named test in /home/bunnyshell/. To do this we can either provide the full path

$ mount /dev/sdb/ /point

Hit "Save Changes" button on the bottom of the page to view the config as box with an On/Off switch.