Solved py36-matrix-synapse - installation (almost working...)

Hi all!

Does somebody run the synapse matrix on FreeBSD?
I'm trying to install. Currently, without 100% sucess. What I've done at the moment.

1. To install synapsis with LDAP support and all dependecies.
pkg install py36-matrix-synapse py36-matrix-synapse-ldap3

2. To prepare config file.
vi /usr/local/etc/matrix-synapse/homeserver.yaml
Add content from the link https://github.com/matrix-org/synapse/blob/develop/docs/sample_config.yaml .
Set proper permisison for synapse user.
chown synapse /usr/local/etc/matrix-synapse/homeserver.yaml

I encountered the following errors:
Code:
user@serv:~ % service synapse start
Starting synapse.
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000008009d8000 (most recent call first):
Abort
/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
user@serv:~ %
I've set global environemnt variable for PYTHONHOME=/usr/local/bin in /etc/login.conf at setenv line.
Then used cap_mkdb /etc/login.conf and restart OS.

Code:
user@serv:~ % service synapse start
Starting synapse.
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000008009d8000 (most recent call first):
Abort
/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
user@serv:~ %
It needed to reinstall packages. I've just done it like this. And other errors ($PYTHONHOME etc.) should dissapear.
pkg upgrade -f

Code:
user@serv:~ % sudo service synapse start
Starting synapse.

Missing mandatory `server_name` config option.

/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
user@serv:~
If you missed to add server_name: my.server.name line into the /usr/local/etc/matrix-synapse/homeserver.yaml .


I stuck as below. If you run the synapse that's great and let us know how did you do that.
Code:
user@serv:~ % sudo service synapse start
Starting synapse.

Please opt in or out of reporting anonymized homeserver usage statistics, by
setting the `report_stats` key in your config file to either True or False.

We would really appreciate it if you could help our project out by reporting
anonymized usage statistics from your homeserver. Only very basic aggregate
data (e.g. number of users) will be reported, but it helps us to track the
growth of the Matrix community, and helps us to make Matrix a success, as well
as to convince other networks that they should peer with us.

Thank you.

/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
user@serv:~ %
 
I have actually the opposite problem: the started net-im/py-matrix-synapse can't be stopped.

Ok, let's start from the beginning.
Code:
19:20 /root # freebsd-version
12.0-RELEASE-p10
I installed built in poudriere net-im/py-matrix-synapse server in jail with simple pkg install py36-matrix-synapse. After that I run /usr/local/bin/python3.6 -B -m synapse.app.homeserver -c /usr/local/etc/matrix-synapse/homeserver.yaml --generate-config -H matrix.mydomain.org --report-stats no and created the dirs for log, pid, etc (also made them chown -R synapse ...). Made changes in homeserver.yaml and make it chown synapse ... as well. Of course, the net-im/py-matrix-synapse connected through nginx as reverse proxy. After that the server successfully started and run without any problem. I connected coturn and managed to test video calls both within my server and between my server and matrix.org installation.

The problem is, that the running net-im/py-matrix-synapse doesn't want to go down. Well, when I ask nicely.
Code:
 19:28 / # service synapse stop
synapse not running? (check /var/run/matrix-synapse/homeserver.pid).
 19:29 / # ls -la /var/run/matrix-synapse
total 14
drwxr-xr-x  2 synapse  wheel   3 Sep 18 18:35 .
drwxr-xr-x  6 root     wheel  15 Sep 18 18:35 ..
-rw-r--r--  1 synapse  wheel   5 Sep 18 18:35 homeserver.pid
 19:29 / #
And if I try to restart, it doesn't aware of the fact that it is already running, and start itself once again (I guess..)
Code:
 19:29 / # service synapse restart
synapse not running? (check /var/run/matrix-synapse/homeserver.pid).
Starting synapse.
2019-09-18 19:31:05,114 - root - 226 - WARNING - None - ***** STARTING SERVER *****
2019-09-18 19:31:05,190 - root - 227 - WARNING - None - Server /usr/local/lib/python3.6/site-packages/synapse/app/homeserver.py version 1.2.1
/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
But in fact it doesn't failed...
Code:
 19:30 /root # ps -ax | grep synapse
54382  -  SsJ     0:06.50 /usr/local/bin/python3.6 -m synapse.app.homeserver --daemonize -c /usr/local/etc/matrix-synapse/homeser
54694  -  IsJ     0:00.09 postgres: synapse_user synapse 10.1.1.8(49926)  (postgres)
54704  -  IsJ     0:00.10 postgres: synapse_user synapse 10.1.1.8(34813)  (postgres)
54898  -  IsJ     0:00.08 postgres: synapse_user synapse 10.1.1.8(35987)  (postgres)
55140  -  IsJ     0:00.09 postgres: synapse_user synapse 10.1.1.8(48412)  (postgres)
66998  -  IsJ     0:00.10 postgres: synapse_user synapse 10.1.1.8(17246)  (postgres)
71422  -  SsJ     0:15.16 /usr/local/bin/python3.6 -m synapse.app.homeserver --daemonize -c /usr/local/etc/matrix-synapse/homeser
71603  -  IsJ     0:00.16 postgres: synapse_user synapse 10.1.1.8(17671)  (postgres)
72397  -  IsJ     0:00.17 postgres: synapse_user synapse 10.1.1.8(39734)  (postgres)
72575  -  IsJ     0:00.17 postgres: synapse_user synapse 10.1.1.8(48464)  (postgres)
72821  -  IsJ     0:00.20 postgres: synapse_user synapse 10.1.1.8(33224)  (postgres)
73216  -  IsJ     0:00.17 postgres: synapse_user synapse 10.1.1.8(13992)  (postgres)
74282  -  IsJ     0:00.17 postgres: synapse_user synapse 10.1.1.8(33434)  (postgres)
78655  -  IsJ     0:00.17 postgres: synapse_user synapse 10.1.1.8(43654)  (postgres)
79232  -  IsJ     0:00.17 postgres: synapse_user synapse 10.1.1.8(43655)  (postgres)
87376  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(43663)  (postgres)
88057  -  IsJ     0:00.16 postgres: synapse_user synapse 10.1.1.8(43664)  (postgres)
56185  1  S+      0:00.00 grep synapse

As I wrote in another thread here on the forum, the net-im/py-matrix-synapse server even survives the restart of the jail it resides in. I have not enough knowledge and experience even to guess what is wrong with it. Just in case here is the attached file from /usr/local/etc/rc.d
 

Attachments

  • synapse.zip
    755 bytes · Views: 238
It turns out, that I made a mistake in /etc/jail.conf - in the new jail section didn't wrap the IP in quotes, it looked like tjis:
Code:
$ip= 8 ;
It led to the duplicated jails with the same name "matrix" running with different unique JIDs. Obviously the service restart jail matrix command restarted only one jail with the same name. I wonder why the jail started and worked after all and didn't through in an error or at least warning. After I correcter the error and restarted the host a service restart jail matrix (or any other jail per se) gone flawless.
 
Hi all!

Does somebody run the synapse matrix on FreeBSD?
I'm trying to install. Currently, without 100% sucess. What I've done at the moment.

1. To install synapsis with LDAP support and all dependecies.
pkg install py36-matrix-synapse py36-matrix-synapse-ldap3

2. To prepare config file.
vi /usr/local/etc/matrix-synapse/homeserver.yaml
Add content from the link https://github.com/matrix-org/synapse/blob/develop/docs/sample_config.yaml .
Set proper permisison for synapse user.
chown synapse /usr/local/etc/matrix-synapse/homeserver.yaml

I encountered the following errors:
Code:
user@serv:~ % service synapse start
Starting synapse.
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000008009d8000 (most recent call first):
Abort
/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
user@serv:~ %
I've set global environemnt variable for PYTHONHOME=/usr/local/bin in /etc/login.conf at setenv line.
Then used cap_mkdb /etc/login.conf and restart OS.

Code:
user@serv:~ % service synapse start
Starting synapse.
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000008009d8000 (most recent call first):
Abort
/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
user@serv:~ %
It needed to reinstall packages. I've just done it like this. And other errors ($PYTHONHOME etc.) should dissapear.
pkg upgrade -f

Code:
user@serv:~ % sudo service synapse start
Starting synapse.

Missing mandatory `server_name` config option.

/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
user@serv:~
If you missed to add server_name: my.server.name line into the /usr/local/etc/matrix-synapse/homeserver.yaml .


I stuck as below. If you run the synapse that's great and let us know how did you do that.
Code:
user@serv:~ % sudo service synapse start
Starting synapse.

Please opt in or out of reporting anonymized homeserver usage statistics, by
setting the `report_stats` key in your config file to either True or False.

We would really appreciate it if you could help our project out by reporting
anonymized usage statistics from your homeserver. Only very basic aggregate
data (e.g. number of users) will be reported, but it helps us to track the
growth of the Matrix community, and helps us to make Matrix a success, as well
as to convince other networks that they should peer with us.

Thank you.

/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse
user@serv:~ %

How has it been going for you? Did you get it up and running?

I used this how-to along with the matrix synapse documentation to get it working with Postrgres and it works great. I did have to build it from ports so I could have it work with Postgres and python3.6.

I have family and friends on it (10 users) and it never goes down only time it went down was when it lost connection to Postgres due to firewall mis-configuration on my part.

I had to start it with his command:
Code:
synctl start

From within the .synapse folder where I ran my config:
Code:
python3.7 -m synapse.app.homeserver \
          --server-name  MyDomain.com \         # *MyDomain.com* can be any internal or external domain
          --config-path homeserver.yaml \
          --generate-config \
          --report-stats=no
 
Back
Top