steam chat logger

This commit is contained in:
mwiegand 2022-04-20 00:37:11 +02:00
parent b27f07a867
commit f2439dcf66
4 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,41 @@
directories = {
'/opt/steam_chat_logger': {
'owner': 'steam_chat_logger',
},
'/var/lib/steam_chat_logger': {
'owner': 'steam_chat_logger',
'mode': '0770',
'needs': [
'zfs_dataset:tank/steam-chat-logger'
],
},
}
git_deploy = {
'/opt/steam_chat_logger': {
'repo': 'https://git.sublimity.de/cronekorkn/steam_chat_logger.git',
'rev': 'master',
}
}
pkg_pip = {
'steam': {},
'beautifulsoup4': {},
'pytz': {},
'pg8000': {},
}
# TODO
'''
CREATE TABLE IF NOT EXISTS messages (
id SERIAL PRIMARY KEY,
checksum VARCHAR(64) UNIQUE NOT NULL,
from_url VARCHAR(255) NOT NULL,
from_name VARCHAR(255) NOT NULL,
to_url VARCHAR(255) NOT NULL,
to_name VARCHAR(255) NOT NULL,
date TIMESTAMP WITH TIME ZONE NOT NULL,
message TEXT NOT NULL
)
'''

View file

@ -0,0 +1,46 @@
defaults = {
'postgresql': {
'roles': {
'steam_chat_logger': {
'password': repo.vault.password_for(f'{node.name} postgresql steam_chat_logger'),
},
},
'databases': {
'steam_chat_logger': {
'owner': 'steam_chat_logger',
},
},
},
'users': {
'steam_chat_logger': {},
},
'zfs': {
'datasets': {
'tank/steam-chat-logger': {
'mountpoint': '/var/lib/steam_chat_logger',
},
},
},
}
@metadata_reactor.provides(
'systemd-timers/steam-chat-logger',
)
def systemd_timer(metadata):
return {
'systemd-timers': {
f'steam-chat-logger': {
'command': '/opt/steam_chat_logger/steam_chat_logger.py',
'when': 'daily',
'user': 'steam_chat_logger',
'env': {
'DB_NAME': 'steam_chat_logger',
'DB_USER': 'steam_chat_logger',
'DB_PASSWORD': metadata.get('postgresql/roles/steam_chat_logger/password'),
**metadata.get('steam_chat_logger'),
},
'working_dir': '/var/lib/steam_chat_logger',
},
},
}

View file

@ -34,6 +34,9 @@ def systemd(metadata):
},
},
})
if config.get('working_dir'):
units[f'{name}.service']['Service']['WorkingDirectory'] = config['working_dir']
services[f'{name}.timer'] = {}
return {

View file

@ -24,6 +24,7 @@
'postgresql',
'redis',
'smartctl',
'steam-chat-logger',
'raspberrymatic-cert',
'tasmota-charge',
'wireguard',
@ -94,6 +95,14 @@
'domain': 'homematic.ckn.li',
'node': 'home.homematic',
},
'steam_chat_logger': {
'STEAM_USERNAME': 'snake_452',
'STEAM_ID': 'STEAM_0:0:12376499',
'STEAM_PASSWORD': '!decrypt:encrypt$gAAAAABiUzERrXVNxzDaDW_4MgEmPtXkMHlTiz5uqCbu-22-2yKHRHMKvuGqAygpGbnwZucZcmZMox9KM89a6qlVKlE1ZPizTA==',
'IMAP_HOST': 'mail.sublimity.de',
'IMAP_USER': 'i@ckn.li',
'IMAP_PASSWORD': '!decrypt:encrypt$gAAAAABiUzcTVRL-Xb4RDjcwciZawYlmOa9Qy_hKz6sVWDlwZqUFLGRD8ERWoFCOWCM22Sq73Gc4nFuAblBB6wpbH5YEltLA6hmROGKpOFhI63ESLFwNgbY=',
},
'tasmota-charge': {
'phone': {
'ip': '10.0.0.166',