bundles/mautrix-telegram: handle registration.yaml ourselves
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-09-12 12:59:34 +02:00
parent a69f049ce2
commit 2361466c84
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 26 additions and 18 deletions

View file

@ -13,20 +13,9 @@ actions = {
'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_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',
@ -37,9 +26,6 @@ actions = {
'mautrix-telegram_upgrade_database': {
'command': '/opt/mautrix-telegram/venv/bin/alembic -c /opt/mautrix-telegram/alembic.ini -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',
'action:mautrix-telegram_init_alembic',
'postgres_db:mautrix-telegram',
'postgres_role:mautrix-telegram',
@ -51,9 +37,9 @@ actions = {
svc_systemd = {
'mautrix-telegram': {
'needs': {
'action:mautrix-telegram_generate_registration',
'action:mautrix-telegram_upgrade_database',
'file:/etc/systemd/system/mautrix-telegram.service',
'file:/opt/mautrix-telegram/config.yaml',
'postgres_db:mautrix-telegram',
'postgres_role:mautrix-telegram',
},
@ -61,6 +47,12 @@ svc_systemd = {
}
files = {
'/opt/mautrix-telegram/registration.yaml': {
'content_type': 'mako',
'triggers': {
'svc_systemd:mautrix-telegram:restart',
},
},
'/opt/mautrix-telegram/config.yaml': {
'content_type': 'mako',
'triggers': {
@ -76,4 +68,4 @@ files = {
}
if node.has_bundle('matrix-synapse'):
actions['mautrix-telegram_generate_registration']['triggers'].add('svc_systemd:matrix-synapse:restart')
files['/opt/mautrix-telegram/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')