Install the Budibase docker image via Ansible
Budibase is deployed as a container and the container image includes all the components needed to run Budibase. Since it is a container it will run in many scenarios and platforms where a container engine such as Docker exists. One scenario could be to run Budibase with Docker on a Linux server. There are multiple ways to achieve this including Docker Compose and Portainer, but Ansible could also be used to configure and run a Budibase container on a Linux server as described below.
For this example you will need:
- Ansible installed on your computer
- A server or virtual machine installed with internet connectivity and a Linux operating system - we are using Debian 11 in this example
- A valid IP address on the server with a DNS entry for a domain you own pointing to the IP address. In the example below we are using debian001.domain.com pointing to 220.127.116.11
- Password-less SSH and sudo privileges for the server, or willingness to add access details to your ansible-playbook command
In the example we will use the following folder structure on a laptop:
The first step might be to ensure that ansible commands work so within the folder above run the following command to install ansible support for docker containers and the budibase role:
ansible-galaxy collection install community.general ansible-galaxy install budibase.budibase
Next, the inventory.yaml file needs information pointing to your server e.g.
all: children: app_servers: hosts: debian001.domain.com: ansible_port: 22 host: debian001.domain.com
Then add a playbook in the playbooks folder e.g.
debian001.domain.com.yaml with content similar to the following but substituted with your own values:
- hosts: - debian001.domain.com become: true vars: budibase_custom_domain: mybudibase.mydomain.com budibase_jwt_secret: yourownrandomstring budibase_minio_access_key: yourownrandomstring budibase_minio_secret_key: yourownrandomstring budibase_redis_password: yourownrandomstring budibase_couchdb_user: yourownrandomstring budibase_couchdb_password: yourownrandomstring budibase_internal_api_key: yourownrandomstring roles: - geerlingguy.docker - budibase.budibase
- If you set the environment variable
budibase_custom_domainthis will be used to request an SSL certificate from Let’s Encrypt for your domain name. So you must have DNS resolving for this to work.
- In each of the environment variables replace
yourownrandomstringwith your own passwords to secure your installation. You may also wish to encrypt these variables using Ansible Vault.
Run the Playbook
When you have your roles configured you can run your Ansible playbook:
ansible-playbook -i inventory.yaml ./playbooks/debian001.domain.com.yaml
In the examples above we used the directory /data directory to persist data if containers restart. You should ensure you have a strategy to take backups of that directory for disaster recovery and upgrades.
Updated 5 months ago