ChatMatrix: Difference between revisions
Line 129: | Line 129: | ||
=== WhatsApp === | === WhatsApp === | ||
==== Installation ==== | |||
<p>Create folder for binary</p> | <p>Create folder for binary</p> | ||
<syntaxhighlight lang="console" line> | <syntaxhighlight lang="console" line> | ||
Line 145: | Line 146: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== Create database ==== | |||
<p>Open Postgres console</p> | <p>Open Postgres console</p> | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
Line 165: | Line 167: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== Configuration ==== | |||
<p>Create and paste config file: [[mautrix-whatsapp-config.yaml]]</p> | <p>Create and paste config file: [[mautrix-whatsapp-config.yaml]]</p> | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
Line 190: | Line 193: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<p>To register | <p>To register WhatsApp add following lines</p> | ||
<syntaxhighlight lang="console" line> | <syntaxhighlight lang="console" line> | ||
app_service_config_files: | app_service_config_files: | ||
Line 196: | Line 199: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<p></p> | <p>Restart matrix-synapse</p> | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
systemctl restart matrix-synapse | |||
</syntaxhighlight> | |||
<p>Check if bridge works</p> | |||
<syntaxhighlight lang="console"> | |||
./mautrix-whatsapp | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<p></p> | ==== systemd service ==== | ||
<p>Create systemd service file</p> | |||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
nano | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 19:03, 15 July 2022
IP: | 192.168.88.19 |
---|---|
MAC: | BE:B1:89:38:28:44 |
Domain: | chat.flowerhouse.at |
OS: | Debian Bullseye |
---|---|
RAM: | 4096MB |
Cores: | 2 |
Privileged: | No |
The ChatMatrix-LXC is reachable under 192.168.88.19
which is located in the ServerVLAN.
The subdomain is chat.flowerhouse.at which is handled by the ReverseProxy.
Basic Setup
Installation
Install required packages
apt install -y lsb-release wget apt-transport-https
Add repository
wget -O /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/matrix-org.list
apt update
Install matrix-synapse
apt install matrix-synapse-py3
Check status
systemctl status matrix-synapse
Postgres database
Install required packages
apt install libpq5 postgresql
Open Postgres console
su - postgres
Create user for matrix-synapse
createuser --pwprompt synapse_user
Create database for matrix-synapse
createdb --encoding=UTF8 --locale=C --template=template0 --owner=synapse_user synapse
Exit Postgres console
exit
Edit matrix-synapse configuration file
nano /etc/matrix-synapse/homeserver.yaml
Edit the database entry
database:
name: psycopg2
args:
user: synapse_user
password: <pass>
database: synapse
host: localhost
cp_min: 5
cp_max: 10
Check if it works
systemctl restart matrix-synapse
systemctl status matrix-synapse
Configuration
Create random key and save it
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
Edit matrix-synapse configuration file
nano /etc/matrix-synapse/homeserver.yaml
Add following lines
suppress_key_server_warning: true
registration_shared_secret: <SECRET-KEY>
Comment following line to make it accessible from outside localhost
# bind_addresses: ...
Restart matrix-synapse
systemctl restart matrix-synapse
Setting up reverse proxy
Check federation configuration: https://federationtester.matrix.org/
Add User
register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008
Install Bridges
ffmpeg is needed to support media files
apt install ffmpeg
Installation
Create folder for binary
mkdir /opt/mautrix-whatsapp
cd /opt/mautrix-whatsapp
Download binary from https://github.com/mautrix/whatsapp/releases
wget https://github.com/mautrix/whatsapp/releases/download/v0.5.0/mautrix-whatsapp-amd64
Rename binary
mv mautrix-whatsapp-amd64 mautrix-whatsapp
Create database
Open Postgres console
su - postgres
Create user for mautrix-whatsapp
createuser --pwprompt whatsapp_user
Create database for mautrix-whatsapp
createdb --encoding=UTF8 --locale=C --template=template0 --owner=whatsapp_user whatsapp
Exit Postgres console
exit
Configuration
Create and paste config file: mautrix-whatsapp-config.yaml
nano config.yaml
Modify permissions
chmod 755 mautrix-whatsapp
Generate the appservice registration file
./mautrix-whatsapp -g
Modify permissions
chmod 555 registration.yaml
Edit matrix-synapse configuration file
nano /etc/matrix-synapse/homeserver.yaml
To register WhatsApp add following lines
app_service_config_files:
- /opt/mautrix-whatsapp/registration.yaml
Restart matrix-synapse
systemctl restart matrix-synapse
Check if bridge works
./mautrix-whatsapp
systemd service
Create systemd service file
nano