docker-jitsi-meet icon indicating copy to clipboard operation
docker-jitsi-meet copied to clipboard

connecting PRosody to MySQL

Open iasbm opened this issue 1 year ago • 9 comments

we need to store the chat messages in our MySQL backend.
As far as i understand we are using ENV vars to control / change the behaviour of docker images of Jitsi, jibri, jvb etc. But my interpretation is that we don't have ENV based approach to make Prosody connect to our custom DB ( in our case MySQl). So the only option is that we need to change the "prosody.cfg.lua" file. As per "prosody.cfg.lua" file we need to uncomment the below two lines (in prosody.cfg.lua) and configure with our DB details

--storage = "sql" -- Default is "internal" (Debian: "sql" requires one of the
--sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }

we tried the following approaches...

  1. we uncommented and added our DB details then docker-compose down and then again docker-compose up . But no result and then we went into the container shell and our uncommented lines are not being reflected there in the container.

appreciate any insight / guidance on this please.

iasbm avatar Feb 27 '23 09:02 iasbm

I think the problem is the muc uses memory for storage, thus your confis is not used. Some new env vars would be needed for that, or maybe there is a way to replicate messages to a storage backend?

saghul avatar Mar 07 '23 11:03 saghul

the other approach is to listen for "incomingMessage" and "outgoingMessage" events as per the JITSI documentation here by using the API object created for each conference on on participant side., But that means the chat messages are received on front end side and then we need to make API call to our server and store them in our own DB and it works. But from message security point of view it will be more appropriate if we can get Prosody directly write into a configured DB backend. In face we got this done (i.e. Prosody connecting to a backend MySQL DB) in non docker JITSI world when we installed JITSI manually. But it's not working in docker world.

iasbm avatar Mar 07 '23 12:03 iasbm

Following up further, i have done some more research and here are my findings....

  1. Removed all JITSI/* docker images from my local docker registry.
  2. then i executed steps 1-4 as per the article https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-docker Note: Here double checked by going into ".jitsi-meet-cfg/prosody/config" which is the result of "mkdir" command executed in step-4. I made sure the folder "prosody/config" is empty. 3.Now I have edited the prosody.cfg.lua file in the source code with my DB configuration and then finally i have executed the command ---------docker-compose -f docker-compose.yml -f jibri.yml up -d

So here ideally i would expect that the prosody.cfg.lua file inside ( .jitsi-meet-cfg/prosody/config) to have my DB config details. But unfortunately NO, and it still takes the commented version of DB configuration as follows...

--storage = "sql" -- Default is "internal" (Debian: "sql" requires one of the
-- lua-dbi-sqlite3, lua-dbi-mysql or lua-dbi-postgresql packages to work)

-- For the "sql" backend, you can uncomment *one* of the below to configure:
--sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename.
--sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
--sql = { driver = "PostgreSQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }

that makes me think that modifying the "prosody.cfg.lua" will have no affect whatsoever even the comments inside the "prosody.cfg.lua" suggests so.

Or am I missing something here

iasbm avatar Mar 07 '23 16:03 iasbm

Config files are regenerated when the container starts.

saghul avatar Mar 07 '23 18:03 saghul

@saghul I got the same issues,is there some way to override some settings in prosody.cfg.lua

GalensGan avatar Jun 28 '23 07:06 GalensGan

Not at the moment. A PR adding support for it would be welcome.

Out of curiosity, what is your use case?

saghul avatar Jun 28 '23 07:06 saghul

Thank you for the reply. I'm not very familiar with Docker, so I'm afraid I don't have the ability to make a PR. I deployed Jitsi Meet using Docker on a Windows Server. I want to use the ·event_sync_component· plugin to register callbacks for room creation and destruction in Prosody. However, I cannot configure it through jitsi-meet.cfg.lua, and the configuration is reset every time I restart the Docker container. #1570

GalensGan avatar Jun 28 '23 08:06 GalensGan

How is that related to MySQL though?

saghul avatar Jun 28 '23 08:06 saghul

that makes me think that modifying the "prosody.cfg.lua" will have no affect whatsoever even the comments inside the "prosody.cfg.lua" suggests so.

That's what I meant. Thank you very much. I solved it by changing my approach.I will reply with my solution here #1570, hoping it can help someone in need.

GalensGan avatar Jun 28 '23 09:06 GalensGan