Merge pull request #786 from drpaneas/rebuild_telegram

Local rebuild for Telegram
This commit is contained in:
Slavi Pantaleev 2021-01-13 18:01:15 +02:00 committed by GitHub
commit a5a44a9d3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 11 deletions

View file

@ -12,7 +12,6 @@ matrix_mautrix_telegram_api_id: YOUR_TELEGRAM_APP_ID
matrix_mautrix_telegram_api_hash: YOUR_TELEGRAM_API_HASH
```
## Set up Double Puppeting
If you'd like to use [Double Puppeting](https://github.com/tulir/mautrix-telegram/wiki/Authentication#replacing-telegram-accounts-matrix-puppet-with-matrix-account) (hint: you most likely do), you have 2 ways of going about it.

View file

@ -305,6 +305,8 @@ matrix_mautrix_signal_database_password: "{{ matrix_synapse_macaroon_secret_key
# We don't enable bridges by default.
matrix_mautrix_telegram_enabled: false
matrix_mautrix_telegram_container_self_build: "{{ matrix_architecture != 'amd64' }}"
matrix_mautrix_telegram_systemd_required_services_list: |
{{
['docker.service']

View file

@ -3,6 +3,10 @@
matrix_mautrix_telegram_enabled: true
matrix_mautrix_telegram_container_self_build: false
matrix_mautrix_telegram_docker_repo: "https://mau.dev/tulir/mautrix-telegram.git"
matrix_mautrix_telegram_docker_src_files_path: "{{ matrix_base_data_path }}/mautrix-telegram/docker-src"
# See: https://mau.dev/tulir/mautrix-telegram/container_registry
matrix_mautrix_telegram_docker_image: "dock.mau.dev/tulir/mautrix-telegram:v0.9.0"
matrix_mautrix_telegram_docker_image_force_pull: "{{ matrix_mautrix_telegram_docker_image.endswith(':latest') }}"

View file

@ -34,13 +34,6 @@
when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists|bool"
when: "matrix_mautrix_telegram_database_engine == 'postgres'"
- name: Ensure Mautrix Telegram image is pulled
docker_image:
name: "{{ matrix_mautrix_telegram_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
force_source: "{{ matrix_mautrix_telegram_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_telegram_docker_image_force_pull }}"
- name: Ensure Mautrix Telegram paths exist
file:
path: "{{ item }}"
@ -49,9 +42,38 @@
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
with_items:
- "{{ matrix_mautrix_telegram_base_path }}"
- "{{ matrix_mautrix_telegram_config_path }}"
- "{{ matrix_mautrix_telegram_data_path }}"
- { path: "{{ matrix_mautrix_telegram_base_path }}", when: true }
- { path: "{{ matrix_mautrix_telegram_config_path }}", when: true }
- { path: "{{ matrix_mautrix_telegram_data_path }}", when: true }
- { path: "{{ matrix_mautrix_telegram_docker_src_files_path }}", when: "{{ matrix_mautrix_telegram_container_self_build }}" }
when: item.when|bool
- name: Ensure Mautrix Telegram image is pulled
docker_image:
name: "{{ matrix_mautrix_telegram_docker_image }}"
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
force_source: "{{ matrix_mautrix_telegram_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_telegram_docker_image_force_pull }}"
when: "not matrix_mautrix_telegram_container_self_build|bool"
- name: Ensure matrix-mautrix-telegram repository is present when self-building
git:
repo: "{{ matrix_mautrix_telegram_docker_repo }}"
dest: "{{ matrix_mautrix_telegram_docker_src_files_path }}"
force: "yes"
register: matrix_mautrix_telegram_git_pull_results
when: "matrix_mautrix_telegram_container_self_build|bool"
- name: Ensure matrix-mautrix-telegram Docker image is build
docker_image:
name: "{{ matrix_mautrix_telegram_docker_image }}"
source: build
force_source: yes
build:
dockerfile: Dockerfile
path: "{{ matrix_mautrix_telegram_docker_src_files_path }}"
pull: yes
when: "matrix_mautrix_telegram_container_self_build|bool and matrix_mautrix_telegram_git_pull_results.changed"
- name: Check if an old database file already exists
stat: