bundles/mautrix-telegram: introduce
This commit is contained in:
parent
180802a669
commit
cf2920f284
5 changed files with 321 additions and 1 deletions
70
bundles/mautrix-telegram/items.py
Normal file
70
bundles/mautrix-telegram/items.py
Normal file
|
@ -0,0 +1,70 @@
|
|||
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
|
||||
},
|
||||
},
|
||||
'mautrix-telegram_install_bridge': {
|
||||
# TODO find out how we can check if *this package* requires an update
|
||||
'command': '/opt/mautrix-telegram/venv/bin/pip install --upgrade mautrix-telegram[all]',
|
||||
'needs': {
|
||||
'action:mautrix-telegram_create_virtualenv',
|
||||
},
|
||||
'triggers': {
|
||||
'action:mautrix-telegram_generate_registration',
|
||||
'action:mautrix-telegram_upgrade_database',
|
||||
},
|
||||
},
|
||||
'mautrix-telegram_generate_registration': {
|
||||
'command': '/opt/mautrix-telegram/venv/bin/python3 -m mautrix_telegram -c /opt/mautrix-telegram/config.yaml -r /opt/mautrix-telegram/registration.yaml -g',
|
||||
'needs': {
|
||||
'file:/opt/mautrix-telegram/config.yaml',
|
||||
},
|
||||
'triggers': {
|
||||
'svc_systemd:mautrix-telegram:restart',
|
||||
},
|
||||
'triggered': True,
|
||||
},
|
||||
'mautrix-telegram_upgrade_database': {
|
||||
'command': '/opt/mautrix-telegram/venv/bin/alembic -x /opt/mautrix-telegram/config.yaml upgrade head',
|
||||
'needs': {
|
||||
# Actually, the dependency is 'mautrix-telegram has run
|
||||
# atleast once, but we can't check that.
|
||||
'action:mautrix-telegram_generate_registration',
|
||||
'postgres_db:mautrix-telegram',
|
||||
'postgres_role:mautrix-telegram',
|
||||
},
|
||||
'triggered': True,
|
||||
},
|
||||
}
|
||||
|
||||
svc_systemd = {
|
||||
'mautrix-telegram': {
|
||||
'needs': {
|
||||
'action:mautrix-telegram_generate_registration',
|
||||
'action:mautrix-telegram_upgrade_database',
|
||||
'file:/etc/systemd/system/mautrix-telegram.service',
|
||||
'postgres_db:mautrix-telegram',
|
||||
'postgres_role:mautrix-telegram',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
files = {
|
||||
'/opt/mautrix-telegram/config.yaml': {
|
||||
'content_type': 'mako',
|
||||
'triggers': {
|
||||
'svc_systemd:mautrix-telegram:restart',
|
||||
},
|
||||
},
|
||||
'/etc/systemd/system/mautrix-telegram.service': {
|
||||
'triggers': {
|
||||
'svc_systemd:mautrix-telegram:restart',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if node.has_bundle('matrix-synapse'):
|
||||
actions['mautrix-telegram_generate_registration']['triggers'].add('svc_systemd:matrix-synapse:restart')
|
Loading…
Add table
Add a link
Reference in a new issue