Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Budibase #143

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Blaze](https://github.com/blenderskool/blaze) - File sharing progressive web app
* [Blocky](https://0xerr0r.github.io/blocky/) - Fast and lightweight DNS proxy as ad-blocker
* [Booksonic](https://booksonic.org/) - The selfhosted audiobook server
* [Budibase](https://github.com/Budibase/budibase) - Low code platform for building business apps and workflows in minutes
* [Calibre](https://calibre-ebook.com) - Calibre is a powerful and easy to use e-book manager.
* [Calibre-web](https://github.com/janeczku/calibre-web) - Provides a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.
* [Changedetection.io](https://github.com/dgtlmoon/changedetection.io) - Free open source website change detection, monitor and notification service
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
tags:
- booksonic

- role: budibase
tags:
- budibase

- role: calibre
tags:
- calibre
Expand Down
145 changes: 145 additions & 0 deletions roles/budibase/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
budibase_enabled: false
budibase_available_externally: false

# directories
budibase_data_directory: "{{ docker_home }}/budibase"

# network
budibase_port: "10000"
budibase_hostname: "budibase"
budibase_network_name: "budibase"

# specs
budibase_app_memory: 1g
budibase_worker_memory: 1g
budibase_minio_memory: 1g
budibase_proxy_memory: 1g
budibase_couchdb_memory: 1g
budibase_redis_memory: 1g
budibase_watchtower_memory: 1g

# docker
budibase_app_container_name: budibase-app
budibase_app_image_name: "budibase.docker.scarf.sh/budibase/apps"
budibase_app_image_version: latest
budibase_worker_container_name: budibase-worker
budibase_worker_image_name: budibase.docker.scarf.sh/budibase/worker
budibase_worker_image_version: latest
budibase_minio_container_name: budibase-minio
budibase_minio_image_name: minio/minio
budibase_minio_image_version: latest
budibase_proxy_container_name: budibase-proxy
budibase_proxy_image_name: budibase/proxy
budibase_proxy_image_version: latest
budibase_couchdb_container_name: budibase-couchdb
budibase_couchdb_image_name: budibase/couchdb
budibase_couchdb_image_version: latest
budibase_redis_container_name: budibase-redis
budibase_redis_image_name: redis
budibase_redis_image_version: latest
budibase_watchtower_container_name: budibase-watchtower
budibase_watchtower_image_name: containrrr/watchtower
budibase_watchtower_image_version: latest
budibase_user_id: "1000"
budibase_group_id: "1000"


# budibase
budibase_couchdb_url: http://{{ budibase_couchdb_username }}:{{ budibase_couchdb_password }}@{{ budibase_couchdb_container_name }}:5984
budibase_worker_url: http://{{ budibase_worker_container_name }}:4003
budibase_minio_url: http://{{ budibase_minio_container_name }}:9000
budibase_apps_url: "http://{{ budibase_app_container_name }}:4002"
budibase_redis_url: http://{{ budibase_redis_container_name }}:6379
budibase_watchtower_url: "http://{{ budibase_watchtower_container_name }}:8080"
budibase_minio_access_key: "budibase"
budibase_minio_secret_key: "budibase"
budibase_internal_api_key: "budibase"
budibase_environment: "PRODUCTION"
budibase_app_port: "4002"
budibase_api_encryption_key: "testsecret"
budibase_jwt_secret: "testsecret"
budibase_log_level: "info"
budibase_enable_analytics: "false"
budibase_redis_password: "budibase"
budibase_admin_user_email: "admin@{{ ansible_nas_domain }}"
budibase_admin_user_password: "supersecure"
budibase_plugins_dir: "/plugins"
budibase_offline_mode: ""
budibase_cluster_port: "10000"
budibase_worker_port: "4003"
budibase_minio_browser: "off"
budibase_proxy_rate_limit_webhooks_per_second: "10"
budibase_proxy_rate_limit_api_per_second: "20"
budibase_resolver: "127.0.0.11"
budibase_couchdb_password: "budibase"
budibase_couchdb_username: "budibase"
budibase_targetbuild: "docker-compose"
budibase_watchtower_http_api: "true"
budibase_watchtower_http_api_token: "budibase"
budibase_watchtower_cleanup: "true"

budibase_app_env:
SELF_HOSTED: "1"
COUCH_DB_URL: "{{ budibase_couchdb_url }}"
WORKER_URL: "{{ budibase_worker_url }}"
MINIO_URL: "{{ budibase_minio_url }}"
MINIO_ACCESS_KEY: "{{ budibase_minio_access_key }}"
MINIO_SECRET_KEY: "{{ budibase_minio_secret_key }}"
INTERNAL_API_KEY: "{{ budibase_internal_api_key }}"
BUDIBASE_ENVIRONMENT: "{{ budibase_environment }}"
PORT: "{{ budibase_app_port }}"
API_ENCRYPTION_KEY: "{{ budibase_api_encryption_key }}"
JWT_SECRET: "{{ budibase_jwt_secret }}"
LOG_LEVEL: "{{ budibase_log_level }}"
ENABLE_ANALYTICS: "{{ budibase_enable_analytics }}"
REDIS_URL: "{{ budibase_redis_url }}"
REDIS_PASSWORD: "{{ budibase_redis_password }}"
BB_ADMIN_USER_EMAIL: "{{ budibase_admin_user_email }}"
BB_ADMIN_USER_PASSWORD: "{{ budibase_admin_user_password }}"
PLUGINS_DIR: "{{ budibase_plugins_dir }}"
OFFLINE_MODE: "{{ budibase_offline_mode }}"

budibase_worker_env:
SELF_HOSTED: "1"
CLUSTER_PORT: "{{ budibase_cluster_port }}"
APPS_URL: "{{ budibase_apps_url }}"
COUCH_DB_USERNAME: "{{ budibase_couchdb_username }}"
COUCH_DB_PASSWORD: "{{ budibase_couchdb_password }}"
COUCH_DB_URL: "{{ budibase_couchdb_url }}"
MINIO_URL: "{{ budibase_minio_url }}"
MINIO_ACCESS_KEY: "{{ budibase_minio_access_key }}"
MINIO_SECRET_KEY: "{{ budibase_minio_secret_key }}"
INTERNAL_API_KEY: "{{ budibase_internal_api_key }}"
PORT: "{{ budibase_worker_port }}"
API_ENCRYPTION_KEY: "{{ budibase_api_encryption_key }}"
JWT_SECRET: "{{ budibase_jwt_secret }}"

REDIS_URL: "{{ budibase_redis_url }}"
REDIS_PASSWORD: "{{ budibase_redis_password }}"
OFFLINE_MODE: "{{ budibase_offline_mode }}"

budibase_minio_env:
MINIO_ACCESS_KEY: "{{ budibase_minio_access_key }}"
MINIO_SECRET_KEY: "{{ budibase_minio_secret_key }}"
MINIO_BROWSER: "{{ budibase_minio_browser }}"

budibase_proxy_env:
PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND: "{{ budibase_proxy_rate_limit_webhooks_per_second }}"
PROXY_RATE_LIMIT_API_PER_SECOND: "{{ budibase_proxy_rate_limit_api_per_second }}"
APPS_UPSTREAM_URL: "{{ budibase_apps_url }}"
WORKER_UPSTREAM_URL: "{{ budibase_worker_url }}"
MINIO_UPSTREAM_URL: "{{ budibase_minio_url }}"
COUCHDB_UPSTREAM_UR: "{{ budibase_couchdb_url }}"
WATCHTOWER_UPSTREAM_URL: "{{ budibase_watchtower_url }}"
RESOLVER: "{{ budibase_resolver }}"

budibase_couchdb_env:
COUCHDB_PASSWORD: "{{ budibase_couchdb_password }}"
COUCHDB_USER: "{{ budibase_couchdb_username }}"
TARGETBUILD: "{{ budibase_targetbuild }}"

budibase_watchtower_env:
WATCHTOWER_HTTP_API: "{{ budibase_watchtower_http_api }}"
WATCHTOWER_HTTP_API_TOKEN: "{{ budibase_watchtower_http_api_token }}"
WATCHTOWER_CLEANUP: "{{ budibase_watchtower_cleanup }}"
11 changes: 11 additions & 0 deletions roles/budibase/docs/budibase.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Budibase

Homepage: [https://github.com/Budibase/budibase](https://github.com/Budibase/budibase)

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀

## Usage

Set `budibase_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.

budibase web interface can be found at [http://ansible_nas_host_or_ip:10000](http://ansible_nas_host_or_ip:10000).
6 changes: 6 additions & 0 deletions roles/budibase/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
budibase_enabled: true
10 changes: 10 additions & 0 deletions roles/budibase/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
budibase_enabled: false
61 changes: 61 additions & 0 deletions roles/budibase/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Get budibase app container state
community.docker.docker_container:
name: "{{ budibase_app_container_name }}"
register: result_app

- name: Get budibase worker container state
community.docker.docker_container:
name: "{{ budibase_worker_container_name }}"
register: result_worker

- name: Get budibase minio container state
community.docker.docker_container:
name: "{{ budibase_minio_container_name }}"
register: result_minio

- name: Get budibase proxy container state
community.docker.docker_container:
name: "{{ budibase_proxy_container_name }}"
register: result_proxy

- name: Get budibase couchdb container state
community.docker.docker_container:
name: "{{ budibase_couchdb_container_name }}"
register: result_couchdb

- name: Get budibase redis container state
community.docker.docker_container:
name: "{{ budibase_redis_container_name }}"
register: result_redis

- name: Get budibase watchtower container state
community.docker.docker_container:
name: "{{ budibase_watchtower_container_name }}"
register: result_watchtower

- name: Check if budibase containers are running
ansible.builtin.assert:
that:
- result_app.container['State']['Status'] == "running"
- result_app.container['State']['Restarting'] == false
- result_worker.container['State']['Status'] == "running"
- result_worker.container['State']['Restarting'] == false
- result_minio.container['State']['Status'] == "running"
- result_minio.container['State']['Restarting'] == false
- result_proxy.container['State']['Status'] == "running"
- result_proxy.container['State']['Restarting'] == false
- result_couchdb.container['State']['Status'] == "running"
- result_couchdb.container['State']['Restarting'] == false
- result_redis.container['State']['Status'] == "running"
- result_redis.container['State']['Restarting'] == false
- result_watchtower.container['State']['Status'] == "running"
- result_watchtower.container['State']['Restarting'] == false
61 changes: 61 additions & 0 deletions roles/budibase/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove budibase app
community.docker.docker_container:
name: "{{ budibase_app_container_name }}"
state: absent
register: result_app

- name: Try and stop and remove budibase worker
community.docker.docker_container:
name: "{{ budibase_worker_container_name }}"
state: absent
register: result_worker

- name: Try and stop and remove budibase minio
community.docker.docker_container:
name: "{{ budibase_minio_container_name }}"
state: absent
register: result_minio

- name: Try and stop and remove budibase proxy
community.docker.docker_container:
name: "{{ budibase_proxy_container_name }}"
state: absent
register: result_proxy

- name: Try and stop and remove budibase couchdb
community.docker.docker_container:
name: "{{ budibase_couchdb_container_name }}"
state: absent
register: result_couchdb

- name: Try and stop and remove budibase redis
community.docker.docker_container:
name: "{{ budibase_redis_container_name }}"
state: absent
register: result_redis

- name: Try and stop and remove budibase watchtower
community.docker.docker_container:
name: "{{ budibase_watchtower_container_name }}"
state: absent
register: result_watchtower

- name: Check if budibase is stopped
ansible.builtin.assert:
that:
- not result_app.changed
- not result_worker.changed
- not result_minio.changed
- not result_proxy.changed
- not result_couchdb.changed
- not result_redis.changed
- not result_watchtower.changed
1 change: 1 addition & 0 deletions roles/budibase/requirements.yml
Loading