đąApprise API web based push notification
Apprise est une librairie Ă©crite en Python et qui vous permet dâenvoyer des notifications (push) Ă la quasi-totalitĂ© des services existant aujourdâhui.
Pour plus dâinformations sur les options de dĂ©ploiement Docker et les configurations de conteneurs avancĂ©es, reportez-vous Ă la section DĂ©ploiement Docker. Pour une configuration systĂšme et des variables dâenvironnement complĂštes, reportez-vous Ă la section Configuration. Pour des exemples dâutilisation dâAPI et des dĂ©tails sur les points de terminaison, reportez-vous Ă API Reference.
Apprise API
Démarrage rapide avec Docker
La mĂ©thode la plus rapide pour lancer lâAPI Apprise consiste Ă utiliser lâimage Docker prĂ©dĂ©finie. Le service fonctionne sur le port 8000 et ne nĂ©cessite aucune configuration initiale.
Déploiement de base
1
2
3
4
docker run -d \
--name apprise-api \
-p 8000:8000 \
caronc/apprise:latest
Utilisation de Docker Compose
Créer le dossier apprise-api
1
2
mkdir -p $HOME/apprise-api
cd $HOME/apprise-api
Pour une configuration persistante et une gestion plus facile, utilisez le docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
services:
apprise:
image: caronc/apprise:latest
container_name: apprise
ports:
- "8000:8000"
environment:
APPRISE_STATEFUL_MODE: simple
APPRISE_WORKER_COUNT: 1
APPRISE_ADMIN: "y"
volumes:
- ../docker-data/apprise-api/config:/config
- ../docker-data/apprise-api:/attach
1
2
3
git clone https://github.com/caronc/apprise-api.git
cd apprise-api
docker compose up -d
Le service sera disponible Ă lâadresse http://localhost:8000
Proxy nginx
Créer le fichier :
1
sudo nano /etc/nginx/conf.d/apprise.rnmkcy.eu.conf
Sans protection
Utiliser cette structure (basé sur official example):
Ajouter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name apprise.rnmkcy.eu;
include /etc/nginx/conf.d/ssl-modern.inc;
include snippets/authelia.conf; # Point de terminaison dâauthentification Authelia
location /static/ {
alias /opt/apprise-api/static/;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
include snippets/auth.conf; # Protéger ce point de terminaison
}
Vérifier et recharger NGINX:
1
2
sudo nginx -t
sudo systemctl reload nginx
Avec protection Authelia SSO
Modifier le fichier de configuration authelia pour ajouter une rĂšgle
1
2
3
4
5
6
7
access_control:
# On définit les rÚgles
rules:
## catch-all
- domain:
- "apprise.rnmkcy.eu"
policy: two_factor
Redémarrer authelia
1
sudo systemctl restart authelia
test
1
2
3
4
curl -s -X POST https://apprise.rnmkcy.eu/notify/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer APPRISE_KEY" \
-d '{"targets":["ntfy://:tk_9h2bfxjs0pkbuwsnavc6w0wua5t5x@ntfy.rnmkcy.eu/yan_infos"],"title":"Test","body":"Essai..."}'
Le fichier de configuration nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#/etc/nginx/conf.d/apprise.rnmkcy.eu.conf
server {
listen 80;
listen [::]:80;
server_name apprise.rnmkcy.eu;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name apprise.rnmkcy.eu;
include /etc/nginx/conf.d/ssl-modern.inc;
# Internal Authelia verify endpoint
location = /authelia {
internal;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header Host $host;
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:9091/api/verify;
proxy_read_timeout 10s;
}
# Static assets if needed (adjust path)
location /static/ {
alias /opt/apprise-api/static/;
}
# Protect all other locations with Authelia
location / {
auth_request /authelia;
auth_request_set $target_url $scheme://$http_host$request_uri;
auth_request_set $user $upstream_http_remote_user;
auth_request_set $groups $upstream_http_remote_groups;
proxy_set_header Remote-User $user;
proxy_set_header Remote-Groups $groups;
error_page 401 =302 https://auth.rnmkcy.eu/?rd=$target_url;
proxy_pass http://192.168.0.222:8000;
proxy_redirect off;
# Preserve client info for backend and Authelia checks
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
# Support websockets/long polling if Apprise uses them
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "";
# Proxy buffering tweaks
proxy_buffers 16 64k;
proxy_buffer_size 128k;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
# Optional: redirect plain HTTP to HTTPS (if you have a server listening 80)
# Additional security headers (tune as desired)
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block";
}
Configuration web
LâAPI inclut un gestionnaire de configuration intĂ©grĂ© Ă https://apprise.rnmkcy.eu
Les configurations sont stockées sous un identifiant de configuration (ou une clé) unique. Choisir un mot clé: yankey

Entrez vos URL (format TEXT ou YAML) et enregistrez-les sur votre clé.
Ici on utilise ntfy



