This is an old revision of the document!
matrix synapse
vr:
- 172.30.18.45: synapse, riot, dimension server
- 172.30.18.54: jitsi
galileo:
- matrix.csgalileo.org: synapse, riot, dimension server
- jitsi: meet.csgalileo.org (bilanciamento tra 1.meet.csgalileo.org e 2.meet.csgalileo.org)
synapse (matrix)
- configurazione: /etc/matrix-synapse
- service: matrix-synapse.service
aggiornamento
normale apt
install
apt install nginx
installare da repository
wget -qO - https://matrix.org/packages/debian/repo-key.asc | sudo apt-key add - sudo add-apt-repository https://matrix.org/packages/debian/ apt install matrix-synapse-py3 apt install python-matrix-synapse-ldap3
a questo punto synapse si trova nel virtualenv /opt/venvs/matrix-synapse/
nextcloud auth
python package synapse_g creato nella cartella /opt/venvs/synapse_g e utilizzato da /etc/matrix-synapse/homeserver.yaml
cd /opt/venvs/synapse_g /opt/venvs/synapse_g ├── setup.py ├── synapse_g │ ├── __init__.py │ └── nextcloud_provider.py
setup con db postgresql
Installare postgresql.
apt install postgresql postgresql-contrib
Creare un utente e un database per synapse.
su - postgres createuser --pwprompt synapse_admin psql CREATE DATABASE synapse ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER synapse_admin;
Installare i pacchetti per synapse e postgres
apt install libpq5 /opt/venvs/matrix-synapse/bin/pip install matrix-synapse[postgres]
Importante: prima di effettuare il porting mettere il nome del server nel file di configurazione “homeserver.yaml” alla voce server_name (Es: server_name: “matrix.csgalileo.org”) altrimenti lo script va in errore Il servername si trova in /etc/matrix-synapse/conf.d/server_name.yaml
Preparare le configurazioni
cp /etc/matrix-synapse/homeserver.yaml /etc/matrix-synapse/homeserver-postgres.yaml cp /etc/matrix-synapse/homeserver.yaml /etc/matrix-synapse/homeserver-old-sqlite.yaml vim /etc/matrix-synapse/homeserver-postgres.yaml database: name: psycopg2 args: user: "synapse_admin" password: "la password del db per synapse_admin" database: synapse host: 127.0.0.1 cp_min: 5 cp_max: 10
Porting
systemctl stop matrix-synapse synapse_port_db --sqlite-database /var/lib/matrix-synapse/homeserver.db \ --postgres-config /etc/matrix-synapse/homeserver-postgres.yaml mv /etc/matrix-synapse/homeserver-postgres.yaml /etc/matrix-synapse/homeserver.yaml systemctl start matrix-synapse
riot
ambiente di sviluppo creato da https://github.com/vector-im/riot-web#setting-up-a-dev-environment
aggiornamento
cd /lab/riot source lib/bin/activate cd matrix-react-sdk git co develop git pull git co verona git merge develop ... risolvere i conflitti yarn install cd .. cd matrix-js-sdk git pull yarn install cd riot-web git co develop git pull git co verona git merge develop ... risolvere i conflitti yarn install
test in locale
yarn start
deploy galileo
cd /lab/riot make deploy
deploy verona
cd /var/www cp -a riot-dev riot-backup/
cd /lab/riot make deployvr
matrix-dimension
update
su - dimension cd matrix-dimension git pull npm install
systemctl restart matrix-synapse.service
after 1 minute from start check with browser https://dimension.comune.verona.it
install
in synapse server create local user called dimension for matrix-dimension binding
/opt/venvs/matrix-synapse/bin/register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008 New user localpart [root]: dimension Password: Confirm password: Make admin [no]: Sending registration request... Success!
run browser in incognito mode and login with dimension credentials in https://matrix.csgalileo.org and copy token
as user root
apt install g++ gcc sqlite3 make
as user dimension
nodeenv -n 10.19.0 venv . venv/bin/activate unset NODE_ENV # Download dimension git clone https://github.com/turt2live/matrix-dimension.git cd matrix-dimension # Install dependencies npm install # Build it npm run build
cp config/default.yaml config/production.yaml
get token at https://t2bot.io/docs/access_tokens
verify token
TOKEN=xxxxxxx curl -H "Authorization: Bearer $TOKEN" https://matrix.csgalileo.org/_matrix/client/r0/account/whoami
edit config/production.yaml
homeserver: name: "csgalileo.org" clientServerUrl: "https://matrix.csgalileo.org" mediaUrl: "https://t2bot.io" accessToken: "....... admins: - "@stefano.scipioni:matrix.csgalileo.org" dimension: publicUrl: "https://dimension2.csgalileo.org/"
NODE_ENV=production npm run start:app
systemd service
[Service] ExecStart=/bin/bash -c 'source /home/dimension/venv/bin/activate; /home/dimension/venv/bin/npm run start:app' #ExecStart=/home/dimension/venv/bin/npm run start:app WorkingDirectory=/home/dimension/matrix-dimension Environment=NODE_ENV=production # Restart timing Restart=always RestartSec=60 # Output to syslog StandardOutput=syslog StandardError=syslog SyslogIdentifier=matrix-dimension # User & group to run service as User=dimension [Install] WantedBy=default.target