update pretalx to 2023.1.0

This commit is contained in:
Franzi 2023-09-09 17:48:22 +02:00
parent 25a484f04e
commit d9cb324bb6
Signed by: kunsi
GPG key ID: 12E3D2136B818350
10 changed files with 93 additions and 30 deletions

View file

@ -1,5 +1,22 @@
from bundlewrap.exceptions import BundleError from bundlewrap.exceptions import BundleError
supported_os = {
'debian': {
10: 'buster',
11: 'bullseye',
12: 'bookworm',
99: 'unstable',
},
'raspbian': {
10: 'buster',
},
}
try:
supported_os[node.os][node.os_version[0]]
except (KeyError, IndexError):
raise BundleError(f'{node.name}: OS {node.os} {node.os_version} is not supported by bundle:apt')
CONFLICTING_BUNDLES = { CONFLICTING_BUNDLES = {
'apt', 'apt',
'nginx', 'nginx',
@ -57,6 +74,14 @@ actions = {
'svc_systemd:', 'svc_systemd:',
}, },
}, },
'apt_update': {
'command': 'apt-get update',
'needed_by': {
'pkg_apt:',
},
'triggered': True,
'cascade_skip': False,
},
} }
directories = { directories = {
@ -92,6 +117,30 @@ files = {
}, },
} }
for name, data in node.metadata.get('apt/repos', {}).items():
files['/etc/apt/sources.list.d/{}.list'.format(name)] = {
'content_type': 'mako',
'content': ("\n".join(sorted(data['items']))).format(
os=node.os,
os_release=supported_os[node.os][node.os_version[0]],
),
'triggers': {
'action:apt_update',
},
}
if data.get('install_gpg_key', True):
files['/etc/apt/sources.list.d/{}.list'.format(name)]['needs'] = {
'file:/etc/apt/trusted.gpg.d/{}.list.asc'.format(name),
}
files['/etc/apt/trusted.gpg.d/{}.list.asc'.format(name)] = {
'source': 'gpg-keys/{}.asc'.format(name),
'triggers': {
'action:apt_update',
},
}
for crontab, content in node.metadata.get('cron/jobs', {}).items(): for crontab, content in node.metadata.get('cron/jobs', {}).items():
files['/etc/cron.d/{}'.format(crontab)] = { files['/etc/cron.d/{}'.format(crontab)] = {
'source': 'cron_template', 'source': 'cron_template',

View file

@ -1,3 +1,6 @@
assert node.has_bundle('redis'), f'{node.name}: pretalx needs redis'
assert node.has_bundle('nodejs'), f'{node.name}: pretalx needs nodejs for rebuild and regenerate_css step'
actions = { actions = {
'pretalx_create_virtualenv': { 'pretalx_create_virtualenv': {
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/pretalx/venv/', 'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/pretalx/venv/',
@ -8,17 +11,20 @@ actions = {
}, },
}, },
'pretalx_install': { 'pretalx_install': {
'command': 'command': ' && '.join([
'cd /opt/pretalx/src/src && ' 'cd /opt/pretalx/src',
'/opt/pretalx/venv/bin/pip install --upgrade pip wheel gunicorn psycopg2-binary && ' '/opt/pretalx/venv/bin/pip install --upgrade pip wheel gunicorn psycopg2-binary',
'/opt/pretalx/venv/bin/pip install --upgrade -e .[redis]', '/opt/pretalx/venv/bin/pip install --upgrade -e .[redis]',
]),
'needs': { 'needs': {
'action:pretalx_create_virtualenv', 'action:pretalx_create_virtualenv',
'pkg_apt:gcc',
'pkg_apt:python3-dev',
}, },
'triggered': True, 'triggered': True,
}, },
'pretalx_migrate': { 'pretalx_migrate': {
'command': 'PRETALX_CONFIG_FILE=/opt/pretalx/pretalx.cfg /opt/pretalx/venv/bin/python -m pretalx migrate', 'command': '/usr/bin/sudo -Hu pretalx PRETALX_CONFIG_FILE=/opt/pretalx/pretalx.cfg /opt/pretalx/venv/bin/python -m pretalx migrate',
'needs': { 'needs': {
'action:pretalx_install', 'action:pretalx_install',
'file:/opt/pretalx/pretalx.cfg', 'file:/opt/pretalx/pretalx.cfg',
@ -28,24 +34,33 @@ actions = {
'triggered': True, 'triggered': True,
}, },
'pretalx_rebuild': { 'pretalx_rebuild': {
'command': 'PRETALX_CONFIG_FILE=/opt/pretalx/pretalx.cfg /opt/pretalx/venv/bin/python -m pretalx rebuild', 'command': ' && '.join([
'cd /opt/pretalx/src/src/pretalx/frontend/schedule-editor/',
'npm install',
'PRETALX_CONFIG_FILE=/opt/pretalx/pretalx.cfg /opt/pretalx/venv/bin/python -m pretalx rebuild',
]),
'needs': { 'needs': {
'action:pretalx_install', 'action:pretalx_install',
'action:pretalx_migrate', 'action:pretalx_migrate',
'directory:/opt/pretalx/data', 'directory:/opt/pretalx/data',
'directory:/opt/pretalx/static', 'directory:/opt/pretalx/static',
'file:/opt/pretalx/pretalx.cfg', 'file:/opt/pretalx/pretalx.cfg',
'bundle:nodejs',
},
'triggers': {
# pretalx-web reads the manifest.json generated by this build-step upon startup
'svc_systemd:pretalx-web:restart',
}, },
'triggered': True, 'triggered': True,
}, },
'pretalx_regenerate-css': { 'pretalx_regenerate-css': {
'command': 'sudo -u pretalx PRETALX_CONFIG_FILE=/opt/pretalx/pretalx.cfg /opt/pretalx/venv/bin/python -m pretalx regenerate_css', 'command': 'sudo -u pretalx PRETALX_CONFIG_FILE=/opt/pretalx/pretalx.cfg /opt/pretalx/venv/bin/python -m pretalx regenerate_css',
'needs': { 'needs': {
'action:pretalx_install',
'action:pretalx_migrate', 'action:pretalx_migrate',
'directory:/opt/pretalx/data', 'directory:/opt/pretalx/data',
'directory:/opt/pretalx/static', 'directory:/opt/pretalx/static',
'file:/opt/pretalx/pretalx.cfg', 'file:/opt/pretalx/pretalx.cfg',
'bundle:nodejs',
}, },
'triggered': True, 'triggered': True,
}, },
@ -70,7 +85,7 @@ directories = {
git_deploy = { git_deploy = {
'/opt/pretalx/src': { '/opt/pretalx/src': {
'repo': 'https://github.com/pretalx/pretalx.git', 'repo': 'https://github.com/pretalx/pretalx.git',
'rev': node.metadata['pretalx']['version'], 'rev': node.metadata.get('pretalx/version'),
'triggers': { 'triggers': {
'action:pretalx_install', 'action:pretalx_install',
'action:pretalx_migrate', 'action:pretalx_migrate',
@ -82,7 +97,6 @@ git_deploy = {
}, },
} }
svc_systemd = { svc_systemd = {
'pretalx-runperiodic.timer': { 'pretalx-runperiodic.timer': {
'needs': { 'needs': {
@ -125,15 +139,12 @@ svc_systemd = {
files = { files = {
'/opt/pretalx/pretalx.cfg': { '/opt/pretalx/pretalx.cfg': {
'content_type': 'mako', 'content_type': 'mako',
'context': node.metadata['pretalx'], 'context': node.metadata.get('pretalx'),
'triggers': { 'triggers': {
'svc_systemd:pretalx-web:restart', 'svc_systemd:pretalx-web:restart',
'svc_systemd:pretalx-worker:restart', 'svc_systemd:pretalx-worker:restart',
}, },
}, },
'/opt/pretalx/pretalx-administrators-from-group': {
'mode': '0755',
},
'/etc/systemd/system/pretalx-runperiodic.timer': { '/etc/systemd/system/pretalx-runperiodic.timer': {
'triggers': { 'triggers': {
'action:systemd-reload', 'action:systemd-reload',
@ -170,24 +181,16 @@ files = {
}, },
} }
if node.metadata.get('pretalx/administrators-from-group-id', None):
files['/etc/cron.d/pretalx-administrators-from-group'] = {
'source': 'cron-pretalx-administrators-from-group',
'content_type': 'mako',
}
else:
files['/etc/cron.d/pretalx-administrators-from-group'] = {
'delete': True,
}
# run `pip install` one after another due to concurrency issues # run `pip install` one after another due to concurrency issues
last_action = 'action:pretalx_install' last_action = 'action:pretalx_install'
for plugin_name, plugin_config in node.metadata.get('pretalx/plugins', {}).items(): for plugin_name, plugin_config in node.metadata.get('pretalx/plugins', {}).items():
assert '-' not in plugin_name, f'{node.name} pretalx plugin {plugin_name} must not contain dashes'
directories[f'/opt/pretalx/plugin_{plugin_name}'] = {} directories[f'/opt/pretalx/plugin_{plugin_name}'] = {}
git_deploy[f'/opt/pretalx/plugin_{plugin_name}'] = { git_deploy[f'/opt/pretalx/plugin_{plugin_name}'] = {
'repo': plugin_config['repo'], 'repo': plugin_config['repo'],
'rev': plugin_config['rev'], 'rev': plugin_config.get('rev', 'master'),
'triggers': { 'triggers': {
f'action:pretalx_install_plugin_{plugin_name}', f'action:pretalx_install_plugin_{plugin_name}',
}, },

View file

@ -1,17 +1,19 @@
defaults = { defaults = {
'apt': { 'apt': {
'packages': { 'packages': {
'gcc': {}, # for compiling some python deps
'gettext': {}, 'gettext': {},
'python3-dev': {},
}, },
}, },
'bash_aliases': {
'pretalx': 'sudo /opt/pretalx/venv/bin/python -m pretalx',
},
'backups': { 'backups': {
'paths': { 'paths': {
'/opt/pretalx/data', '/opt/pretalx/data',
}, },
}, },
'bash_aliases': {
'pretalx': 'sudo /opt/pretalx/venv/bin/python -m pretalx',
},
'icinga2_api': { 'icinga2_api': {
'pretalx': { 'pretalx': {
'services': { 'services': {

View file

@ -1 +0,0 @@
../nginx/files

View file

@ -0,0 +1 @@
../../nginx/files/error.html

View file

@ -0,0 +1 @@
../../nginx/files/extras

View file

@ -0,0 +1 @@
../../apt/files/gpg-keys

View file

@ -0,0 +1 @@
../../nginx/files/not_found.html

1
data/c3voc-addons/files/ssl Symbolic link
View file

@ -0,0 +1 @@
../../ssl

View file

@ -8,6 +8,7 @@ nodes['voc.pretalx'] = {
'backup-client', 'backup-client',
'check-mail-received', 'check-mail-received',
'c3voc-addons', 'c3voc-addons',
'nodejs',
'pretalx', 'pretalx',
'postfix', 'postfix',
'postgresql', 'postgresql',
@ -48,17 +49,21 @@ nodes['voc.pretalx'] = {
}, },
}, },
'pretalx': { 'pretalx': {
'version': '60722c43cf975f319e94102e6bff320723776890', 'version': 'v2023.1.0',
'domain': 'pretalx.c3voc.de', 'domain': 'pretalx.c3voc.de',
'mail_from': 'pretalx@c3voc.de', 'mail_from': 'pretalx@c3voc.de',
'administrators-from-group-id': 1, 'administrators-from-group-id': 1,
'plugins': { 'plugins': {
'broadcast_tools': {
'repo': 'https://github.com/Kunsi/pretalx-plugin-broadcast-tools.git',
'rev': '2.0.1',
},
'downstream': { 'downstream': {
'repo': 'https://github.com/pretalx/pretalx-downstream.git', 'repo': 'https://github.com/pretalx/pretalx-downstream.git',
'rev': 'v1.1.5', 'rev': 'v1.1.5',
}, },
'broadcast_tools': { 'halfnarp': {
'repo': 'https://github.com/Kunsi/pretalx-plugin-broadcast-tools.git', 'repo': 'https://github.com/seibert-media/pretalx-halfnarp.git',
'rev': '1.1.0', 'rev': '1.1.0',
}, },
'media.ccc.de': { 'media.ccc.de': {