Skip to content

Commit

Permalink
✨ Add Grist
Browse files Browse the repository at this point in the history
  • Loading branch information
anarion80 committed Jun 6, 2024
1 parent b70bd19 commit f30337a
Show file tree
Hide file tree
Showing 12 changed files with 461 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Gotify](https://gotify.net/) - Self-hosted server for sending push notifications
* [Grafana](https://grafana.com/) - Query, visualize, alert on, and understand your data no matter where it’s stored (via stats role).
* [Graylog](https://www.graylog.org/) - Free and open source log management
* [Grist](https://github.com/gristlabs/grist-core) - Grist is the evolution of spreadsheets.
* [Grocy](https://grocy.info/) - web-based self-hosted groceries & household management solution for your home
* [Guacamole](https://guacamole.apache.org/) - Web based remote desktop gateway, supports VNC, RDP and SSH
* [HA Fusion](https://github.com/matt8707/ha-fusion) - A modern, easy-to-use and performant custom Home Assistant dashboard
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@
tags:
- graylog

- role: grist
tags:
- grist

- role: grocy
tags:
- grocy
Expand Down
147 changes: 147 additions & 0 deletions roles/grist/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
grist_enabled: false
grist_available_externally: false

# directories
grist_data_directory: "{{ docker_home }}/grist"

# network
grist_port: "8485"
grist_hostname: "grist"
grist_network_name: "grist"

# specs
grist_memory: 1g
grist_db_memory: 1g
grist_redis_memory: 1g
grist_minio_memory: 1g

# docker
grist_container_name: grist
grist_image_name: "gristlabs/grist"
grist_image_version: latest
grist_db_container_name: grist-db
grist_db_image_name: "postgres"
grist_db_image_version: "14"
grist_redis_container_name: grist-redis
grist_redis_image_name: "redis"
grist_redis_image_version: latest
grist_minio_container_name: grist-minio
grist_minio_image_name: "minio/minio"
grist_minio_image_version: latest
grist_user_id: "1000"
grist_group_id: "1000"

# grist
grist_session_secret: "super_secret"
grist_default_email: "grist@{{ ansible_nas_domain }}"
grist_sandbox_flavor: "gvisor"
grist_boot_key: "super_secret"
grist_app_home_url: "https://{{ grist_hostname }}.{{ ansible_nas_domain }}"
grist_single_org: ansible-nas
grist_cookie_max_age: "86400"
grist_force_login: "true"
grist_hide_ui_elements: "" # =helpCenter,billing,templates,multiSite,multiAccounts
grist_page_title_suffix: " - Ansible-NAS"
grist_app_static_include_custom_css: "false"
grist_widget_list_url: "https://github.com/gristlabs/grist-widget/releases/download/latest/manifest.json"
grist_sendgrid_api_key: "SG.XXXXXXX.XXXXX"
grist_sendgrid_api_prefix: "https://api.sendgrid.com/v3"
grist_sendgrid_api_enroll: "/marketing/contacts"
grist_sendgrid_api_search: "/marketing/contacts/search"
grist_sendgrid_api_search_by_email: "/marketing/contacts/search/emails"
grist_sendgrid_api_list_remove: "/marketing/lists/id/contacts"
grist_sendgrid_api_send: "/mail/send"
grist_sendgrid_address_from_email: "<grist@{{ ansible_nas_domain }}>"
grist_sendgrid_address_from_name: "Grist at Ansible-NAS"

Check failure on line 56 in roles/grist/defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint

yaml[colons]

Too many spaces after colon
grist_sendgrid_template_invite: "d-f9....."
grist_sendgrid_template_billing_manager_invite: "d-f9....."
grist_sendgrid_template_member_change: "d-b3....."
grist_sendgrid_list_singleuser_onboarding: "b22..."
grist_sendgrid_unsubscribe_group_invites: "19..."
grist_sendgrid_unsubscribe_group_billing_managers: "19..."
grist_minio_root_user: "grist"
grist_minio_root_password: "admingrist"
grist_docs_minio_access_key: "{{ grist_minio_root_user }}"
grist_docs_minio_secret_key: "{{ grist_minio_root_password}}"

Check warning on line 66 in roles/grist/defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint

jinja[spacing]

Jinja2 spacing could be improved: {{ grist_minio_root_password}} -> {{ grist_minio_root_password }}
grist_docs_minio_use_ssl: "0"
grist_docs_minio_bucket: "grist-docs"
grist_docs_minio_endpoint: "{{ grist_minio_container_name }}"
grist_docs_minio_port: "9000"
grist_redis_url: "redis://{{ grist_redis_container_name }}"
grist_telemetry_level: "off"
grist_db_type: "postgres"
grist_db_name: "grist"
grist_db_user: "grist"
grist_db_pass: "grist"
grist_db_host: "{{ grist_db_container_name }}"
grist_db_port: "5432"
grist_offer_all_languages: "true"
grist_saml_idp_skip_slo: "false"
grist_saml_sp_host: "https://{{ grist_hostname }}.{{ ansible_nas_domain }}"
grist_saml_idp_unencrypted: "1"
grist_saml_idp_login: "https://...auth0.com/samlp/xxxx"
grist_saml_idp_logout: "https://...auth0.com/samlp/xxxx"
grist_saml_idp_certs: ".../auth0.pem"
grist_saml_sp_key: ".../saml.pem (created)"
grist_saml_sp_cert: "../saml.crt (created)"
grist_oidc_sp_host: "https://{{ grist_hostname }}.{{ ansible_nas_domain }}"
grist_oidc_idp_issuer: "https://example.com"
grist_oidc_idp_scopes: "openid profile email"
grist_oidc_idp_client_id: ""

Check failure on line 91 in roles/grist/defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint

yaml[colons]

Too many spaces after colon
grist_oidc_idp_client_secret: ""
grist_oidc_idp_end_session_endpoint: ""
grist_oidc_idp_skip_end_session_endpoint: ""
grist_oidc_sp_profile_name_attr: ""
grist_oidc_sp_profile_email_attr: ""

grist_env:
GRIST_SESSION_SECRET: "{{ grist_session_secret }}"
GRIST_DEFAULT_EMAIL: "{{ grist_default_email }}"
GRIST_SANDBOX_FLAVOR: "{{ grist_sandbox_flavor }}"
GRIST_BOOT_KEY: "{{ grist_boot_key }}"
APP_HOME_URL: "{{ grist_app_home_url }}"
GRIST_SINGLE_ORG: "{{ grist_single_org }}"
COOKIE_MAX_AGE: "{{ grist_cookie_max_age }}"
GRIST_FORCE_LOGIN: "{{ grist_force_login }}"
GRIST_HIDE_UI_ELEMENTS: "{{ grist_hide_ui_elements }}"
GRIST_PAGE_TITLE_SUFFIX: "{{ grist_page_title_suffix }}"
APP_STATIC_INCLUDE_CUSTOM_CSS: "{{ grist_app_static_include_custom_css }}"
GRIST_WIDGET_LIST_URL: "{{ grist_widget_list_url }}"
SENDGRID_API_KEY: "{{ grist_sendgrid_api_key }}"
GRIST_DOCS_MINIO_ACCESS_KEY: "{{ grist_docs_minio_access_key }}"
GRIST_DOCS_MINIO_SECRET_KEY: "{{ grist_docs_minio_secret_key }}"
GRIST_DOCS_MINIO_USE_SSL: "{{ grist_docs_minio_use_ssl }}"

Check warning on line 114 in roles/grist/defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint

jinja[spacing]

Jinja2 spacing could be improved: {{ grist_docs_minio_use_ssl }} -> {{ grist_docs_minio_use_ssl }}
GRIST_DOCS_MINIO_BUCKET: "{{ grist_docs_minio_bucket }}"
GRIST_DOCS_MINIO_ENDPOINT: "{{ grist_docs_minio_endpoint }}"
GRIST_DOCS_MINIO_PORT: "{{ grist_docs_minio_port }}"
REDIS_URL: "{{ grist_redis_url }}"
GRIST_TELEMETRY_LEVEL: "{{ grist_telemetry_level }}"
TYPEORM_TYPE: "{{ grist_db_type }}"
TYPEORM_DATABASE: "{{ grist_db_name }}"
TYPEORM_USERNAME: "{{ grist_db_user }}"
TYPEORM_PASSWORD: "{{ grist_db_pass }}"
TYPEORM_HOST: "{{ grist_db_host }}"
TYPEORM_PORT: "{{ grist_db_port }}"
GRIST_OFFER_ALL_LANGUAGES: "{{ grist_offer_all_languages }}"
# GRIST_SAML_IDP_SKIP_SLO: "{{ grist_saml_idp_skip_slo }}"
# GRIST_SAML_SP_HOST: "{{ grist_saml_sp_host }}"
# GRIST_SAML_IDP_UNENCRYPTED: "{{ grist_saml_idp_unencrypted }}"
# GRIST_SAML_IDP_LOGIN: "{{ grist_saml_idp_login }}"
# GRIST_SAML_IDP_LOGOUT: "{{ grist_saml_idp_logout }}"
# GRIST_SAML_IDP_CERTS: "{{ grist_saml_idp_certs }}"
# GRIST_SAML_SP_KEY: "{{ grist_saml_sp_key }}"
# GRIST_SAML_SP_CERT: "{{ grist_saml_sp_cert }}"
# GRIST_OIDC_SP_HOST: "{{ grist_oidc_sp_host }}"
# GRIST_OIDC_IDP_ISSUER: "{{ grist_oidc_idp_issuer }}"
# GRIST_OIDC_IDP_SCOPES: "{{ grist_oidc_idp_scopes }}"
# GRIST_OIDC_IDP_CLIENT_ID: "{{ grist_oidc_idp_client_id }}"
# GRIST_OIDC_IDP_CLIENT_SECRET: "{{ grist_oidc_idp_client_secret }}"
# GRIST_OIDC_IDP_END_SESSION_ENDPOINT: "{{ grist_oidc_idp_end_session_endpoint }}"
# GRIST_OIDC_IDP_SKIP_END_SESSION_ENDPOINT : "{{ grist_oidc_idp_skip_end_session_endpoint }}"
# GRIST_OIDC_SP_PROFILE_NAME_ATTR: "{{ grist_oidc_sp_profile_name_attr }}"
# GRIST_OIDC_SP_PROFILE_EMAIL_ATTR: "{{ grist_oidc_sp_profile_email_attr }}"

grist_minio_env:
MINIO_ROOT_USER: "{{ grist_minio_root_user }}"
MINIO_ROOT_PASSWORD: "{{ grist_minio_root_password }}"
11 changes: 11 additions & 0 deletions roles/grist/docs/grist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Grist

Homepage: [https://github.com/gristlabs/grist-core](https://github.com/gristlabs/grist-core)

Grist is the evolution of spreadsheets.

## Usage

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

Grist web interface can be found at [http://ansible_nas_host_or_ip:8485](http://ansible_nas_host_or_ip:8485).
16 changes: 16 additions & 0 deletions roles/grist/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
platforms:
- name: instance
image: geerlingguy/docker-ubuntu2204-ansible:latest
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /var/run/docker.sock:/var/run/docker.sock
- /tmp:/tmp:rw
privileged: true
pre_build_image: true
provisioner:
inventory:
group_vars:
all:
grist_enabled: true
grist_data_directory: /tmp
10 changes: 10 additions & 0 deletions roles/grist/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:
grist_enabled: false
40 changes: 40 additions & 0 deletions roles/grist/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 grist db container state
community.docker.docker_container:
name: "{{ grist_db_container_name }}"
register: result_db

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

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

- name: Get grist container state
community.docker.docker_container:
name: "{{ grist_container_name }}"
register: result

- name: Check if grist containers are running
ansible.builtin.assert:
that:
- result_db.container['State']['Status'] == "running"
- result_db.container['State']['Restarting'] == false
- result_redis.container['State']['Status'] == "running"
- result_redis.container['State']['Restarting'] == false
- result_minio.container['State']['Status'] == "running"
- result_minio.container['State']['Restarting'] == false
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
40 changes: 40 additions & 0 deletions roles/grist/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 grist
community.docker.docker_container:
name: "{{ grist_container_name }}"
state: absent
register: result

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

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

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

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

0 comments on commit f30337a

Please sign in to comment.