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_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': { 'action:mautrix-telegram_create_virtualenv', 'file:/opt/mautrix-telegram/alembic.ini', }, }, 'mautrix-telegram_install_bridge': { 'command': 'cd /opt/mautrix-telegram/src && /opt/mautrix-telegram/venv/bin/pip install --upgrade .[all]', 'needs': { 'action:mautrix-telegram_create_virtualenv', }, 'triggered': True, }, 'mautrix-telegram_upgrade_database': { 'command': '/opt/mautrix-telegram/venv/bin/alembic -c /opt/mautrix-telegram/alembic.ini -x config=/opt/mautrix-telegram/config.yaml upgrade head', 'needs': { 'action:mautrix-telegram_create_virtualenv', 'action:mautrix-telegram_init_alembic', 'postgres_db:mautrix-telegram', 'postgres_role:mautrix-telegram', }, 'triggered': True, }, } directories = { '/opt/mautrix-telegram/src': {}, } git_deploy = { '/opt/mautrix-telegram/src': { 'repo': 'https://github.com/tulir/mautrix-telegram.git', 'rev': 'v0.8.2', 'triggers': { 'action:mautrix-telegram_install_bridge', 'action:mautrix-telegram_upgrade_database', 'svc_systemd:mautrix-telegram:restart', }, }, } svc_systemd = { 'mautrix-telegram': { 'needs': { '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', }, }, } 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', }, }, '/opt/mautrix-telegram/alembic.ini': {}, } if node.has_bundle('matrix-synapse'): files['/opt/mautrix-telegram/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')