@ -8,9 +8,7 @@ Members can be assigned a server from Digitalocean, or they can connect their ow
The AWX system is arranged into 'members' each with their own 'subscriptions'. After creating a subscription the user enters the 'provision stage' where they defined the URLs they will use, the servers location and whether or not there's already a website at the base domain. They then proceed onto the 'deploy stage' where they can configure their Matrix server.
Ideally this system can manage the updates, configuration, backups and monitoring on it's own. It is an extension of the popular deploy script [spantaleev/matrix-docker-ansible-deploy](https://github.com/spantaleev/matrix-docker-ansible-deploy).
Warning: This project is currently alpha quality and should only be run by the brave.
This system can manage the updates, configuration, import and export, backups and monitoring on its own. It is an extension of the popular deploy script [spantaleev/matrix-docker-ansible-deploy](https://github.com/spantaleev/matrix-docker-ansible-deploy).
## Other Required Playbooks
@ -23,6 +21,7 @@ The following repositories allow you to copy and use this setup:
[Ansible Provision Server](https://gitlab.com/GoMatrixHosting/ansible-provision-server) - Used by AWX members to perform initial configuration of their DigitalOcean or On-Premises server.
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
register:janitors_token
no_log:True
- name:Collect total number of rooms
- name:Copy build_room_list.py script to target machine
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
- name:Print total number of rooms
debug:
msg:'{{ rooms_total.stdout }}'
when:purge_rooms|bool
- name:Calculate every 100 values for total number of rooms
delegate_to:127.0.0.1
shell:|
seq 0 100 {{ rooms_total.stdout }}
when:purge_rooms|bool
register:every_100_rooms
- name:Fetch complete room list from target machine
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
- name:Ensure room_list_complete.json file exists
delegate_to:127.0.0.1
- name:Remove complete room list from target machine
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
- name:Collect epoche time from date
delegate_to:127.0.0.1
shell:|
date -d '{{ purge_date }}' +"%s"
when:purge_rooms|bool
when:(purge_mode.find("Numberof users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
register:purge_epoche_time
- name:Generate list of rooms with more then N users
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1) or (purge_mode.find("Skip purging rooms [faster]") != -1)
job_template:"{{ matrix_domain }} - 0 - Deploy/Update a Server"
tags:"rust-synapse-compress-state"
wait:yes
tower_host:"https://{{ tower_host }}"
tower_oauthtoken:"{{ tower_token.stdout }}"
validate_certs:yes
register:job
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1) or (purge_mode.find("Skip purging rooms [faster]") != -1)
- name:Stop Synapse service
shell:systemctl stop matrix-synapse.service
- name:Revert 'Deploy/Update a Server' job template
delegate_to:127.0.0.1
awx.awx.tower_job_template:
name:"{{ matrix_domain }} - 0 - Deploy/Update a Server"
description:"Creates a new matrix service with Spantaleev's playbooks"
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1) or (purge_mode.find("Skip purging rooms [faster]") != -1)
- name:Ensure matrix-synapse is stopped
service:
name:matrix-synapse
state:stopped
daemon_reload:yes
when:(purge_mode.find("Perform final shrink") != -1)
when:(purge_mode.find("Perform final shrink") != -1)
- name:Cleanup room_list files
delegate_to:127.0.0.1
shell:|
rm /tmp/{{ subscription_id }}_room_list*
when:purge_rooms|bool
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
ignore_errors:yes
- name:Collect size of Synapse database
- name:Collect after shrink size of Synapse database
shell:du -sh /matrix/postgres/data
register:db_size_after_stat
when:(purge_mode.find("Perform final shrink") != -1)
no_log:True
- name:Print total number of rooms processed
debug:
msg:'{{ rooms_total.stdout }}'
when:purge_rooms|bool
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
- name:Print the number of rooms purged with no local users
debug:
msg:'{{ rooms_no_local_total.stdout }}'
when:purge_rooms|bool
when:(purge_mode.find("No local users [recommended]") != -1) or (purge_mode.find("Number of users [slower]") != -1) or (purge_mode.find("Number of events [slower]") != -1)
- name:Print the number of rooms purged with more then N users
debug:
msg:'{{ rooms_join_members_total.stdout }}'
when:(purge_metric.find("Number of users") != -1) and (purge_rooms|bool)
when:purge_mode.find("Number of users") != -1
- name:Print the number of rooms purged with more then N events
debug:
msg:'{{ rooms_state_events_total.stdout }}'
when:(purge_metric.find("Number of events") != -1) and (purge_rooms|bool)
when:purge_mode.find("Number of events") != -1
- name:Print before purge size of Synapse database