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 Notifo #152

Merged
merged 2 commits into from
May 28, 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 @@ -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
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@
tags:
- nomad

- role: notifo
tags:
- notifo

- role: nzbget
tags:
- nzbget
Expand Down
37 changes: 37 additions & 0 deletions roles/notifo/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
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_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"
11 changes: 11 additions & 0 deletions roles/notifo/docs/notifo.md
Original file line number Diff line number Diff line change
@@ -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/<your_inventory>/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).
6 changes: 6 additions & 0 deletions roles/notifo/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
notifo_enabled: true
10 changes: 10 additions & 0 deletions roles/notifo/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:
notifo_enabled: false
26 changes: 26 additions & 0 deletions roles/notifo/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions roles/notifo/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions roles/notifo/requirements.yml
79 changes: 79 additions & 0 deletions roles/notifo/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
- 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
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
14 changes: 14 additions & 0 deletions website/docs/applications/other/notifo.md
Original file line number Diff line number Diff line change
@@ -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/<your_inventory>/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).