bundlewrap/bundles/mautrix-whatsapp/items.py

71 lines
1.8 KiB
Python

users = {
'mautrix-whatsapp': {
'home': '/opt/mautrix-whatsapp',
},
}
directories = {
'/opt/mautrix-whatsapp': {},
'/opt/mautrix-whatsapp/src': {},
'/opt/mautrix-whatsapp/logs': {
'owner': 'mautrix-whatsapp',
},
}
git_deploy = {
'/opt/mautrix-whatsapp/src': {
'repo': 'https://github.com/tulir/mautrix-whatsapp.git',
'rev': node.metadata['mautrix-whatsapp']['version'],
'triggers': {
'action:mautrix-whatsapp_build',
'svc_systemd:mautrix-whatsapp:restart',
},
},
}
actions = {
'mautrix-whatsapp_build': {
'command': 'cd /opt/mautrix-whatsapp/src && go build',
'triggered': True,
'needs': {
'pkg_apt:golang-go',
},
},
}
svc_systemd = {
'mautrix-whatsapp': {
'needs': {
'action:mautrix-whatsapp_build',
'directory:/opt/mautrix-whatsapp/logs',
'file:/etc/systemd/system/mautrix-whatsapp.service',
'file:/opt/mautrix-whatsapp/config.yaml',
'postgres_db:mautrix-whatsapp',
'postgres_role:mautrix-whatsapp',
},
},
}
files = {
'/opt/mautrix-whatsapp/registration.yaml': {
'content_type': 'mako',
'triggers': {
'svc_systemd:mautrix-whatsapp:restart',
},
},
'/opt/mautrix-whatsapp/config.yaml': {
'content_type': 'mako',
'triggers': {
'svc_systemd:mautrix-whatsapp:restart',
},
},
'/etc/systemd/system/mautrix-whatsapp.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:mautrix-whatsapp:restart',
},
},
}
if node.has_bundle('matrix-synapse'):
files['/opt/mautrix-whatsapp/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')