bundlewrap/bundles/mautrix-telegram/items.py

77 lines
2.1 KiB
Python

actions = {
'mautrix-telegram_create_virtualenv': {
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/mautrix-telegram/venv/',
'unless': 'test -d /opt/mautrix-telegram/venv/',
'needs': {
# actually /opt/mautrix-telegram, but we don't create that
'directory:/opt/mautrix-telegram/src',
},
},
'mautrix-telegram_install_bridge': {
'command': 'cd /opt/mautrix-telegram/src && /opt/mautrix-telegram/venv/bin/pip install --upgrade pip .[all]',
'needs': {
'action:mautrix-telegram_create_virtualenv',
},
'triggered': True,
},
}
users = {
'mautrix-telegram': {
'home': '/opt/mautrix-telegram',
},
}
directories = {
'/opt/mautrix-telegram': {},
'/opt/mautrix-telegram/src': {},
}
git_deploy = {
'/opt/mautrix-telegram/src': {
'repo': 'https://github.com/mautrix/telegram.git',
'rev': node.metadata.get('mautrix-telegram/version'),
'triggers': {
'action:mautrix-telegram_install_bridge',
'svc_systemd:mautrix-telegram:restart',
},
},
}
svc_systemd = {
'mautrix-telegram': {
'needs': {
'action:mautrix-telegram_install_bridge',
'file:/etc/systemd/system/mautrix-telegram.service',
'file:/opt/mautrix-telegram/config.yaml',
'postgres_db:mautrix-telegram',
'postgres_role:mautrix-telegram',
},
},
}
files = {
'/opt/mautrix-telegram/registration.yaml': {
'content_type': 'mako',
'triggers': {
'svc_systemd:mautrix-telegram:restart',
},
},
'/opt/mautrix-telegram/config.yaml': {
'content_type': 'mako',
'triggers': {
'svc_systemd:mautrix-telegram:restart',
},
},
'/etc/systemd/system/mautrix-telegram.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:mautrix-telegram:restart',
},
},
}
if node.has_bundle('matrix-synapse'):
files['/opt/mautrix-telegram/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')