2020-09-06 10:05:42 +00:00
|
|
|
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': {
|
|
|
|
'directory:/opt/mautrix-telegram', # provided by bundle:users
|
|
|
|
},
|
|
|
|
},
|
2020-09-12 10:09:20 +00:00
|
|
|
'mautrix-telegram_init_alembic': {
|
|
|
|
'command': '/opt/mautrix-telegram/venv/bin/alembic -c /opt/mautrix-telegram/alembic.ini -x /opt/mautrix-telegram/config.yaml init /opt/mautrix-telegram/alembic',
|
|
|
|
'unless': 'test -d /opt/mautrix-telegram/alembic',
|
|
|
|
'needs': {
|
|
|
|
'file:/opt/mautrix-telegram/alembic.ini',
|
|
|
|
},
|
|
|
|
},
|
2020-09-06 10:05:42 +00:00
|
|
|
'mautrix-telegram_upgrade_database': {
|
2020-09-12 10:09:20 +00:00
|
|
|
'command': '/opt/mautrix-telegram/venv/bin/alembic -c /opt/mautrix-telegram/alembic.ini -x /opt/mautrix-telegram/config.yaml upgrade head',
|
2020-09-06 10:05:42 +00:00
|
|
|
'needs': {
|
2020-09-12 10:09:20 +00:00
|
|
|
'action:mautrix-telegram_init_alembic',
|
2020-09-06 10:05:42 +00:00
|
|
|
'postgres_db:mautrix-telegram',
|
|
|
|
'postgres_role:mautrix-telegram',
|
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-09-20 08:30:13 +00:00
|
|
|
pkg_pip = {
|
|
|
|
'/opt/mautrix-telegram/venv/mautrix-telegram': {
|
|
|
|
'needs': {
|
|
|
|
'action:mautrix-telegram_create_virtualenv',
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'action:mautrix-telegram_upgrade_database',
|
|
|
|
'svc_systemd:mautrix-telegram:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-06 10:05:42 +00:00
|
|
|
svc_systemd = {
|
|
|
|
'mautrix-telegram': {
|
|
|
|
'needs': {
|
|
|
|
'action:mautrix-telegram_upgrade_database',
|
|
|
|
'file:/etc/systemd/system/mautrix-telegram.service',
|
2020-09-12 10:59:34 +00:00
|
|
|
'file:/opt/mautrix-telegram/config.yaml',
|
2020-09-06 10:05:42 +00:00
|
|
|
'postgres_db:mautrix-telegram',
|
|
|
|
'postgres_role:mautrix-telegram',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
2020-09-12 10:59:34 +00:00
|
|
|
'/opt/mautrix-telegram/registration.yaml': {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:mautrix-telegram:restart',
|
|
|
|
},
|
|
|
|
},
|
2020-09-06 10:05:42 +00:00
|
|
|
'/opt/mautrix-telegram/config.yaml': {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:mautrix-telegram:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/mautrix-telegram.service': {
|
|
|
|
'triggers': {
|
2020-09-12 11:03:15 +00:00
|
|
|
'action:systemd-reload',
|
2020-09-06 10:05:42 +00:00
|
|
|
'svc_systemd:mautrix-telegram:restart',
|
|
|
|
},
|
2020-09-12 10:09:20 +00:00
|
|
|
},
|
|
|
|
'/opt/mautrix-telegram/alembic.ini': {},
|
2020-09-06 10:05:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if node.has_bundle('matrix-synapse'):
|
2020-09-12 10:59:34 +00:00
|
|
|
files['/opt/mautrix-telegram/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')
|