blog_dirty #8
22 changed files with 99 additions and 54 deletions
4
.envrc
4
.envrc
|
@ -10,8 +10,8 @@ python3 -m venv .venv
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
PATH_add .venv/bin
|
PATH_add .venv/bin
|
||||||
PATH_add bin
|
PATH_add bin
|
||||||
python3 -m pip install --upgrade pip wheel
|
python3 -m pip --require-virtualenv --quiet install --upgrade pip wheel
|
||||||
python3 -m pip install --upgrade -r requirements.txt
|
python3 -m pip --require-virtualenv --quiet install --upgrade -r requirements.txt
|
||||||
|
|
||||||
rm -rf .cache/bw/git_deploy
|
rm -rf .cache/bw/git_deploy
|
||||||
export BW_GIT_DEPLOY_CACHE=.cache/bw/git_deploy
|
export BW_GIT_DEPLOY_CACHE=.cache/bw/git_deploy
|
||||||
|
|
|
@ -68,7 +68,7 @@ for host, sources in hosts.items():
|
||||||
files[f'/etc/apt/sources.list.d/{host}.list'] = {
|
files[f'/etc/apt/sources.list.d/{host}.list'] = {
|
||||||
'content': '\n'.join(sorted(set(
|
'content': '\n'.join(sorted(set(
|
||||||
str(source).format(
|
str(source).format(
|
||||||
release=node.metadata.get('os_release'),
|
codename=node.metadata.get('os_codename'),
|
||||||
version=node.os_version[0], # WIP crystal
|
version=node.os_version[0], # WIP crystal
|
||||||
)
|
)
|
||||||
for source in sources
|
for source in sources
|
||||||
|
@ -95,7 +95,7 @@ for package, options in node.metadata.get('apt/packages', {}).items():
|
||||||
files[f'/etc/apt/preferences.d/{package}'] = {
|
files[f'/etc/apt/preferences.d/{package}'] = {
|
||||||
'content': '\n'.join([
|
'content': '\n'.join([
|
||||||
f"Package: {package}",
|
f"Package: {package}",
|
||||||
f"Pin: release a={node.metadata.get('os_release')}-backports",
|
f"Pin: release a={node.metadata.get('os_codename')}-backports",
|
||||||
f"Pin-Priority: 900",
|
f"Pin-Priority: 900",
|
||||||
]),
|
]),
|
||||||
'needed_by': [
|
'needed_by': [
|
||||||
|
|
|
@ -6,7 +6,7 @@ version = version=node.metadata.get('gitea/version')
|
||||||
|
|
||||||
downloads['/usr/local/bin/gitea'] = {
|
downloads['/usr/local/bin/gitea'] = {
|
||||||
'url': f'https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-amd64',
|
'url': f'https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-amd64',
|
||||||
'sha256': node.metadata.get('gitea/sha256'),
|
'sha256_url': '{url}.sha256',
|
||||||
'triggers': {
|
'triggers': {
|
||||||
'svc_systemd:gitea:restart',
|
'svc_systemd:gitea:restart',
|
||||||
},
|
},
|
||||||
|
|
|
@ -30,8 +30,7 @@ defaults = {
|
||||||
'gitea.service': {
|
'gitea.service': {
|
||||||
'Unit': {
|
'Unit': {
|
||||||
'Description': 'gitea',
|
'Description': 'gitea',
|
||||||
'After': 'syslog.target',
|
'After': {'syslog.target', 'network.target'},
|
||||||
'After': 'network.target',
|
|
||||||
'Requires': 'postgresql.service',
|
'Requires': 'postgresql.service',
|
||||||
},
|
},
|
||||||
'Service': {
|
'Service': {
|
||||||
|
|
|
@ -9,7 +9,7 @@ defaults = {
|
||||||
'monitoring-plugins': {},
|
'monitoring-plugins': {},
|
||||||
},
|
},
|
||||||
'sources': {
|
'sources': {
|
||||||
'deb https://packages.icinga.com/debian icinga-{release} main',
|
'deb https://packages.icinga.com/debian icinga-{codename} main',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'icinga2': {
|
'icinga2': {
|
||||||
|
|
|
@ -4,18 +4,27 @@ directories = {
|
||||||
'owner': 'www-data',
|
'owner': 'www-data',
|
||||||
'group': 'icingaweb2',
|
'group': 'icingaweb2',
|
||||||
'mode': '2770',
|
'mode': '2770',
|
||||||
|
'needs': [
|
||||||
|
'pkg_apt:icingaweb2',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
'/etc/icingaweb2/enabledModules': {
|
'/etc/icingaweb2/enabledModules': {
|
||||||
# 'purge': True,
|
# 'purge': True,
|
||||||
'owner': 'www-data',
|
'owner': 'www-data',
|
||||||
'group': 'icingaweb2',
|
'group': 'icingaweb2',
|
||||||
'mode': '2770',
|
'mode': '2770',
|
||||||
|
'needs': [
|
||||||
|
'pkg_apt:icingaweb2',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
'/etc/icingaweb2/modules': {
|
'/etc/icingaweb2/modules': {
|
||||||
# 'purge': True,
|
# 'purge': True,
|
||||||
'owner': 'www-data',
|
'owner': 'www-data',
|
||||||
'group': 'icingaweb2',
|
'group': 'icingaweb2',
|
||||||
'mode': '2770',
|
'mode': '2770',
|
||||||
|
'needs': [
|
||||||
|
'pkg_apt:icingaweb2',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +34,9 @@ files = {
|
||||||
'owner': 'www-data',
|
'owner': 'www-data',
|
||||||
'group': 'icingaweb2',
|
'group': 'icingaweb2',
|
||||||
'mode': '0660',
|
'mode': '0660',
|
||||||
|
'needs': [
|
||||||
|
'pkg_apt:icingaweb2',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +45,9 @@ symlinks = {
|
||||||
'target': '/usr/share/icingaweb2/modules/monitoring',
|
'target': '/usr/share/icingaweb2/modules/monitoring',
|
||||||
'owner': 'www-data',
|
'owner': 'www-data',
|
||||||
'group': 'icingaweb2',
|
'group': 'icingaweb2',
|
||||||
|
'needs': [
|
||||||
|
'pkg_apt:icingaweb2',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +63,9 @@ for name in [
|
||||||
'owner': 'www-data',
|
'owner': 'www-data',
|
||||||
'group': 'icingaweb2',
|
'group': 'icingaweb2',
|
||||||
'mode': '0660',
|
'mode': '0660',
|
||||||
|
'needs': [
|
||||||
|
'pkg_apt:icingaweb2',
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
for name in [
|
for name in [
|
||||||
|
@ -60,4 +78,7 @@ for name in [
|
||||||
'owner': 'www-data',
|
'owner': 'www-data',
|
||||||
'group': 'icingaweb2',
|
'group': 'icingaweb2',
|
||||||
'mode': '0660',
|
'mode': '0660',
|
||||||
|
'needs': [
|
||||||
|
'pkg_apt:icingaweb2',
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ defaults = {
|
||||||
'icingaweb2-module-monitoring': {},
|
'icingaweb2-module-monitoring': {},
|
||||||
},
|
},
|
||||||
'sources': {
|
'sources': {
|
||||||
'deb https://packages.icinga.com/debian icinga-{release} main',
|
'deb https://packages.icinga.com/debian icinga-{codename} main',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'icingaweb2': {
|
'icingaweb2': {
|
||||||
|
|
|
@ -7,7 +7,7 @@ defaults = {
|
||||||
'influxdb2-cli': {},
|
'influxdb2-cli': {},
|
||||||
},
|
},
|
||||||
'sources': {
|
'sources': {
|
||||||
'deb https://repos.influxdata.com/debian {release} stable',
|
'deb https://repos.influxdata.com/debian {codename} stable',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'nftables': {
|
'nftables': {
|
||||||
|
|
|
@ -4,7 +4,7 @@ set -o pipefail
|
||||||
|
|
||||||
deploy_challenge() {
|
deploy_challenge() {
|
||||||
echo "
|
echo "
|
||||||
server 10.0.11.3
|
server ${server}
|
||||||
zone ${zone}.
|
zone ${zone}.
|
||||||
update add $1.${zone}. 60 IN TXT \"$3\"
|
update add $1.${zone}. 60 IN TXT \"$3\"
|
||||||
send
|
send
|
||||||
|
@ -13,7 +13,7 @@ deploy_challenge() {
|
||||||
|
|
||||||
clean_challenge() {
|
clean_challenge() {
|
||||||
echo "
|
echo "
|
||||||
server 10.0.11.3
|
server ${server}
|
||||||
zone ${zone}.
|
zone ${zone}.
|
||||||
update delete $1.${zone}. TXT
|
update delete $1.${zone}. TXT
|
||||||
send
|
send
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from shlex import quote
|
from shlex import quote
|
||||||
from ipaddress import ip_interface
|
|
||||||
|
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
|
|
|
@ -23,8 +23,8 @@ def sources(metadata):
|
||||||
return {
|
return {
|
||||||
'apt': {
|
'apt': {
|
||||||
'sources': {
|
'sources': {
|
||||||
f'deb https://deb.nodesource.com/node_{version}.x {{release}} main',
|
f'deb https://deb.nodesource.com/node_{version}.x {{codename}} main',
|
||||||
f'deb-src https://deb.nodesource.com/node_{version}.x {{release}} main',
|
f'deb-src https://deb.nodesource.com/node_{version}.x {{codename}} main',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,16 +15,14 @@ defaults = {
|
||||||
def units(metadata):
|
def units(metadata):
|
||||||
units = {}
|
units = {}
|
||||||
services = {}
|
services = {}
|
||||||
|
|
||||||
for mountpoint, conf in metadata.get('systemd-mount').items():
|
for mountpoint, conf in metadata.get('systemd-mount').items():
|
||||||
formatted_name = mountpoint[1:].replace('-', '\\x2d').replace('/', '-') + '.mount'
|
formatted_name = mountpoint[1:].replace('-', '\\x2d').replace('/', '-') + '.mount'
|
||||||
|
|
||||||
units[formatted_name] = {
|
units[formatted_name] = {
|
||||||
'Unit': {
|
'Unit': {
|
||||||
'Description': f"Mount {conf['source']} -> {mountpoint}",
|
'Description': f"Mount {conf['source']} -> {mountpoint}",
|
||||||
'DefaultDependencies': 'no',
|
'DefaultDependencies': 'no',
|
||||||
'Conflicts': 'umount.target',
|
|
||||||
'Before': 'umount.target',
|
|
||||||
},
|
},
|
||||||
'Mount': {
|
'Mount': {
|
||||||
'What': conf['source'],
|
'What': conf['source'],
|
||||||
|
@ -32,16 +30,11 @@ def units(metadata):
|
||||||
'Type': 'fuse.bindfs',
|
'Type': 'fuse.bindfs',
|
||||||
'Options': f"nonempty",
|
'Options': f"nonempty",
|
||||||
},
|
},
|
||||||
'Install': {
|
|
||||||
'WantedBy': {
|
|
||||||
'local-fs.target',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if conf.get('user'):
|
if conf.get('user'):
|
||||||
units[formatted_name]['Mount']['Options'] += f",force-user={conf.get('user')}"
|
units[formatted_name]['Mount']['Options'] += f",force-user={conf.get('user')}"
|
||||||
|
|
||||||
services[formatted_name] = {}
|
services[formatted_name] = {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
size_mb = node.metadata.get('systemd-swap')//1_000_000
|
size = node.metadata.get('systemd-swap')
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
'stop_swap': {
|
'stop_swap': {
|
||||||
|
@ -15,8 +15,8 @@ actions = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'create_swapfile': {
|
'create_swapfile': {
|
||||||
'command': f'dd if=/dev/zero of=/swapfile bs=1000000 count={size_mb}',
|
'command': f'fallocate -l {size} /swapfile',
|
||||||
'unless': f'stat -c %s /swapfile | grep ^{size_mb*1_000_000}$',
|
'unless': f'stat -c %s /swapfile | grep ^{size}$',
|
||||||
'preceded_by': {
|
'preceded_by': {
|
||||||
'action:stop_swap',
|
'action:stop_swap',
|
||||||
'action:remove_swapfile',
|
'action:remove_swapfile',
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
## show unit paths
|
## show unit paths
|
||||||
|
|
||||||
```
|
```
|
||||||
systemctl --no-pager --property=UnitPath show | tr ' ' '\n'
|
systemctl --no-pager --property=UnitPath show --value | tr ' ' '\n'
|
||||||
```
|
```
|
||||||
|
|
||||||
## metadata
|
## metadata
|
||||||
|
|
|
@ -25,19 +25,14 @@ def units(metadata):
|
||||||
|
|
||||||
type = name.split('.')[-1]
|
type = name.split('.')[-1]
|
||||||
|
|
||||||
if not config.get('Install/WantedBy'):
|
if type == 'service':
|
||||||
if type == 'service':
|
units.setdefault(name, {}).setdefault('Install', {}).setdefault('WantedBy', {'multi-user.target'})
|
||||||
units[name] = {
|
elif type == 'timer':
|
||||||
'Install': {
|
units.setdefault(name, {}).setdefault('Install', {}).setdefault('WantedBy', {'timers.target'})
|
||||||
'WantedBy': {'multi-user.target'},
|
elif type == 'mount':
|
||||||
}
|
units.setdefault(name, {}).setdefault('Install', {}).setdefault('WantedBy', {'local-fs.target'})
|
||||||
}
|
units.setdefault(name, {}).setdefault('Unit', {}).setdefault('Conflicts', {'umount.target'})
|
||||||
elif type == 'timer':
|
units.setdefault(name, {}).setdefault('Unit', {}).setdefault('Before', {'umount.target'})
|
||||||
units[name] = {
|
|
||||||
'Install': {
|
|
||||||
'WantedBy': {'timers.target'},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'systemd': {
|
'systemd': {
|
||||||
|
|
|
@ -95,11 +95,11 @@ defaults = {
|
||||||
'apt/sources',
|
'apt/sources',
|
||||||
)
|
)
|
||||||
def apt(metadata):
|
def apt(metadata):
|
||||||
release = {
|
codename = {
|
||||||
'buster': 'buster',
|
'buster': 'buster',
|
||||||
'bullseye': 'bullseye',
|
'bullseye': 'bullseye',
|
||||||
'bookworm': 'bullseye',
|
'bookworm': 'bullseye',
|
||||||
}[metadata.get('os_release')]
|
}[metadata.get('os_codename')]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'apt': {
|
'apt': {
|
||||||
|
@ -107,7 +107,7 @@ def apt(metadata):
|
||||||
'telegraf': {},
|
'telegraf': {},
|
||||||
},
|
},
|
||||||
'sources': {
|
'sources': {
|
||||||
f"deb https://repos.influxdata.com/debian {release} stable",
|
f"deb https://repos.influxdata.com/debian {codename} stable",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
7
bundles/twitch-clip-download/items.py
Normal file
7
bundles/twitch-clip-download/items.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
directories = {
|
||||||
|
'/var/lib/twitch-clips': {},
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_pip = {
|
||||||
|
'twitch-dl': {},
|
||||||
|
}
|
28
bundles/twitch-clip-download/metadata.py
Normal file
28
bundles/twitch-clip-download/metadata.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
defaults = {
|
||||||
|
'backup': {
|
||||||
|
'paths': {
|
||||||
|
'/var/lib/twitch-clips',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'systemd-timers': {
|
||||||
|
f'twitch-clip-download': {
|
||||||
|
'command': '/usr/local/bin/twitch-dl clips cronekorkn_ --download --all',
|
||||||
|
'when': 'daily',
|
||||||
|
'persistent': True,
|
||||||
|
'working_dir': '/var/lib/twitch-clips',
|
||||||
|
'after': {
|
||||||
|
'network-online.target',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'zfs': {
|
||||||
|
'datasets': {
|
||||||
|
'tank/twitch-clips': {
|
||||||
|
'mountpoint': '/var/lib/twitch-clips',
|
||||||
|
'needed_by': {
|
||||||
|
'svc_systemd:twitch-clip-download.timer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -9,7 +9,7 @@
|
||||||
'postgresql': {
|
'postgresql': {
|
||||||
'version': '13',
|
'version': '13',
|
||||||
},
|
},
|
||||||
'os_release': 'bullseye',
|
'os_codename': 'bullseye',
|
||||||
},
|
},
|
||||||
'os_version': (11,),
|
'os_version': (11,),
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
'postgresql': {
|
'postgresql': {
|
||||||
'version': '14',
|
'version': '14',
|
||||||
},
|
},
|
||||||
'os_release': 'bookworm',
|
'os_codename': 'bookworm',
|
||||||
},
|
},
|
||||||
'os_version': (12,),
|
'os_version': (12,),
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
'metadata': {
|
'metadata': {
|
||||||
'apt': {
|
'apt': {
|
||||||
'sources': {
|
'sources': {
|
||||||
'deb https://deb.debian.org/debian {release} main contrib non-free',
|
'deb https://deb.debian.org/debian {codename} main contrib non-free',
|
||||||
'deb https://deb.debian.org/debian {release}-updates main contrib non-free',
|
'deb https://deb.debian.org/debian {codename}-updates main contrib non-free',
|
||||||
'deb https://deb.debian.org/debian {release}-backports main contrib non-free',
|
'deb https://deb.debian.org/debian {codename}-backports main contrib non-free',
|
||||||
'deb https://security.debian.org/ {release}-security main contrib non-free',
|
'deb https://security.debian.org/ {codename}-security main contrib non-free',
|
||||||
},
|
},
|
||||||
'packages': {
|
'packages': {
|
||||||
'mtr-tiny': {},
|
'mtr-tiny': {},
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
'steam-chat-logger',
|
'steam-chat-logger',
|
||||||
'steam-chat-viewer',
|
'steam-chat-viewer',
|
||||||
'systemd-swap',
|
'systemd-swap',
|
||||||
|
'twitch-clip-download',
|
||||||
'raspberrymatic-cert',
|
'raspberrymatic-cert',
|
||||||
'tasmota-charge',
|
'tasmota-charge',
|
||||||
'wireguard',
|
'wireguard',
|
||||||
|
@ -60,8 +61,7 @@
|
||||||
'download_server': 'netcup.mails',
|
'download_server': 'netcup.mails',
|
||||||
},
|
},
|
||||||
'gitea': {
|
'gitea': {
|
||||||
'version': '1.17.1',
|
'version': '1.19.1',
|
||||||
'sha256': 'eafd476ee2a303d758448314272add00898d045439ab0d353ff4286c5e63496f',
|
|
||||||
'domain': 'git.sublimity.de',
|
'domain': 'git.sublimity.de',
|
||||||
'conf': {
|
'conf': {
|
||||||
'mailer': {
|
'mailer': {
|
||||||
|
@ -153,6 +153,9 @@
|
||||||
'max': 70,
|
'max': 70,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'twitch-clip-download': {
|
||||||
|
'channel_name': 'cronekorkn_',
|
||||||
|
},
|
||||||
'vm': {
|
'vm': {
|
||||||
'cores': 16,
|
'cores': 16,
|
||||||
'threads': 32,
|
'threads': 32,
|
||||||
|
|
Loading…
Reference in a new issue