Skip to content

Commit

Permalink
✨ Add ToolJet (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
anarion80 authored May 9, 2024
1 parent 5c7f5a2 commit ccaf61c
Show file tree
Hide file tree
Showing 11 changed files with 457 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Threadfin](https://github.com/Threadfin/Threadfin) - M3U Proxy for Plex DVR and Emby/Jellyfin Live TV. Based on xTeVe.
* [TiddlyWiki](https://tiddlywiki.com) - A unique non-linear notebook/wiki for capturing, organizing, and sharing complex information
* [TimeMachine](https://github.com/awlx/samba-timemachine) - Samba-based mac backup server
* [ToolJet](https://github.com/ToolJet/ToolJet) - Low-code platform for building business applications
* [Traefik](https://traefik.io/) - Web proxy and SSL certificate manager
* [Transmission](https://transmissionbt.com/) - BitTorrent client (with OpenVPN if you have a supported VPN provider)
* [Trilium](https://github.com/zadam/trilium) - Hierarchical note taking application with focus on building large personal knowledge bases
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,10 @@
tags:
- timemachine

- role: tooljet
tags:
- tooljet

- role: traefik
tags:
- traefik
Expand Down
209 changes: 209 additions & 0 deletions roles/tooljet/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
---
tooljet_enabled: false
tooljet_available_externally: false

# directories
tooljet_data_directory: "{{ docker_home }}/tooljet"

# network
tooljet_port: "8138"
tooljet_hostname: "tooljet"
tooljet_network_name: "tooljet"

# specs
tooljet_memory: 1g
tooljet_db_memory: 1g
tooljet_postgrest_memory: 1g
tooljet_redis_memory: 1g

# docker
tooljet_container_name: tooljet
tooljet_image_name: "tooljet/tooljet-ce"
tooljet_image_version: latest
tooljet_db_container_name: tooljet-postgres
tooljet_db_image_name: postgres
tooljet_db_image_version: 13
tooljet_postgrest_container_name: tooljet-postgrest
tooljet_postgrest_image_name: postgrest/postgrest
tooljet_postgrest_image_version: v12.0.2
tooljet_redis_container_name: tooljet-redis
tooljet_redis_image_name: redis
tooljet_redis_image_version: 6.2
tooljet_user_id: "1000"
tooljet_group_id: "1000"

# tooljet
tooljet_host: "https://{{ tooljet_hostname }}.{{ ansible_nas_domain }}"
tooljet_lockbox_master_key: "e95386d3e3e1f13022e15efc90ad25a0abcf055bdb098120bb67bbf6a9f16697" # replace with openssl rand -hex 32
tooljet_secret_key_base: "7a082bf038fc8253f640651f3883ac1254f858a9e263f54d010e242a1f49afe8d3f4d8fe2b568b80999e8266305e7c9234ea020723f234ff070692ebba3a3df7" # replace with openssl rand -hex 64

# DATABASE CONFIG
tooljet_orm_logging: "all"
tooljet_pg_db: "tooljet_production"
tooljet_pg_user: "postgres"
tooljet_pg_host: "{{ tooljet_db_container_name }}"
tooljet_pg_pass: "password" # postgres database password

# The above postgres values is set to its default state. If necessary, kindly modify it according to your personal preference.

# TOOLJET DATABASE
tooljet_enable_tooljet_db: "true"
tooljet_tooljet_db: "{{ tooljet_pg_db }}"
tooljet_tooljet_db_user: "{{ tooljet_pg_user }}"
tooljet_tooljet_db_host: "{{ tooljet_pg_host }}"
tooljet_tooljet_db_pass: "{{ tooljet_pg_pass }}"

tooljet_pgrst_db_uri: "postgres://{{ tooljet_pg_user }}:{{ tooljet_pg_pass }}@{{ tooljet_db_container_name }}/{{ tooljet_pg_db }}"
tooljet_pgrst_host: "{{ tooljet_postgrest_container_name }}"
tooljet_pgrst_jwt_secret: "2ff157f1ac62c11fb485b545279085b8e23ef47cd0299558dcf21d91a66ea6be" # If you have openssl installed, you can run the following command openssl rand -hex 32 to generate the value for PGRST_JWT_SECRET.

# Redis
tooljet_redis_master: ""
tooljet_redis_host: "{{ tooljet_redis_container_name }}"
tooljet_redis_port: "6379"
tooljet_redis_user: "default"
tooljet_redis_password: ""
tooljet_serve_client: "true"


# Checks every 24 hours to see if a new version of ToolJet is available
# (Enabled by default. Set false to disable)
tooljet_check_for_updates: "true"

# Checks every 24 hours to update app telemetry data to ToolJet hub.
# (Telemetry is enabled by default. Set value to true to disable.)
tooljet_disable_tooljet_telemetry: "true"

tooljet_google_client_id: ""
tooljet_google_client_secret: ""

# EMAIL CONFIGURATION
tooljet_default_from_email: "tooljet@{{ ansible_nas_domain }}"
tooljet_smtp_username: ""
tooljet_smtp_password: ""
tooljet_smtp_domain: ""
tooljet_smtp_port: ""

# DISABLE USER SIGNUPS (true or false). only applicable if Multi-Workspace feature is enabled
tooljet_disable_signups: ""


# OBSERVABILITY
tooljet_apm_vendor: "tooljet"
tooljet_sentry_dns: ""
tooljet_sentry_debug: ""

# FEATURE TOGGLE
tooljet_comment_feature_enable: "true"
tooljet_enable_multiplayer_editing: "true"
tooljet_enable_marketplace_feature: "true"


# SSO (Applicable only for Multi-Workspace)
tooljet_sso_google_oauth2_client_id: ""
tooljet_sso_git_oauth2_client_id: ""
tooljet_sso_git_oauth2_client_secret: ""
tooljet_sso_git_oauth2_host: ""
tooljet_sso_accepted_domains: ""
tooljet_sso_disable_signups: ""

# ONBOARDING
tooljet_enable_onboarding_questions_for_all_sign_ups: ""

# session expiry in minutes
tooljet_user_session_expiry: "2880"

# TELEMETRY
tooljet_deployment_platform: "docker"

tooljet_language: "en"

tooljet_env:
# Get detailed information about each variable here: https://docs.tooljet.com/docs/setup/env-vars
SERVE_CLIENT: "{{ tooljet_serve_client }}"
PORT: "80"

TOOLJET_HOST: "{{ tooljet_host }}"
LOCKBOX_MASTER_KEY: "{{ tooljet_lockbox_master_key }}"
SECRET_KEY_BASE: "{{ tooljet_secret_key_base }}"

# DATABASE CONFIG
ORM_LOGGING: "{{ tooljet_orm_logging }}"
PG_DB: "{{ tooljet_pg_db }}"
PG_USER: "{{ tooljet_pg_user }}"
PG_HOST: "{{ tooljet_pg_host }}"
PG_PASS: "{{ tooljet_pg_pass }}"
POSTGRES_USER: "{{ tooljet_pg_user }}"
POSTGRES_PASSWORD: "{{ tooljet_pg_pass }}"
# TOOLJET DATABASE
ENABLE_TOOLJET_DB: "{{ tooljet_enable_tooljet_db }}"
TOOLJET_DB: "{{ tooljet_tooljet_db }}"
TOOLJET_DB_USER: "{{ tooljet_tooljet_db_user }}"
TOOLJET_DB_HOST: "{{ tooljet_tooljet_db_host }}"
TOOLJET_DB_PASS: "{{ tooljet_tooljet_db_pass }}"

PGRST_DB_URI: "{{ tooljet_pgrst_db_uri }}"
PGRST_HOST: "{{ tooljet_pgrst_host }}"
PGRST_JWT_SECRET: "{{ tooljet_pgrst_jwt_secret }}"
PGRST_SERVER_PORT: "80"

# Redis
REDIS_HOST: "{{ tooljet_redis_host }}"
REDIS_PORT: "{{ tooljet_redis_port }}"
REDIS_USER: "{{ tooljet_redis_user }}"
REDIS_PASSWORD: "{{ tooljet_redis_password }}"


# Checks every 24 hours to see if a new version of ToolJet is available
# (Enabled by default. Set false to disable)
CHECK_FOR_UPDATES: "{{ tooljet_check_for_updates }}"

# Checks every 24 hours to update app telemetry data to ToolJet hub.
# (Telemetry is enabled by default. Set value to true to disable.)
DISABLE_TOOLJET_TELEMETRY": "{{ tooljet_disable_tooljet_telemetry }}"

GOOGLE_CLIENT_ID: "{{ tooljet_google_client_id }}"
GOOGLE_CLIENT_SECRET: "{{ tooljet_google_client_secret }}"

# EMAIL CONFIGURATION
DEFAULT_FROM_EMAIL: "{{ tooljet_default_from_email }}"
SMTP_USERNAME: "{{ tooljet_smtp_username }}"
SMTP_PASSWORD: "{{ tooljet_smtp_password }}"
SMTP_DOMAIN: "{{ tooljet_smtp_domain }}"
SMTP_PORT: "{{ tooljet_smtp_port }}"

# DISABLE USER SIGNUPS (true or false). only applicable if Multi-Workspace feature is enabled
DISABLE_SIGNUPS: "{{ tooljet_disable_signups }}"


# OBSERVABILITY
APM_VENDOR: "{{ tooljet_apm_vendor }}"
SENTRY_DNS: "{{ tooljet_sentry_dns }}"
SENTRY_DEBUG: "{{ tooljet_sentry_debug }}"

# FEATURE TOGGLE
COMMENT_FEATURE_ENABLE: "{{ tooljet_comment_feature_enable }}"
ENABLE_MULTIPLAYER_EDITING: "{{ tooljet_enable_multiplayer_editing }}"
ENABLE_MARKETPLACE_FEATURE: "{{ tooljet_enable_marketplace_feature }}"


# SSO (Applicable only for Multi-Workspace)
SSO_GOOGLE_OAUTH2_CLIENT_ID: "{{ tooljet_sso_google_oauth2_client_id }}"
SSO_GIT_OAUTH2_CLIENT_ID: "{{ tooljet_sso_git_oauth2_client_id }}"
SSO_GIT_OAUTH2_CLIENT_SECRET: "{{ tooljet_sso_git_oauth2_client_secret }}"
SSO_GIT_OAUTH2_HOST: "{{ tooljet_sso_git_oauth2_host }}"
SSO_ACCEPTED_DOMAINS: "{{ tooljet_sso_accepted_domains }}"
SSO_DISABLE_SIGNUPS: "{{ tooljet_sso_disable_signups }}"

# ONBOARDING
ENABLE_ONBOARDING_QUESTIONS_FOR_ALL_SIGN_UPS: "{{ tooljet_enable_onboarding_questions_for_all_sign_ups }}"

# session expiry in minutes
USER_SESSION_EXPIRY: "{{ tooljet_user_session_expiry }}"

# TELEMETRY
DEPLOYMENT_PLATFORM: "{{ tooljet_deployment_platform }}"

MASTER: "{{ tooljet_redis_host }}"

LANGUAGE: "{{ tooljet_language }}"
11 changes: 11 additions & 0 deletions roles/tooljet/docs/tooljet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ToolJet

Homepage: [https://github.com/ToolJet/ToolJet](https://github.com/ToolJet/ToolJet)

Low-code platform for building business applications. Connect to databases, cloud storages, GraphQL, API endpoints, Airtable, Google sheets, OpenAI, etc and build apps using drag and drop application builder. Built using JavaScript/TypeScript. 🚀

## Usage

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

ToolJet web interface can be found at [http://ansible_nas_host_or_ip:8138](http://ansible_nas_host_or_ip:8138).
6 changes: 6 additions & 0 deletions roles/tooljet/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
tooljet_enabled: true
10 changes: 10 additions & 0 deletions roles/tooljet/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:
tooljet_enabled: false
40 changes: 40 additions & 0 deletions roles/tooljet/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

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

- name: Get tooljet db container state
community.docker.docker_container:
name: "{{ tooljet_db_container_name }}"
register: result_db

- name: Get tooljet postgrest container state
community.docker.docker_container:
name: "{{ tooljet_db_container_name }}"
register: result_postgrest

- name: Get tooljet container state
community.docker.docker_container:
name: "{{ tooljet_container_name }}"
register: result

- name: Check if tooljet containers are running
ansible.builtin.assert:
that:
- result_redis.container['State']['Status'] == "running"
- result_redis.container['State']['Restarting'] == false
- result_db.container['State']['Status'] == "running"
- result_db.container['State']['Restarting'] == false
- result_postgrest.container['State']['Status'] == "running"
- result_postgrest.container['State']['Restarting'] == false
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
40 changes: 40 additions & 0 deletions roles/tooljet/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- 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 tooljet redis
community.docker.docker_container:
name: "{{ tooljet_db_container_name }}"
state: absent
register: result_redis

- name: Try and stop and remove tooljet db
community.docker.docker_container:
name: "{{ tooljet_db_container_name }}"
state: absent
register: result_db

- name: Try and stop and remove tooljet postgrest
community.docker.docker_container:
name: "{{ tooljet_db_container_name }}"
state: absent
register: result_postgrest

- name: Try and stop and remove tooljet
community.docker.docker_container:
name: "{{ tooljet_container_name }}"
state: absent
register: result

- name: Check if tooljet is stopped
ansible.builtin.assert:
that:
- not result_redis.changed
- not result_db.changed
- not result_postgrest.changed
- not result.changed
1 change: 1 addition & 0 deletions roles/tooljet/requirements.yml
Loading

0 comments on commit ccaf61c

Please sign in to comment.