Add ntfy role

Installs and configures the ntfysh server to enable notifications.
This commit is contained in:
Marty Oehme 2022-01-23 13:54:56 +01:00
parent 1e0643352d
commit 32b1b13ef4
Signed by: Marty
GPG key ID: B7538B8F50A1C800
11 changed files with 253 additions and 0 deletions

View file

@ -0,0 +1,25 @@
version: '3.4'
services:
app:
image: "{{ stack_image }}:{{ ntfy_version }}"
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "localhost"]
interval: 1m
timeout: 10s
retries: 3
start_period: 1m
volumes:
- "{{ ntfy_upstream_file_dir }}/server.yml:/etc/ntfy/server.yml"
- cache:/var/cache/ntfy
networks:
- "{{ docker_swarm_public_network_name }}"
volumes:
cache:
networks:
"{{ docker_swarm_public_network_name }}":
external: true

View file

@ -0,0 +1,15 @@
base-url: "https://{{ server_domain }}"
global_topic_limit: "{{ ntfy_global_topic_limit }}"
visitor_subscription_limit: "{{ ntfy_visitor_subscription_limit }}"
visitor_request_limit_burst: "{{ ntfy_visitor_request_limit_burst }}"
visitor_request_limit_replenish: "{{ ntfy_visitor_request_limit_replenish }}"
cache-file: "/var/cache/ntfy/cache.db"
cache_duration: "{{ ntfy_cache_duration }}"
attachment-cache-dir: "/var/cache/ntfy/attachments"
attachment_total_size_limit: "{{ ntfy_attachment_total_size_limit }}"
attachment_file_size_limit: "{{ ntfy_attachment_file_size_limit }}"
attachment_expiry_duration: "{{ ntfy_attachment_expiry_duration }}"
visitor_attachment_total_size_limit: "{{ ntfy_visitor_attachment_total_size_limit }}"
visitor_attachment_daily_bandwidth_limit: "{{ ntfy_visitor_attachment_daily_bandwidth_limit }}"
behind-proxy: true # uses 'X-Forwarded-For' Headers for individual visitors
# TODO i believe Caddy does not set the correct X-Forwarded-For header, see whoami container to check

View file

@ -0,0 +1,40 @@
{
"@id": "{{ stack_name }}_upstream",
{% if server_domain is not undefined and not none %}
"match": [
{
"host": [
{% if subdomain_alias is not undefined and not none %}
"{{ subdomain_alias }}.{{ server_domain }}"
{% else %}
"{{ stack_name }}.{{ server_domain }}"
{% endif %}
]
}
],
{% else %}
"match": [
{
"path": [
{% if subdomain_alias is not undefined and not none %}
"/{{ subdomain_alias }}*"
{% else %}
"/{{ stack_name }}*"
{% endif %}
,
"/"
]
}
],
{% endif %}
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "{{ stack_name }}_app:80"
}
]
}
]
}