Skip to content

Commit

Permalink
✨ Add Heyform (#132)
Browse files Browse the repository at this point in the history
* ✨ Add Heyform

* 🚨 Fix lint
  • Loading branch information
anarion80 authored May 14, 2024
1 parent 5f9ccbf commit 26d5f67
Show file tree
Hide file tree
Showing 12 changed files with 312 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ If you have a spare domain name you can configure applications to be accessible
* [HA Fusion](https://github.com/matt8707/ha-fusion) - A modern, easy-to-use and performant custom Home Assistant dashboard
* [healthchecks.io](https://healthchecks.io/) - Ensure your NAS is online and get notified otherwise
* [Heimdall](https://heimdall.site/) - Home server dashboard
* [Heyform](https://github.com/heyform/heyform) - an open-source form builder that allows anyone to create engaging conversational forms
* [Homarr](https://github.com/ajnart/homarr) - Customizable browser's home page
* [Home Assistant](https://www.home-assistant.io) - Open source home automation
* [Homebridge](https://github.com/nfarina/homebridge) - Emulate the iOS HomeKit API
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@
tags:
- hello_world

- role: heyform
tags:
- heyform

- role: homarr
tags:
- homarr
Expand Down
70 changes: 70 additions & 0 deletions roles/heyform/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
heyform_enabled: false
heyform_available_externally: false

# directories
heyform_data_directory: "{{ docker_home }}/heyform"

# network
heyform_port: "8141"
heyform_hostname: "heyform"
heyform_network_name: "heyform"

# specs
heyform_memory: 1g
heyform_mongo_memory: 1g
heyform_redis_memory: 1g

# docker
heyform_container_name: heyform
heyform_image_name: "heyform/community-edition"
heyform_image_version: latest
heyform_mongo_container_name: heyform-mongodb
heyform_mongo_image_name: mongo
heyform_mongo_image_version: 4.4.29
heyform_redis_container_name: heyform-redis
heyform_redis_image_name: redis
heyform_redis_image_version: latest
heyform_user_id: "1000"
heyform_group_id: "1000"


# heyform
heyform_mongo_initdb_root_username: "heyform"
heyform_mongo_initdb_root_password: "heyform"
heyform_app_homepage_url: "https://{{ heyform_hostname }}.{{ ansible_nas_domain }}"
heyform_session_key: "key1"
heyform_form_encryption_key: "key2"
heyform_mongo_uri: "mongodb://{{ heyform_mongo_container_name }}:27017/heyform?authSource=admin"
heyform_mongo_user: "{{ heyform_mongo_initdb_root_username }}"
heyform_mongo_password: "{{ heyform_mongo_initdb_root_password }}"
heyform_redis_host: "{{ heyform_redis_container_name }}"
heyform_redis_port: "6379"
heyform_app_disable_registration: "false"
heyform_verify_user_email: "false"
heyform_smtp_from: ""
heyform_smtp_host: ""
heyform_smtp_port: ""
heyform_smtp_user: ""
heyform_smtp_password: ""
heyform_smtp_secure: "true"
heyform_smtp_ignore_cert: "true"
heyform_google_recaptcha_key: ""
heyform_google_recaptcha_secret: ""
heyform_apple_login_team_id: ""
heyform_apple_login_web_client_id: ""
heyform_apple_login_key_id: ""
heyform_apple_login_private_key_path: ""
heyform_google_login_client_id: ""
heyform_google_login_client_secret: ""
heyform_invite_code_expire_days: ""
heyform_unsplash_client_id: ""
heyform_openai_base_url: ""
heyform_openai_api_key: ""
heyform_openai_gpt_model: ""
heyform_s3_endpoint: ""
heyform_s3_region: ""
heyform_s3_bucket: ""
heyform_s3_access_key_id: ""
heyform_s3_secret_access_key: ""
heyform_s3_public_url: ""
11 changes: 11 additions & 0 deletions roles/heyform/docs/heyform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Heyform

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

HeyForm is an open-source form builder that allows anyone to create engaging conversational forms for surveys, questionnaires, quizzes, and polls. No coding skills required.

## Usage

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

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

- name: Get heyform mongo container state
community.docker.docker_container:
name: "{{ heyform_mongo_container_name }}"
register: result_mongo

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

- name: Get heyform container state
community.docker.docker_container:
name: "{{ heyform_container_name }}"
register: result

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

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

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

- name: Check if heyform is stopped
ansible.builtin.assert:
that:
- not result_mongo.changed
- not result_redis.changed
- not result.changed
1 change: 1 addition & 0 deletions roles/heyform/requirements.yml
128 changes: 128 additions & 0 deletions roles/heyform/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
- name: Start Heyform
block:
- name: Create Heyform Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ heyform_data_directory }}"

- name: Create Heyform network
community.docker.docker_network:
name: "{{ heyform_network_name }}"

- name: Create Heyform Mongo Docker Container
community.docker.docker_container:
name: "{{ heyform_mongo_container_name }}"
image: "{{ heyform_mongo_image_name }}:{{ heyform_mongo_image_version }}"
pull: true
volumes:
- "{{ heyform_data_directory }}/database:/data/db:rw"
networks:
- name: "{{ heyform_network_name }}"
network_mode: "{{ heyform_network_name }}"
container_default_behavior: no_defaults
env:
MONGO_INITDB_ROOT_USERNAME: "{{ heyform_mongo_initdb_root_username }}"
MONGO_INITDB_ROOT_PASSWORD: "{{ heyform_mongo_initdb_root_password }}"
labels:
traefik.enable: "false"
restart_policy: always
memory: "{{ heyform_mongo_memory }}"

- name: Create Heyform Redis Docker Container
community.docker.docker_container:
name: "{{ heyform_redis_container_name }}"
image: "{{ heyform_redis_image_name }}:{{ heyform_redis_image_version }}"
pull: true
volumes:
- "{{ heyform_data_directory }}/redis:/data:rw"
networks:
- name: "{{ heyform_network_name }}"
network_mode: "{{ heyform_network_name }}"
container_default_behavior: no_defaults
command: "redis-server --appendonly yes"
labels:
traefik.enable: "false"
restart_policy: always
memory: "{{ heyform_redis_memory }}"

- name: Create Heyform Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ heyform_container_name }}"
image: "{{ heyform_image_name }}:{{ heyform_image_version }}"
pull: true
volumes:
- "{{ heyform_data_directory }}/assets:/app/static/upload:rw"
networks:
- name: "{{ heyform_network_name }}"
network_mode: "{{ heyform_network_name }}"
ports:
- "{{ heyform_port }}:8000"
env:
APP_HOMEPAGE_URL: "{{ heyform_app_homepage_url }}"
APP_DISABLE_REGISTRATION: "{{ heyform_app_disable_registration }}"
VERIFY_USER_EMAIL: "{{ heyform_verify_user_email }}"
SESSION_KEY: "{{ heyform_session_key }}"
FORM_ENCRYPTION_KEY: "{{ heyform_form_encryption_key }}"
MONGO_URI: "{{ heyform_mongo_uri }}"
MONGO_USER: "{{ heyform_mongo_user }}"
MONGO_PASSWORD: "{{ heyform_mongo_password }}"
REDIS_HOST: "{{ heyform_redis_host }}"
REDIS_PORT: "{{ heyform_redis_port }}"
SMTP_FROM: "{{ heyform_smtp_from }}"
SMTP_HOST: "{{ heyform_smtp_host }}"
SMTP_PORT: "{{ heyform_smtp_port }}"
SMTP_USER: "{{ heyform_smtp_user }}"
SMTP_PASSWORD: "{{ heyform_smtp_password }}"
SMTP_SECURE: "{{ heyform_smtp_secure }}"
SMTP_IGNORE_CERT: "{{ heyform_smtp_ignore_cert }}"
GOOGLE_RECAPTCHA_KEY: "{{ heyform_google_recaptcha_key }}"
GOOGLE_RECAPTCHA_SECRET: "{{ heyform_google_recaptcha_secret }}"
APPLE_LOGIN_TEAM_ID: "{{ heyform_apple_login_team_id }}"
APPLE_LOGIN_WEB_CLIENT_ID: "{{ heyform_apple_login_web_client_id }}"
APPLE_LOGIN_KEY_ID: "{{ heyform_apple_login_key_id }}"
APPLE_LOGIN_PRIVATE_KEY_PATH: "{{ heyform_apple_login_private_key_path }}"
GOOGLE_LOGIN_CLIENT_ID: "{{ heyform_google_login_client_id }}"
GOOGLE_LOGIN_CLIENT_SECRET: "{{ heyform_google_login_client_secret }}"
INVITE_CODE_EXPIRE_DAYS: "{{ heyform_invite_code_expire_days }}"
UNSPLASH_CLIENT_ID: "{{ heyform_unsplash_client_id }}"
OPENAI_BASE_URL: "{{ heyform_openai_base_url }}"
OPENAI_API_KEY: "{{ heyform_openai_api_key }}"
OPENAI_GPT_MODEL: "{{ heyform_openai_gpt_model }}"
S3_ENDPOINT: "{{ heyform_s3_endpoint }}"
S3_REGION: "{{ heyform_s3_region }}"
S3_BUCKET: "{{ heyform_s3_bucket }}"
S3_ACCESS_KEY_ID: "{{ heyform_s3_access_key_id }}"
S3_SECRET_ACCESS_KEY: "{{ heyform_s3_secret_access_key }}"
S3_PUBLIC_URL: "{{ heyform_s3_public_url }}"
restart_policy: unless-stopped
memory: "{{ heyform_memory }}"
labels:
traefik.enable: "{{ heyform_available_externally | string }}"
traefik.http.routers.heyform.rule: "Host(`{{ heyform_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.heyform.tls.certresolver: "letsencrypt"
traefik.http.routers.heyform.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.heyform.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.heyform.loadbalancer.server.port: "8000"
when: heyform_enabled is true

- name: Stop Heyform
block:
- name: Stop Heyform Mongo
community.docker.docker_container:
name: "{{ heyform_mongo_container_name }}"
state: absent

- name: Stop Heyform Redis
community.docker.docker_container:
name: "{{ heyform_redis_container_name }}"
state: absent

- name: Stop Heyform
community.docker.docker_container:
name: "{{ heyform_container_name }}"
state: absent
when: heyform_enabled is false
2 changes: 1 addition & 1 deletion roles/wallos/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
path: "{{ item }}"
state: directory
owner: "{{ wallos_user_id }}"
group: "{{ wallos_group_id}}"
group: "{{ wallos_group_id }}"
with_items:
- "{{ wallos_data_directory }}"

Expand Down
14 changes: 14 additions & 0 deletions website/docs/applications/other/heyform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "Heyform"
description: "HeyForm is an open-source form builder that allows anyone to create engaging conversational forms for surveys, questionnaires, quizzes, and polls. No coding skills required."
---

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

HeyForm is an open-source form builder that allows anyone to create engaging conversational forms for surveys, questionnaires, quizzes, and polls. No coding skills required.

## Usage

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

heyform web interface can be found at [http://ansible_nas_host_or_ip:8141](http://ansible_nas_host_or_ip:8141).

0 comments on commit 26d5f67

Please sign in to comment.