Difference between revisions of "Poddery - Diaspora, Matrix and XMPP"

no edit summary
Line 319: Line 319:
* To include an additional subdomain such as fund.poddery.com use with --expand parameter as shown below
* To include an additional subdomain such as fund.poddery.com use with --expand parameter as shown below
  letsencrypt certonly --webroot --agree-tos --expand -w /usr/share/diaspora/public -d poddery.com -d www.poddery.com -d test.poddery.com -d groups.poddery.com -d fund.poddery.com -w /usr/share/diaspora/public/save/ -d save.poddery.com -w /var/www/riot/ -d chat.poddery.com
  letsencrypt certonly --webroot --agree-tos --expand -w /usr/share/diaspora/public -d poddery.com -d www.poddery.com -d test.poddery.com -d groups.poddery.com -d fund.poddery.com -w /usr/share/diaspora/public/save/ -d save.poddery.com -w /var/www/riot/ -d chat.poddery.com
==Backup==
Backup server is provided by Manu (KVM virtual machine with 180 GB storage and 1 GB ram ).
Debian Stetch was upgraded Debian Buster before database relication of synapse database.
Documentation: https://www.percona.com/blog/2018/09/07/setting-up-streaming-replication-postgresql/
Currently postgres database for matrix-synapse is backed up.
Setup tinc vpn in the backup server
# apt install tinc
Configure tinc by creating tinc.conf and host podderybackup under label fsci.
Add tinc-up and tinc-down scripts
Copy poddery host config to backup server and podderybackup host config to poddery.com server.
Relaod tinc vpn servie at both poddery.com and backup servers
# systemctl reload tinc@fsci.service
Enable tinc@fsci systemd service for autostart
# systemctl enable tinc@fsci.service
===Postgresql (for synapse) Primary configuration===
Create postgresql user for replication.
$ psql -c "CREATE USER replication REPLICATION LOGIN CONNECTION LIMIT 1 ENCRYPTED PASSWORD 'yourpassword';"
The password is in the access repo if you need it later.
Allow standby to connect to primary using the user just created.
$ cd /etc/postgresql/11/main
$ nano pg_hba.conf
Add below line to allow replication user to get access to the server
host    replication    replication    172.16.0.3/32  md5
Next , open the postgres configuration file
nano postgresql.conf
Set the following configuration options in the postgresql.conf file
listen_addresses = 'localhost,172.16.0.2'
port=5432
wal_level = replica
max_wal_senders = 1
wal_keep_segments = 64
archive_mode = on
archive_command = 'cd .'
You need to restart since postgresql.conf was edited and parameters changed,
# systemctl restart postgresql
===Postgresql (for synapse) Standby configuration: Step 2===
Install postgresql
# apt install postgresql
Check postgresql server is running
# su postgres -c psql
Make sure en_US.UTF-8 locale is available
# dpkg-reconfigure locales
Stop postgresql before changing any configuration
#systemctl stop postgresql@11-main
Switch to postgres user
# su - postgres
$ cd /etc/postgresql/11/
Open the postgres configuration file
$ nano postgresql.conf
Set the following configuration options in the postgresql.conf file
max_connections = 500
max_worker_processes = 16
Copy data from master and create recovery.conf
$ pg_basebackup -h git.fosscommunity.in -D /var/lib/postgresql/11/main/ -P -U rep --wal-method=fetch  -R
Start the stopped postgresql service
# systemctl start postgresql@11-main
===Replication Status===
On Primary,
$ ps -ef | grep sender
$ psql -c "select * from pg_stat_activity where usename='rep';"
On Standby,
$ ps -ef | grep receiver


= History =
= History =