2023-09-09 15:48:22 +00:00
|
|
|
assert node.has_bundle('redis'), f'{node.name}: pretalx needs redis'
|
2024-11-16 12:35:24 +00:00
|
|
|
assert node.has_bundle('nodejs'), f'{node.name}: pretalx needs nodejs for rebuild step'
|
2023-09-09 15:48:22 +00:00
|
|
|
|
2021-01-16 21:03:38 +00:00
|
|
|
actions = {
|
|
|
|
'pretalx_create_virtualenv': {
|
|
|
|
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/pretalx/venv/',
|
|
|
|
'unless': 'test -d /opt/pretalx/venv/',
|
|
|
|
'needs': {
|
|
|
|
# actually /opt/pretalx, but we don't create that
|
|
|
|
'directory:/opt/pretalx/src',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'pretalx_install': {
|
2023-09-09 15:48:22 +00:00
|
|
|
'command': ' && '.join([
|
|
|
|
'cd /opt/pretalx/src',
|
|
|
|
'/opt/pretalx/venv/bin/pip install --upgrade pip wheel gunicorn psycopg2-binary',
|
2021-07-02 16:35:51 +00:00
|
|
|
'/opt/pretalx/venv/bin/pip install --upgrade -e .[redis]',
|
2023-09-09 15:48:22 +00:00
|
|
|
]),
|
2021-01-16 21:03:38 +00:00
|
|
|
'needs': {
|
|
|
|
'action:pretalx_create_virtualenv',
|
2023-09-09 15:48:22 +00:00
|
|
|
'pkg_apt:gcc',
|
|
|
|
'pkg_apt:python3-dev',
|
2021-01-16 21:03:38 +00:00
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
'pretalx_migrate': {
|
2023-09-09 15:48:22 +00:00
|
|
|
'command': '/usr/bin/sudo -Hu pretalx PRETALX_CONFIG_FILE=/opt/pretalx/pretalx.cfg /opt/pretalx/venv/bin/python -m pretalx migrate',
|
2021-01-16 21:03:38 +00:00
|
|
|
'needs': {
|
|
|
|
'action:pretalx_install',
|
|
|
|
'file:/opt/pretalx/pretalx.cfg',
|
|
|
|
'postgres_db:pretalx',
|
|
|
|
'postgres_role:pretalx',
|
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
'pretalx_rebuild': {
|
2023-09-09 15:48:22 +00:00
|
|
|
'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',
|
|
|
|
]),
|
2021-01-16 21:03:38 +00:00
|
|
|
'needs': {
|
|
|
|
'action:pretalx_install',
|
2021-12-25 09:00:26 +00:00
|
|
|
'action:pretalx_migrate',
|
2021-01-16 21:03:38 +00:00
|
|
|
'directory:/opt/pretalx/data',
|
|
|
|
'directory:/opt/pretalx/static',
|
|
|
|
'file:/opt/pretalx/pretalx.cfg',
|
2023-09-09 15:48:22 +00:00
|
|
|
'bundle:nodejs',
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
# pretalx-web reads the manifest.json generated by this build-step upon startup
|
|
|
|
'svc_systemd:pretalx-web:restart',
|
2021-01-16 21:03:38 +00:00
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
users = {
|
|
|
|
'pretalx': {
|
|
|
|
'home': '/opt/pretalx',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
directories = {
|
|
|
|
'/opt/pretalx/src': {},
|
|
|
|
'/opt/pretalx/data': {
|
|
|
|
'owner': 'pretalx',
|
|
|
|
},
|
|
|
|
'/opt/pretalx/static': {
|
|
|
|
'owner': 'pretalx',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
git_deploy = {
|
|
|
|
'/opt/pretalx/src': {
|
|
|
|
'repo': 'https://github.com/pretalx/pretalx.git',
|
2023-09-09 15:48:22 +00:00
|
|
|
'rev': node.metadata.get('pretalx/version'),
|
2021-01-16 21:03:38 +00:00
|
|
|
'triggers': {
|
|
|
|
'action:pretalx_install',
|
|
|
|
'action:pretalx_migrate',
|
|
|
|
'action:pretalx_rebuild',
|
|
|
|
'svc_systemd:pretalx-web:restart',
|
|
|
|
'svc_systemd:pretalx-worker:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'pretalx-runperiodic.timer': {
|
|
|
|
'needs': {
|
|
|
|
'action:pretalx_install',
|
|
|
|
'action:pretalx_migrate',
|
|
|
|
'file:/etc/systemd/system/pretalx-runperiodic.timer',
|
|
|
|
'file:/etc/systemd/system/pretalx-runperiodic.service',
|
|
|
|
'file:/opt/pretalx/pretalx.cfg',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'pretalx-clearsessions.timer': {
|
|
|
|
'needs': {
|
|
|
|
'action:pretalx_install',
|
|
|
|
'action:pretalx_migrate',
|
|
|
|
'file:/etc/systemd/system/pretalx-clearsessions.timer',
|
|
|
|
'file:/etc/systemd/system/pretalx-clearsessions.service',
|
|
|
|
'file:/opt/pretalx/pretalx.cfg',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'pretalx-web': {
|
|
|
|
'needs': {
|
|
|
|
'action:pretalx_install',
|
|
|
|
'action:pretalx_migrate',
|
|
|
|
'action:pretalx_rebuild',
|
|
|
|
'file:/etc/systemd/system/pretalx-web.service',
|
|
|
|
'file:/opt/pretalx/pretalx.cfg',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'pretalx-worker': {
|
|
|
|
'needs': {
|
|
|
|
'action:pretalx_install',
|
2024-11-16 12:35:24 +00:00
|
|
|
'action:pretalx_migrate',,
|
|
|
|
'action:pretalx_rebuild',
|
2021-01-16 21:03:38 +00:00
|
|
|
'file:/etc/systemd/system/pretalx-worker.service',
|
|
|
|
'file:/opt/pretalx/pretalx.cfg',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
|
|
|
'/opt/pretalx/pretalx.cfg': {
|
|
|
|
'content_type': 'mako',
|
2023-09-09 15:48:22 +00:00
|
|
|
'context': node.metadata.get('pretalx'),
|
2021-01-16 21:03:38 +00:00
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:pretalx-web:restart',
|
|
|
|
'svc_systemd:pretalx-worker:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/pretalx-runperiodic.timer': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:pretalx-runperiodic.timer:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/pretalx-runperiodic.service': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/pretalx-clearsessions.timer': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:pretalx-clearsessions.timer:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/pretalx-clearsessions.service': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/pretalx-web.service': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:pretalx-web:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/pretalx-worker.service': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:pretalx-worker:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2021-03-30 17:52:03 +00:00
|
|
|
|
|
|
|
# run `pip install` one after another due to concurrency issues
|
|
|
|
last_action = 'action:pretalx_install'
|
|
|
|
for plugin_name, plugin_config in node.metadata.get('pretalx/plugins', {}).items():
|
2023-09-09 15:48:22 +00:00
|
|
|
assert '-' not in plugin_name, f'{node.name} pretalx plugin {plugin_name} must not contain dashes'
|
|
|
|
|
2021-03-30 17:52:03 +00:00
|
|
|
directories[f'/opt/pretalx/plugin_{plugin_name}'] = {}
|
|
|
|
|
|
|
|
git_deploy[f'/opt/pretalx/plugin_{plugin_name}'] = {
|
|
|
|
'repo': plugin_config['repo'],
|
2023-09-09 15:48:22 +00:00
|
|
|
'rev': plugin_config.get('rev', 'master'),
|
2021-03-30 17:52:03 +00:00
|
|
|
'triggers': {
|
|
|
|
f'action:pretalx_install_plugin_{plugin_name}',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
actions[f'pretalx_install_plugin_{plugin_name}'] = {
|
2021-07-02 16:35:51 +00:00
|
|
|
'command': f'cd /opt/pretalx/plugin_{plugin_name} && /opt/pretalx/venv/bin/pip install --upgrade -e .',
|
2021-03-30 17:52:03 +00:00
|
|
|
'needs': {
|
|
|
|
last_action,
|
|
|
|
},
|
|
|
|
'triggers': {
|
2021-11-21 08:42:02 +00:00
|
|
|
'action:pretalx_migrate',
|
|
|
|
'action:pretalx_rebuild',
|
2021-03-30 17:52:03 +00:00
|
|
|
'svc_systemd:pretalx-web:restart',
|
|
|
|
'svc_systemd:pretalx-worker:restart',
|
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
}
|
|
|
|
last_action = f'action:pretalx_install_plugin_{plugin_name}'
|