From 7ab121e7e5d5c76be36ef8b73ec7aa73385339e3 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 7 Nov 2020 09:39:57 +0100 Subject: [PATCH] bundles/mautrix-telegram: install bridge from git repository --- .../files/mautrix-telegram.service | 4 ++- bundles/mautrix-telegram/items.py | 27 ++++++++++++++----- bundles/mautrix-telegram/metadata.py | 5 ++++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/bundles/mautrix-telegram/files/mautrix-telegram.service b/bundles/mautrix-telegram/files/mautrix-telegram.service index e25680f..2e82651 100644 --- a/bundles/mautrix-telegram/files/mautrix-telegram.service +++ b/bundles/mautrix-telegram/files/mautrix-telegram.service @@ -7,9 +7,11 @@ User=mautrix-telegram Group=mautrix-telegram Environment="VIRTUAL_ENV=/opt/mautrix-telegram/venv" Environment="PATH=/opt/mautrix-telegram/venv/bin:/usr/local/bin:/usr/bin:/bin" +Environment="FFMPEG_BINARY=/usr/bin/ffmpeg" ExecStart=/opt/mautrix-telegram/venv/bin/python -m mautrix_telegram -c /opt/mautrix-telegram/config.yaml -WorkingDirectory=/opt/mautrix-telegram +WorkingDirectory=/opt/mautrix-telegram/src Restart=on-failure +RestartSec=10 [Install] WantedBy=multi-user.target diff --git a/bundles/mautrix-telegram/items.py b/bundles/mautrix-telegram/items.py index 254548e..15c14f2 100644 --- a/bundles/mautrix-telegram/items.py +++ b/bundles/mautrix-telegram/items.py @@ -10,12 +10,21 @@ actions = { '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_upgrade_database': { - 'command': '/opt/mautrix-telegram/venv/bin/alembic -c /opt/mautrix-telegram/alembic.ini -x /opt/mautrix-telegram/config.yaml upgrade head', + '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', @@ -24,12 +33,16 @@ actions = { }, } -pkg_pip = { - '/opt/mautrix-telegram/venv/mautrix-telegram': { - 'needs': { - 'action:mautrix-telegram_create_virtualenv', - }, +directories = { + '/opt/mautrix-telegram/src': {}, +} + +git_deploy = { + '/opt/mautrix-telegram/src': { + 'repo': 'https://github.com/tulir/mautrix-telegram.git', + 'rev': 'master', 'triggers': { + 'action:mautrix-telegram_install_bridge', 'action:mautrix-telegram_upgrade_database', 'svc_systemd:mautrix-telegram:restart', }, diff --git a/bundles/mautrix-telegram/metadata.py b/bundles/mautrix-telegram/metadata.py index c87a499..3e71fdb 100644 --- a/bundles/mautrix-telegram/metadata.py +++ b/bundles/mautrix-telegram/metadata.py @@ -1,4 +1,9 @@ defaults = { + 'apt': { + 'packages': { + 'ffmpeg': {}, + }, + }, 'users': { 'mautrix-telegram': { 'home': '/opt/mautrix-telegram',