WWBN / AVideo-Encoder

Encoder Server for AVideo Platform Open-Source
https://platform.avideo.com
GNU Affero General Public License v3.0
152 stars 189 forks source link

Change table configurations #431

Open trickert76 opened 2 years ago

trickert76 commented 2 years ago

I try to install avideo and avideo-encoder inside a docker-compose environment together with a mysql server. I'd like to avoid using root for that database to setup two databases inside the mysql server. The only reason for that is, that avideo and avideo-encoder need to create some tables in their own schema/database.

But at the end both could store their tables inside the same database. Only the table configurations is a problem. It exists in both environments. If I can rename that table f.e. to "configuratations_encoder" then I could use the same credentials.

I would like to make a PR for that. Is the solution ok for you?

What is to do?

Add the end - there is one problem. This is a breaking change. The current version of the app is stored in the table that is renamed, so the new Configuration object would look into a table that is not available in older version. I need to add there a hook to look for a table "configurations" or "configurations_encoder". That is a little bit ugly.

DanielnetoDotCom commented 2 years ago

Hi,

Changing the configurations table will be a very big impact on the code. is not clear to me why can't have another database just for the encoder. so the configurations table may not be a problem

what other app do you have on the same docker image?

trickert76 commented 2 years ago

First - you need root access or a user that is able to create databases. This is a very big issue in bigger environments where users/customers normally don't have such access rights to central infrastructure. Second - Because the application doesnt make sence without AVideo platform, there is a logic link between them and so there is no reason to use different databases for the same "service" from the infrastructure point of view. Also it is more complicated in case of backups/recovery etc. when there are several databases involved.

I'm not really sure, if this is really a big issue. At the end - especially this table is not really necessary, the information could also be stored in the configurations.php file itself. Using a database table for storing a single row is oversized.

trickert76 commented 2 years ago

I made a PR - please have a look.

DanielnetoDotCom commented 2 years ago

I will look, but having a different DB for each service does not consume many resources.

anyway, I will review it.

also would be good to let you make multiple encoder installations. for example, use the composer to rise one streamer and 4 encoders. so you will need different databases for each encoder.

is it a big deal to do on the docker?

an alternative is to use a database prefix

trickert76 commented 2 years ago

Of course a database prefix would be the best solution. And in docker it means, that you need to configure and use the root credentials. Of course that is easy, but it's the same with security and backup issues then. If you want prefixes, it could be, that I need your help a little bit more.

DanielnetoDotCom commented 2 years ago

Question...

  1. So the idea is to use the same streamer database to host the encoder tables as well?
  2. how will you create the encoder tables on the docker?
  3. will you use the install/database.sql file to install?
trickert76 commented 2 years ago
  1. yepp
  2. see 3.
  3. yepp. I'm running the install/checkConfiguration.php which itself creates the tables.

So if there is a new property f.e. "DB_MYSQL_PREFIX" I would forward it to checkConfiguration.php. Optional we could make same sed or change the Configuration::getTableName() function (and use it where possible like in the checkConfiguration.php or the update.php

DanielnetoDotCom commented 2 years ago

This update should do the trick

now we have a variable called $global['tablesPrefix']