Data components handle application data. They can range anywhere in function from a database to a job queue. Functionality of data services is determined by the image with which they're created.
Overview of Data Component Settings in the Boxfile
data.db: # Image image: nanobox/mysql:5.6 # Config Options Exposed by the Image config: plugins: - federated - audit_log event_scheduler: 'Off' # Cron cron: - id: backup schedule: '0 0 * * *' command: 'bash /path/to/scripts/backup.sh' - id: echo_msg schedule: '*/3 */2 1-3 2,6,7 2' command: 'echo i\'m a little teapot' # Extra Packages (in addition to what the image installs) extra_packages: - perl - curl # Additions to $PATH extra_path_dirs: - /custom/bin # Custom commands to prepare the environment extra_steps: - wget -o /path/to/scripts/cron.sh http://example.com/cron.sh # Only provision component locally local_only: true
data.db: image: nanobox/mysql:5.6
Images may provide configuration options. These options are specified in the
config node of your data component. What config options are available depend on the image you're using and are be outlined in the data component guides.
data.db: image: nanobox/mysql:5.6 config: plugins: - federated - audit_log event_scheduler: 'Off'
Cron is a time-based job scheduler that enables you to schedule jobs (commands) to run periodically at certain times or dates. Cron jobs specified in a component's boxfile config are loaded into the component's crontab. More information is available in the Cron Jobs doc.
data.db: # ... cron: - id: backup schedule: '0 0 * * *' command: 'bash /path/to/scripts/backup.sh' - id: echo_msg schedule: '*/3 */2 1-3 2,6,7 2' command: 'echo i\'m a little teapot'
In some cases, you may need a package that your image does not make available. The
extra_packages config allows you to specify additional packages that should be loaded into your data component.
data.db: # ... extra_packages: - perl - curl
Note: Only packages available in the Nanobox pkgsrc can be loaded using
Add Directories to the $PATH
Some tools you may be using include binaries that need to be added to the system $PATH. The
extra_path_dirs config allows you to specify these directories. Directory paths should be absolute.
data.db: # ... extra_path_dirs: - /custom/bin
You can add custom steps to the process of provisioning your data component. These run anytime the nodes in your data component are built (scaling, moving, etc.).
data.db: # ... extra_steps: - wget -o /path/to/scripts/cron.sh http://example.com/cron.sh
In some cases, you may only want to provision a component when developing and testing locally. The
local_only config will provision the component when working locally (local and dry-run), but not when deploying to a live server.
data.db: # ... local_only: true
Reach out to firstname.lastname@example.org and we'll try to help.