livematrix icon indicating copy to clipboard operation
livematrix copied to clipboard

Needs more detailed steps for configuration. Especially about inclusion of SSL.

Open HighPriest opened this issue 2 years ago • 0 comments

Here are the steps I took to configure the livematrix package on top of Caddy web server. It is important to note, that SSL encrypted communication requires a trusted domain name with a certificate.

Step 0 - Subdomain

  • Create an A record for a subdomain you are going to use to serve the HTTP and WebSocket communication with the communicator. e.g. lm.your_domain.com

Step 1 - proxy

  • Add reverse_proxy handler for the livematrix subdomain to the Caddy config
  • nano /etc/caddy/Caddyfile
lm.your_domain.com {
       reverse_proxy localhost:8000
}
  • sudo systemctl reload caddy
  • Caddy is going to create a LetsEncrypt cert for you automatically

Step 2 - server

  • Place the livematrix server binary with .env file somewhere on your server
  • Modify the .env file with
  • MATRIX_RECIPIENT=your_private_user:your_domain.com
  • MATRIX_SERVER=matrix.your_domain.com #This needs to lead directly to ip reverse_proxy of your matrix server. The livematrix server does not check the /matrix directory to be correctly redirected from the base domain to the subdomain
  • MATRIX_USERNAME and MATRIX_PASSWORD are login information for a user you don't mind getting taken over by someone. Such user can be easily created with register_new_matrix_user
  • SERVER_IFACE=127.0.0.1 if you are running the livematrix server on the same machine as your Caddy server (that's why we set localhost:8000 in the caddyfile)

Now you can run the server

Step 3 - client

  • Create a webpage you want to add the client to and copy the html & js & css & config.json components in locations according to the readme.md
  • This website can be hosted anywhere. Does not have to be where the livematrix server is located.
  • In config.json use these settings
{ 
   "config" : {
       "server" : {
           "proto": "https", 
           "host": "lm.your_domain.com", 
           "port": ""
       }, 
       "websocket": {
           "proto": "wss",
           "host": "lm.your_domain.com", 
           "port": ""
       }
   }, 
   "greetings": "Hello there, thanks for reaching out, i'll answer you asap"
}
  • Take note of the wsS and httpS protocol designators and omitted port (because of reverse_proxy redirection) for the SSL connection to work

HighPriest avatar Jul 06 '23 13:07 HighPriest