mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Add monit and a few utility scripts
This commit is contained in:
parent
b09ac86a62
commit
830f6a5609
12 changed files with 537 additions and 14 deletions
|
|
@ -10,15 +10,16 @@
|
|||
docker_service:
|
||||
project_src: "{{docker_compose_files_folder}}/matrix"
|
||||
state: present
|
||||
- name: Check if database tables exist
|
||||
command: docker-compose exec -T db psql -U synapse synapse -c "\dt"
|
||||
- name: Wait for database to start and count matrix users
|
||||
shell: docker-compose exec -T db psql -U synapse synapse -c "select count(*) from users;" -t
|
||||
args:
|
||||
chdir: "{{docker_compose_files_folder}}/matrix/"
|
||||
register: db_tables_exist
|
||||
ignore_errors: false
|
||||
changed_when: '"No relations found." in db_tables_exist.stdout_lines'
|
||||
- name: Restore Matrix database
|
||||
register: matrix_users_count
|
||||
until: matrix_users_count.rc == 0
|
||||
retries: 10
|
||||
changed_when: false
|
||||
- name: Restore Matrix database if needed
|
||||
command: docker-compose exec -T db sh -c "psql -U synapse synapse < /backups/database.dmp"
|
||||
args:
|
||||
chdir: "{{docker_compose_files_folder}}/matrix/"
|
||||
when: '"No relations found." in db_tables_exist.stdout_lines'
|
||||
when: matrix_users_count.stdout|int == 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue