Cooking Matrix at home
It all started with a small experiment on installing the Synapse messaging server on a smartphone with the Ubuntu Touch operating system , and ended up creating a small home data center on 5 ARM mini servers (Raspberry Pi and ODROID-XU4), whose main function is to provide the exchange system Matrix and WebRTS messaging / calls for 10 users.

Matrix is an open instant messaging protocol (based on decentralized servers) that allows users to exchange text messages and files, make voice and video calls, create chat channels, etc.
The most well-known client for the network Matrix - Riot.im, is implemented as a mobile, web or desktop application. In terms of functionality, it is not inferior to customers of modern Slack / Telegram / WhatsApp messengers.
So, after installing on a smartphone (the server is difficult to use when it is in your pocket and all the time changes its address and connection method - WiFi / 3G / 4G), the next step was to transfer the system to one Raspberry Pi. Front-end - Synapse server implementation in Python , back-end - PostgreSQL database from the standard Raspbian for Raspberry Pi distribution.
Connection to the Internet - via port forwarding (port 8448) on a home vDSL modem with a static external IP address.
Everything worked, but sometimes with a “scratch” - there were occasional delays - connecting clients took a few seconds, timeouts when connecting to third-party channels / rooms matrix.org.
After the PostgreSQL database was transferred to the second Raspberry Pi, performance improved noticeably, but still 100% load of one of the processor cores occurred within a few minutes (on the front-end side).
To improve the situation, the front-end was transferred to the fanless ODROID-XU4 (8 ARM cores, 2 Gb of RAM, server price - $ 59), and then the PostgreSQL database was transferred to the second ODROID-XU4.

A USB Ethernet switch ($ 20) was added to connect the servers over a twisted pair, an external USB drive of 2 Tb, as well as a 6-port USB charging for powering the 3 Raspberry Pi and Ethernet switch.
The released Raspberry Pi was converted: firewall to provide DMZ, Zabbix server for monitoring, hot standby server for PostgreSQL database (located in another room). Another Raspberry Pi with a mobile Internet access module was added to receive the second communication channel through the 4G module for the Raspberry Pi.
In addition, an uninterruptible power supply UPS was added.
During installation, the system looked like this (located inside the electric fireplace): The

size of the Synapse back-end database grew by ~ 325 Mb in six months: The

size of the Zabbix monitoring system database grew to 1.25 Gb and soon stabilized:

External network load (7 days schedule ):

Internal network load (schedule for 7 days):

Load graph on the front end for 3 days:

When encryption is enabled on clients, encrypted data is stored in the database, so even physical access to the server will not lead to data leakage.
All of the above can be implemented on low-cost VPS in any data center, but if it works stably at home, why not do it on home equipment?

Matrix is an open instant messaging protocol (based on decentralized servers) that allows users to exchange text messages and files, make voice and video calls, create chat channels, etc.
The most well-known client for the network Matrix - Riot.im, is implemented as a mobile, web or desktop application. In terms of functionality, it is not inferior to customers of modern Slack / Telegram / WhatsApp messengers.
So, after installing on a smartphone (the server is difficult to use when it is in your pocket and all the time changes its address and connection method - WiFi / 3G / 4G), the next step was to transfer the system to one Raspberry Pi. Front-end - Synapse server implementation in Python , back-end - PostgreSQL database from the standard Raspbian for Raspberry Pi distribution.
Connection to the Internet - via port forwarding (port 8448) on a home vDSL modem with a static external IP address.
Everything worked, but sometimes with a “scratch” - there were occasional delays - connecting clients took a few seconds, timeouts when connecting to third-party channels / rooms matrix.org.
After the PostgreSQL database was transferred to the second Raspberry Pi, performance improved noticeably, but still 100% load of one of the processor cores occurred within a few minutes (on the front-end side).
To improve the situation, the front-end was transferred to the fanless ODROID-XU4 (8 ARM cores, 2 Gb of RAM, server price - $ 59), and then the PostgreSQL database was transferred to the second ODROID-XU4.

A USB Ethernet switch ($ 20) was added to connect the servers over a twisted pair, an external USB drive of 2 Tb, as well as a 6-port USB charging for powering the 3 Raspberry Pi and Ethernet switch.
The released Raspberry Pi was converted: firewall to provide DMZ, Zabbix server for monitoring, hot standby server for PostgreSQL database (located in another room). Another Raspberry Pi with a mobile Internet access module was added to receive the second communication channel through the 4G module for the Raspberry Pi.
In addition, an uninterruptible power supply UPS was added.
During installation, the system looked like this (located inside the electric fireplace): The

size of the Synapse back-end database grew by ~ 325 Mb in six months: The

size of the Zabbix monitoring system database grew to 1.25 Gb and soon stabilized:

External network load (7 days schedule ):

Internal network load (schedule for 7 days):

Load graph on the front end for 3 days:

When encryption is enabled on clients, encrypted data is stored in the database, so even physical access to the server will not lead to data leakage.
All of the above can be implemented on low-cost VPS in any data center, but if it works stably at home, why not do it on home equipment?