• General
  • Hosting a Matrix chat server

I need to host my own Matrix chat server and it appears this may be possible using my Opalstack shared hosting account. There are implementations based on python 3, postgresql, and nginx, apparently.
My plan is to attempt this and document my efforts here. If you have suggestions, I welcome them!

  • sean replied to this.

    jeromev I tried the Python implementation and it was very easy to get running.

    1. Create a new Nginx Proxy Port app to reserve a HTTP port for the server and make a note of the app's port assignment.
    2. Attach the app to a site.
    3. SSH to the app's shell user and run the following commands:

      cd ~/apps/name_of_app
      python3 -m venv env
      pip install --upgrade pip
      pip install --upgrade setuptools
      pip install matrix-synapse
      
      # use the site domain from step 2 here:
      SERVERNAME=matrix.domain.com
      
      python -m synapse.app.homeserver \
          --server-name $SERVERNAME \
          --config-path homeserver.yaml \
          --generate-config \
          --report-stats=yes
    1. Edit homeserver.yaml to set the http port to your app's port (from step 1).
    2. Edit $SERVERNAME.log.config to set the log filename to /home/your_shell_user/logs/apps/name_of_app/homeserver.log
    3. Run the following command to start the instance:

      synctl start

    At this point your Matrix server will be up and running and accessible via HTTP.


    10 days later

    To upgrade by using pip:
    source ~/apps/synapse/env/bin/activate
    pip install -U matrix-synapse

    to start:
    cd ~/apps/synapse
    source env/bin/activate
    synctl start

    Mastodon