mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-25 02:18:31 +01:00
Remove references to sqlite
Remove references to sqlite since we should just use postgres from the outset.
This commit is contained in:
parent
68e6311a9f
commit
cb608c06aa
@ -36,19 +36,10 @@ matrix_mautrix_twitter_homeserver_token: ''
|
|||||||
|
|
||||||
# Database-related configuration fields.
|
# Database-related configuration fields.
|
||||||
#
|
#
|
||||||
# To use SQLite:
|
|
||||||
# - change the engine (`matrix_mautrix_twitter_database_engine: 'sqlite'`)
|
|
||||||
# - change to the last bridge version that supported SQLite:
|
|
||||||
# `matrix_mautrix_twitter_docker_image: "{{ matrix_mautrix_twitter_docker_image_name_prefix }}tulir/mautrix-twitter:da1b4ec596e334325a1589e70829dea46e73064b"`
|
|
||||||
# - plan your migration to Postgres, as this bridge does not support SQLite anymore (and neither will the playbook in the future).
|
|
||||||
#
|
|
||||||
# To use Postgres:
|
# To use Postgres:
|
||||||
# - adjust your database credentials via the `matrix_mautrix_twitter_postgres_*` variables
|
# - adjust your database credentials via the `matrix_mautrix_twitter_postgres_*` variables
|
||||||
matrix_mautrix_twitter_database_engine: 'postgres'
|
matrix_mautrix_twitter_database_engine: 'postgres'
|
||||||
|
|
||||||
matrix_mautrix_twitter_sqlite_database_path_local: "{{ matrix_mautrix_twitter_data_path }}/mautrix-twitter.db"
|
|
||||||
matrix_mautrix_twitter_sqlite_database_path_in_container: "/data/mautrix-twitter.db"
|
|
||||||
|
|
||||||
matrix_mautrix_twitter_database_username: 'matrix_mautrix_twitter'
|
matrix_mautrix_twitter_database_username: 'matrix_mautrix_twitter'
|
||||||
matrix_mautrix_twitter_database_password: 'some-password'
|
matrix_mautrix_twitter_database_password: 'some-password'
|
||||||
matrix_mautrix_twitter_database_hostname: 'matrix-postgres'
|
matrix_mautrix_twitter_database_hostname: 'matrix-postgres'
|
||||||
@ -59,7 +50,6 @@ matrix_mautrix_twitter_database_connection_string: 'postgres://{{ matrix_mautrix
|
|||||||
|
|
||||||
matrix_mautrix_twitter_appservice_database: "{{
|
matrix_mautrix_twitter_appservice_database: "{{
|
||||||
{
|
{
|
||||||
'sqlite': ('sqlite:///' + matrix_mautrix_twitter_sqlite_database_path_in_container),
|
|
||||||
'postgres': matrix_mautrix_twitter_database_connection_string,
|
'postgres': matrix_mautrix_twitter_database_connection_string,
|
||||||
}[matrix_mautrix_twitter_database_engine]
|
}[matrix_mautrix_twitter_database_engine]
|
||||||
}}"
|
}}"
|
||||||
|
@ -11,29 +11,6 @@
|
|||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_mautrix_twitter_requires_restart: false
|
matrix_mautrix_twitter_requires_restart: false
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: Check if an SQLite database already exists
|
|
||||||
stat:
|
|
||||||
path: "{{ matrix_mautrix_twitter_sqlite_database_path_local }}"
|
|
||||||
register: matrix_mautrix_twitter_sqlite_database_path_local_stat_result
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- set_fact:
|
|
||||||
matrix_postgres_db_migration_request:
|
|
||||||
src: "{{ matrix_mautrix_twitter_sqlite_database_path_local }}"
|
|
||||||
dst: "{{ matrix_mautrix_twitter_database_connection_string }}"
|
|
||||||
caller: "{{ role_path|basename }}"
|
|
||||||
engine_variable_name: 'matrix_mautrix_twitter_database_engine'
|
|
||||||
engine_old: 'sqlite'
|
|
||||||
systemd_services_to_stop: ['matrix-mautrix-twitter.service']
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_mautrix_twitter_requires_restart: true
|
|
||||||
when: "matrix_mautrix_twitter_sqlite_database_path_local_stat_result.stat.exists|bool"
|
|
||||||
when: "matrix_mautrix_twitter_database_engine == 'postgres'"
|
|
||||||
|
|
||||||
- name: Ensure Mautrix Twitter image is pulled
|
- name: Ensure Mautrix Twitter image is pulled
|
||||||
docker_image:
|
docker_image:
|
||||||
name: "{{ matrix_mautrix_twitter_docker_image }}"
|
name: "{{ matrix_mautrix_twitter_docker_image }}"
|
||||||
@ -76,23 +53,6 @@
|
|||||||
pull: yes
|
pull: yes
|
||||||
when: "matrix_mautrix_twitter_enabled|bool and matrix_mautrix_twitter_container_image_self_build|bool"
|
when: "matrix_mautrix_twitter_enabled|bool and matrix_mautrix_twitter_container_image_self_build|bool"
|
||||||
|
|
||||||
- name: Check if an old database file already exists
|
|
||||||
stat:
|
|
||||||
path: "{{ matrix_mautrix_twitter_base_path }}/mautrix-twitter.db"
|
|
||||||
register: matrix_mautrix_twitter_stat_database
|
|
||||||
|
|
||||||
- name: (Data relocation) Ensure matrix-mautrix-twitter.service is stopped
|
|
||||||
service:
|
|
||||||
name: matrix-mautrix-twitter
|
|
||||||
state: stopped
|
|
||||||
daemon_reload: yes
|
|
||||||
failed_when: false
|
|
||||||
when: "matrix_mautrix_twitter_stat_database.stat.exists"
|
|
||||||
|
|
||||||
- name: (Data relocation) Move mautrix-twitter database file to ./data directory
|
|
||||||
command: "mv {{ matrix_mautrix_twitter_base_path }}/mautrix-twitter.db {{ matrix_mautrix_twitter_data_path }}/mautrix-twitter.db"
|
|
||||||
when: "matrix_mautrix_twitter_stat_database.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure mautrix-twitter config.yaml installed
|
- name: Ensure mautrix-twitter config.yaml installed
|
||||||
copy:
|
copy:
|
||||||
content: "{{ matrix_mautrix_twitter_configuration|to_nice_yaml }}"
|
content: "{{ matrix_mautrix_twitter_configuration|to_nice_yaml }}"
|
||||||
|
@ -8,24 +8,3 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- "matrix_mautrix_twitter_appservice_token"
|
- "matrix_mautrix_twitter_appservice_token"
|
||||||
- "matrix_mautrix_twitter_homeserver_token"
|
- "matrix_mautrix_twitter_homeserver_token"
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: Fail if on SQLite, unless on the last version supporting SQLite
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
You're trying to use the mautrix-twitter bridge with an SQLite database.
|
|
||||||
Going forward, this bridge only supports Postgres.
|
|
||||||
To learn more about this, see our changelog: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/CHANGELOG.md#breaking-change-the-mautrix-twitter-bridge-now-requires-a-postgres-database
|
|
||||||
when: "not matrix_mautrix_twitter_docker_image.endswith(':da1b4ec596e334325a1589e70829dea46e73064b')"
|
|
||||||
|
|
||||||
- name: Inject warning if still on SQLite
|
|
||||||
set_fact:
|
|
||||||
matrix_playbook_runtime_results: |
|
|
||||||
{{
|
|
||||||
matrix_playbook_runtime_results|default([])
|
|
||||||
+
|
|
||||||
[
|
|
||||||
"NOTE: Your mautrix-twitter bridge setup is still on SQLite. Your bridge is not getting any updates and will likely stop working at some point. To learn more about this, see our changelog: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/CHANGELOG.md#breaking-change-the-mautrix-twitter-bridge-now-requires-a-postgres-database"
|
|
||||||
]
|
|
||||||
}}
|
|
||||||
when: "matrix_mautrix_twitter_database_engine == 'sqlite'"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user