2021-12-23 18:36:50 +00:00
|
|
|
actions = {
|
2021-12-24 14:28:36 +00:00
|
|
|
'infobeamer-cms_create_virtualenv': {
|
|
|
|
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/infobeamer-cms/venv/',
|
|
|
|
'unless': 'test -d /opt/infobeamer-cms/venv/',
|
|
|
|
'needs': {
|
|
|
|
# actually /opt/infobeamer-cms, but we don't create that
|
|
|
|
'directory:/opt/infobeamer-cms/src',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'infobeamer-cms_install_requirements': {
|
2023-12-29 07:16:58 +00:00
|
|
|
'command': ' && '.join([
|
|
|
|
'cd /opt/infobeamer-cms/src',
|
|
|
|
'/opt/infobeamer-cms/venv/bin/pip install --upgrade pip gunicorn -r requirements.txt',
|
|
|
|
'rsync /opt/infobeamer-cms/src/static/* /opt/infobeamer-cms/static/',
|
|
|
|
]),
|
2021-12-24 14:28:36 +00:00
|
|
|
'needs': {
|
|
|
|
'action:infobeamer-cms_create_virtualenv',
|
|
|
|
},
|
|
|
|
'triggered': True,
|
2021-12-23 18:36:50 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-12-23 12:48:44 +00:00
|
|
|
git_deploy = {
|
2021-12-24 14:28:36 +00:00
|
|
|
'/opt/infobeamer-cms/src': {
|
2021-12-23 18:36:50 +00:00
|
|
|
'rev': 'master',
|
2021-12-23 12:48:44 +00:00
|
|
|
'repo': 'https://github.com/sophieschi/36c3-cms.git',
|
|
|
|
'needs': {
|
2021-12-24 14:28:36 +00:00
|
|
|
'directory:/opt/infobeamer-cms/src',
|
2021-12-23 12:48:44 +00:00
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:infobeamer-cms:restart',
|
2021-12-24 14:28:36 +00:00
|
|
|
'action:infobeamer-cms_install_requirements',
|
2021-12-23 12:48:44 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
directories = {
|
2021-12-24 14:28:36 +00:00
|
|
|
'/opt/infobeamer-cms/src': {},
|
2023-12-29 07:16:58 +00:00
|
|
|
'/opt/infobeamer-cms/static': {
|
|
|
|
'owner': 'infobeamer-cms',
|
|
|
|
},
|
2021-12-23 12:48:44 +00:00
|
|
|
}
|
|
|
|
|
2021-12-24 14:28:36 +00:00
|
|
|
config = node.metadata.get('infobeamer-cms/config', {})
|
2022-03-20 11:35:00 +00:00
|
|
|
config.setdefault('EXTRA_ASSETS', [])
|
2021-12-24 14:28:36 +00:00
|
|
|
config['ROOMS'] = []
|
|
|
|
|
|
|
|
interrupts = []
|
|
|
|
for name, data in sorted(node.metadata.get('infobeamer-cms/interrupts', {}).items()):
|
|
|
|
interrupts.append({
|
|
|
|
'name': name,
|
|
|
|
'data': data,
|
|
|
|
})
|
|
|
|
|
|
|
|
if interrupts:
|
|
|
|
interrupts_dict = {
|
|
|
|
'interrupts': interrupts,
|
|
|
|
}
|
|
|
|
else:
|
|
|
|
interrupts_dict = {}
|
|
|
|
|
|
|
|
for room, device_id in sorted(node.metadata.get('infobeamer-cms/rooms', {}).items()):
|
|
|
|
config['ROOMS'].append({
|
|
|
|
'name': room,
|
|
|
|
'device_id': device_id,
|
|
|
|
**interrupts_dict,
|
|
|
|
})
|
|
|
|
|
2021-12-23 12:48:44 +00:00
|
|
|
files = {
|
2021-12-24 14:28:36 +00:00
|
|
|
'/opt/infobeamer-cms/settings.toml': {
|
2021-12-23 12:48:44 +00:00
|
|
|
'content_type': 'mako',
|
2021-12-24 14:28:36 +00:00
|
|
|
'context': {
|
|
|
|
'config': config,
|
2021-12-23 12:48:44 +00:00
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:infobeamer-cms:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/infobeamer-cms.service': {
|
2021-12-23 18:36:50 +00:00
|
|
|
'content_type': 'mako',
|
2021-12-24 14:28:36 +00:00
|
|
|
'context': node.metadata.get('infobeamer-cms'),
|
2021-12-23 12:48:44 +00:00
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:infobeamer-cms:restart',
|
|
|
|
},
|
2021-12-23 18:36:50 +00:00
|
|
|
},
|
|
|
|
'/etc/systemd/system/infobeamer-cms-runperiodic.timer': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:infobeamer-cms-runperiodic.timer:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/infobeamer-cms-runperiodic.service': {
|
2021-12-24 14:28:36 +00:00
|
|
|
'content_type': 'mako',
|
|
|
|
'context': node.metadata.get('infobeamer-cms'),
|
2021-12-23 18:36:50 +00:00
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
},
|
|
|
|
},
|
2021-12-23 12:48:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pkg_pip = {
|
|
|
|
'github-flask': {
|
|
|
|
'needed_by': {
|
2021-12-24 14:28:36 +00:00
|
|
|
'svc_systemd:infobeamer-cms',
|
2021-12-23 12:48:44 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'infobeamer-cms': {
|
|
|
|
'needs': {
|
2021-12-24 14:28:36 +00:00
|
|
|
'action:infobeamer-cms_install_requirements',
|
2023-12-29 07:16:58 +00:00
|
|
|
'directory:/opt/infobeamer-cms/static',
|
2021-12-23 18:36:50 +00:00
|
|
|
'file:/etc/systemd/system/infobeamer-cms.service',
|
2021-12-24 14:28:36 +00:00
|
|
|
'file:/opt/infobeamer-cms/settings.toml',
|
|
|
|
'git_deploy:/opt/infobeamer-cms/src',
|
2021-12-23 18:36:50 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
'infobeamer-cms-runperiodic.timer': {
|
|
|
|
'needs': {
|
2023-12-29 07:16:58 +00:00
|
|
|
'action:infobeamer-cms_install_requirements',
|
|
|
|
'directory:/opt/infobeamer-cms/static',
|
2021-12-23 18:36:50 +00:00
|
|
|
'file:/etc/systemd/system/infobeamer-cms-runperiodic.service',
|
2023-12-29 07:16:58 +00:00
|
|
|
'file:/etc/systemd/system/infobeamer-cms-runperiodic.timer',
|
|
|
|
'file:/opt/infobeamer-cms/settings.toml',
|
|
|
|
'git_deploy:/opt/infobeamer-cms/src',
|
2021-12-23 12:48:44 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
users = {
|
|
|
|
'infobeamer-cms': {
|
|
|
|
'home': '/opt/infobeamer-cms',
|
|
|
|
},
|
|
|
|
}
|