From a1e7df19f5b618a7909333bb3aa3a859ab174b49 Mon Sep 17 00:00:00 2001 From: Anarion Date: Tue, 28 May 2024 14:34:53 +0200 Subject: [PATCH 1/2] :sparkles: Add Notifo --- README.md | 1 + nas.yml | 4 + roles/notifo/defaults/main.yml | 39 +++++++++ roles/notifo/docs/notifo.md | 11 +++ roles/notifo/molecule/default/molecule.yml | 6 ++ roles/notifo/molecule/default/side_effect.yml | 10 +++ roles/notifo/molecule/default/verify.yml | 26 ++++++ .../molecule/default/verify_stopped.yml | 26 ++++++ roles/notifo/requirements.yml | 1 + roles/notifo/tasks/main.yml | 82 +++++++++++++++++++ website/docs/applications/other/notifo.md | 14 ++++ 11 files changed, 220 insertions(+) create mode 100644 roles/notifo/defaults/main.yml create mode 100644 roles/notifo/docs/notifo.md create mode 100644 roles/notifo/molecule/default/molecule.yml create mode 100644 roles/notifo/molecule/default/side_effect.yml create mode 100644 roles/notifo/molecule/default/verify.yml create mode 100644 roles/notifo/molecule/default/verify_stopped.yml create mode 120000 roles/notifo/requirements.yml create mode 100644 roles/notifo/tasks/main.yml create mode 100644 website/docs/applications/other/notifo.md diff --git a/README.md b/README.md index 4cb8468fef..b177399f6d 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ If you have a spare domain name you can configure applications to be accessible * [Nextcloud](https://nextcloud.com/) - A self-hosted Dropbox alternative * [Node-RED](https://nodered.org/) - A programming tool for wiring together hardware devices, APIs and online services * [Nomad](https://www.nomadproject.io/) - A simple and flexible scheduler and software orchestrator +* [Notifo](https://github.com/notifo-io/notifo) - Multi channel notification service for collaboration tools, e-commerce, news service and more. * [NZBget](https://nzbget.net/) - The most efficient usenet downloader * [Nzbhydra2](https://github.com/theotherp/nzbhydra2) - Usenet meta search * [Obsidian](https://obsidian.md/) - Obsidian is the private and flexible writing app diff --git a/nas.yml b/nas.yml index 9081beaf08..aefc9e5de3 100644 --- a/nas.yml +++ b/nas.yml @@ -562,6 +562,10 @@ tags: - nomad + - role: notifo + tags: + - notifo + - role: nzbget tags: - nzbget diff --git a/roles/notifo/defaults/main.yml b/roles/notifo/defaults/main.yml new file mode 100644 index 0000000000..e44d65dc89 --- /dev/null +++ b/roles/notifo/defaults/main.yml @@ -0,0 +1,39 @@ +--- +notifo_enabled: false +notifo_available_externally: false + +# directories +notifo_data_directory: "{{ docker_home }}/notifo" + +# network +notifo_port: "5007" +notifo_hostname: "notifo" +notifo_network_name: "notifo" + +# specs +notifo_memory: 1g +notifo_mongo_memory: 1g + +# docker +notifo_container_name: notifo +notifo_image_name: "squidex/notifo" +notifo_image_version: latest +notifo_mongo_container_name: notifo-mongodb +notifo_mongo_image_name: mongo +notifo_mongo_image_version: 5 +notifo_user_id: "1000" +notifo_group_id: "1000" + + +# notifo +notifo_mongo_initdb_root_username: "notifo" +notifo_mongo_initdb_root_password: "notifo" +notifo_urls_baseurl: "https://{{ notifo_hostname }}.{{ ansible_nas_domain }}" +notifo_storage_mongodb_connectionstring: "mongodb://{{ notifo_mongo_container_name }}" +notifo_identity_googleclient: "" +notifo_identity_googlesecret: "" +notifo_identity_githubclient: "" +notifo_identity_githubsecret: "" +notifo_identity_microsoftclient: "" +notifo_identity_microsoftsecret: "" +notifo_aspnetcore_urls: "http://+:5000" diff --git a/roles/notifo/docs/notifo.md b/roles/notifo/docs/notifo.md new file mode 100644 index 0000000000..736c12f5f0 --- /dev/null +++ b/roles/notifo/docs/notifo.md @@ -0,0 +1,11 @@ +# Notifo + +Homepage: [https://github.com/notifo-io/notifo](https://github.com/notifo-io/notifo) + +Multi channel notification service for collaboration tools, e-commerce, news service and more. + +## Usage + +Set `heyform_enabled: true` in your `inventories//group_vars/nas.yml` file. + +heyform web interface can be found at [http://ansible_nas_host_or_ip:5007](http://ansible_nas_host_or_ip:5007). diff --git a/roles/notifo/molecule/default/molecule.yml b/roles/notifo/molecule/default/molecule.yml new file mode 100644 index 0000000000..29c5fbde5f --- /dev/null +++ b/roles/notifo/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + notifo_enabled: true diff --git a/roles/notifo/molecule/default/side_effect.yml b/roles/notifo/molecule/default/side_effect.yml new file mode 100644 index 0000000000..75551daa7b --- /dev/null +++ b/roles/notifo/molecule/default/side_effect.yml @@ -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: + notifo_enabled: false diff --git a/roles/notifo/molecule/default/verify.yml b/roles/notifo/molecule/default/verify.yml new file mode 100644 index 0000000000..0be152566c --- /dev/null +++ b/roles/notifo/molecule/default/verify.yml @@ -0,0 +1,26 @@ +--- +- name: Verify + hosts: all + gather_facts: false + tasks: + - name: Include vars + ansible.builtin.include_vars: + file: ../../defaults/main.yml + + - name: Get notifo mongo container state + community.docker.docker_container: + name: "{{ notifo_mongo_container_name }}" + register: result_mongo + + - name: Get notifo container state + community.docker.docker_container: + name: "{{ notifo_container_name }}" + register: result + + - name: Check if notifo containers are running + ansible.builtin.assert: + that: + - result_mongo.container['State']['Status'] == "running" + - result_mongo.container['State']['Restarting'] == false + - result.container['State']['Status'] == "running" + - result.container['State']['Restarting'] == false diff --git a/roles/notifo/molecule/default/verify_stopped.yml b/roles/notifo/molecule/default/verify_stopped.yml new file mode 100644 index 0000000000..48fb21f2a2 --- /dev/null +++ b/roles/notifo/molecule/default/verify_stopped.yml @@ -0,0 +1,26 @@ +--- +- 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 notifo mongo + community.docker.docker_container: + name: "{{ notifo_mongo_container_name }}" + state: absent + register: result_mongo + + - name: Try and stop and remove notifo + community.docker.docker_container: + name: "{{ notifo_container_name }}" + state: absent + register: result + + - name: Check if notifo is stopped + ansible.builtin.assert: + that: + - not result_mongo.changed + - not result.changed diff --git a/roles/notifo/requirements.yml b/roles/notifo/requirements.yml new file mode 120000 index 0000000000..9a736435ab --- /dev/null +++ b/roles/notifo/requirements.yml @@ -0,0 +1 @@ +../../requirements.yml \ No newline at end of file diff --git a/roles/notifo/tasks/main.yml b/roles/notifo/tasks/main.yml new file mode 100644 index 0000000000..78709bd520 --- /dev/null +++ b/roles/notifo/tasks/main.yml @@ -0,0 +1,82 @@ +--- +- name: Start Notifo + block: + - name: Create Notifo Directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + with_items: + - "{{ notifo_data_directory }}" + + - name: Create Notifo network + community.docker.docker_network: + name: "{{ notifo_network_name }}" + + - name: Create Notifo Mongo Docker Container + community.docker.docker_container: + name: "{{ notifo_mongo_container_name }}" + image: "{{ notifo_mongo_image_name }}:{{ notifo_mongo_image_version }}" + pull: true + volumes: + - "{{ notifo_data_directory }}/database:/data/db:rw" + networks: + - name: "{{ notifo_network_name }}" + network_mode: "{{ notifo_network_name }}" + container_default_behavior: no_defaults + env: + # MONGO_INITDB_ROOT_USERNAME: "{{ notifo_mongo_initdb_root_username }}" + # MONGO_INITDB_ROOT_PASSWORD: "{{ notifo_mongo_initdb_root_password }}" + labels: + traefik.enable: "false" + restart_policy: always + memory: "{{ notifo_mongo_memory }}" + + - name: Create Notifo Docker Container + community.docker.docker_container: + container_default_behavior: no_defaults + name: "{{ notifo_container_name }}" + image: "{{ notifo_image_name }}:{{ notifo_image_version }}" + pull: true + volumes: + - "{{ notifo_data_directory }}/assets:/app/Assets:rw" + networks: + - name: "{{ notifo_network_name }}" + network_mode: "{{ notifo_network_name }}" + ports: + - "{{ notifo_port }}:5000" + env: + URLS__BASEURL: "{{ notifo_urls_baseurl }}" + STORAGE__MONGODB__CONNECTIONSTRING: "{{ notifo_storage_mongodb_connectionstring }}" + IDENTITY__GOOGLECLIENT: "{{ notifo_identity_googleclient }}" + IDENTITY__GOOGLESECRET: "{{ notifo_identity_googlesecret }}" + IDENTITY__GITHUBCLIENT: "{{ notifo_identity_githubclient }}" + IDENTITY__GITHUBSECRET: "{{ notifo_identity_githubsecret }}" + IDENTITY__MICROSOFTCLIENT: "{{ notifo_identity_microsoftclient }}" + IDENTITY__MICROSOFTSECRET: "{{ notifo_identity_microsoftsecret }}" + ASPNETCORE_URLS: "{{ notifo_aspnetcore_urls }}" + restart_policy: unless-stopped + memory: "{{ notifo_memory }}" + labels: + traefik.enable: "{{ notifo_available_externally | string }}" + traefik.http.routers.notifo.rule: "Host(`{{ notifo_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.notifo.tls.certresolver: "letsencrypt" + traefik.http.routers.notifo.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.notifo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.notifo.loadbalancer.server.port: "5000" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:5000/healthz"] + start_period: 60s + when: notifo_enabled is true + +- name: Stop Notifo + block: + - name: Stop Notifo Mongo + community.docker.docker_container: + name: "{{ notifo_mongo_container_name }}" + state: absent + + - name: Stop Notifo + community.docker.docker_container: + name: "{{ notifo_container_name }}" + state: absent + when: notifo_enabled is false diff --git a/website/docs/applications/other/notifo.md b/website/docs/applications/other/notifo.md new file mode 100644 index 0000000000..d5f44c46b3 --- /dev/null +++ b/website/docs/applications/other/notifo.md @@ -0,0 +1,14 @@ +--- +title: "Notifo" +description: "Multi channel notification service for collaboration tools, e-commerce, news service and more." +--- + +Homepage: [https://github.com/notifo-io/notifo](https://github.com/notifo-io/notifo) + +Multi channel notification service for collaboration tools, e-commerce, news service and more. + +## Usage + +Set `heyform_enabled: true` in your `inventories//group_vars/nas.yml` file. + +heyform web interface can be found at [http://ansible_nas_host_or_ip:5007](http://ansible_nas_host_or_ip:5007). From 24e6907c11a1e927897cbc893d0dbdfee4b443d7 Mon Sep 17 00:00:00 2001 From: Anarion Date: Tue, 28 May 2024 14:44:18 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20lint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/notifo/defaults/main.yml | 2 -- roles/notifo/tasks/main.yml | 3 --- 2 files changed, 5 deletions(-) diff --git a/roles/notifo/defaults/main.yml b/roles/notifo/defaults/main.yml index e44d65dc89..3a65ff4901 100644 --- a/roles/notifo/defaults/main.yml +++ b/roles/notifo/defaults/main.yml @@ -26,8 +26,6 @@ notifo_group_id: "1000" # notifo -notifo_mongo_initdb_root_username: "notifo" -notifo_mongo_initdb_root_password: "notifo" notifo_urls_baseurl: "https://{{ notifo_hostname }}.{{ ansible_nas_domain }}" notifo_storage_mongodb_connectionstring: "mongodb://{{ notifo_mongo_container_name }}" notifo_identity_googleclient: "" diff --git a/roles/notifo/tasks/main.yml b/roles/notifo/tasks/main.yml index 78709bd520..752c9d4e6a 100644 --- a/roles/notifo/tasks/main.yml +++ b/roles/notifo/tasks/main.yml @@ -23,9 +23,6 @@ - name: "{{ notifo_network_name }}" network_mode: "{{ notifo_network_name }}" container_default_behavior: no_defaults - env: - # MONGO_INITDB_ROOT_USERNAME: "{{ notifo_mongo_initdb_root_username }}" - # MONGO_INITDB_ROOT_PASSWORD: "{{ notifo_mongo_initdb_root_password }}" labels: traefik.enable: "false" restart_policy: always