diff --git a/bundles/steam-chat-viewer/metadata.py b/bundles/steam-chat-viewer/metadata.py new file mode 100644 index 0000000..1960c58 --- /dev/null +++ b/bundles/steam-chat-viewer/metadata.py @@ -0,0 +1,55 @@ +from ipaddress import ip_interface + +defaults = { + 'flask': { + 'steam-chat-viewer' : { + 'git_url': "https://git.sublimity.de/cronekorkn/steam-chat-viewer.git", + 'port': 4001, + 'app_module': 'steam_chat_viewer', + 'user': 'steam_chat_viewer', + 'group': 'steam_chat_viewer', + 'timeout': 900, + 'env': { + 'DB_HOST': 'localhost', + 'DB_NAME': 'steam_chat_logger', + 'DB_USER': 'steam_chat_logger', + }, + }, + }, + 'users': { + 'steam_chat_viewer': {}, + }, +} + + +@metadata_reactor.provides( + 'flask/steam-chat-viewer/env/DB_PASSWORD', +) +def agent_conf(metadata): + return { + 'flask': { + 'steam-chat-viewer': { + 'env': { + 'DB_PASSWORD': metadata.get('postgresql/roles/steam_chat_logger/password'), + }, + }, + }, + } + + +@metadata_reactor.provides( + 'nginx/vhosts', +) +def nginx(metadata): + return { + 'nginx': { + 'vhosts': { + metadata.get('steam-chat-viewer/hostname'): { + 'content': 'steam-chat-viewer/vhost.conf', + 'context': { + 'target': 'http://127.0.0.1:4001', + }, + }, + }, + }, + } diff --git a/data/steam-chat-viewer/vhost.conf b/data/steam-chat-viewer/vhost.conf new file mode 100644 index 0000000..fab0b7f --- /dev/null +++ b/data/steam-chat-viewer/vhost.conf @@ -0,0 +1,20 @@ +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + server_name ${server_name}; + + ssl_certificate /var/lib/dehydrated/certs/${server_name}/fullchain.pem; + ssl_certificate_key /var/lib/dehydrated/certs/${server_name}/privkey.pem; + + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_pass http://127.0.0.1:4001; + } + + location /steamuserimages/ { + root /var/lib/steam_chat_logger/steamuserimages; + rewrite ^/steamuserimages(.*)$ $1 break; + autoindex on; + } +} diff --git a/nodes/home.server.py b/nodes/home.server.py index 70d7a2d..98468e3 100644 --- a/nodes/home.server.py +++ b/nodes/home.server.py @@ -25,6 +25,7 @@ 'redis', 'smartctl', 'steam-chat-logger', + 'steam-chat-viewer', 'raspberrymatic-cert', 'tasmota-charge', 'wireguard', @@ -103,6 +104,9 @@ 'IMAP_USER': 'i@ckn.li', 'IMAP_PASSWORD': '!decrypt:encrypt$gAAAAABiUzcTVRL-Xb4RDjcwciZawYlmOa9Qy_hKz6sVWDlwZqUFLGRD8ERWoFCOWCM22Sq73Gc4nFuAblBB6wpbH5YEltLA6hmROGKpOFhI63ESLFwNgbY=', }, + 'steam-chat-viewer': { + 'hostname': 'steam-chats.ckn.li', + }, 'tasmota-charge': { 'phone': { 'ip': '10.0.0.175',