elestio-examples / glpi

Deploy GLPI with CI/CD on Elestio
8 stars 5 forks source link

Pre-implement database config #3

Open compgeniuses opened 7 months ago

compgeniuses commented 7 months ago

At the moment, the container seems to be asking the user from the user interface to add their database details, which is countr intuitive,

WOuld it not be great if we could have the container automatically use the configured variables to acheive this.

We can do this by

Mounting the following file inside the glpi files

config_db.php

then inside it, we add the follwing

<?php class DB extends DBmysql { public $dbhost = '127.0.0.1'; public $dbuser = 'glpi'; public $dbpassword = '$db_pass'; public $dbdefault  = 'glpi'; } ?>

you'll need to adopt the variables to yours,

Wouldn't this solve the problem?

AmsellemJoseph commented 6 months ago

hey @compgeniuses,

Thanks for your suggestion. We tried that, unfortunately it's not working because the tables/db migrations won't be done and there is no way to automate this with curl because it's protected with CSRF

compgeniuses commented 6 months ago

so there basically is no way to implement this on the db?

Take a look at this and see if it helps https://github.com/stephdl/nethserver-glpi-10-latest

We attempted to implement in this here https://github.com/geniusdynamics/docker-glpi for this purpose https://github.com/geniusdynamics/ns8-glpi but have been getting other error

Error: An error has occurred, but the trace of this error could not recorded because of a problem accessing the log file.

We need to figure out a way to implement a proper database without asking user to input these values.

jbenguira commented 6 months ago

so there basically is no way to implement this on the db?

Indeed seems impossible because the software do not allow it and actively prevent it with the CSRF protection. Best option would be to suggest the feature to allow full configuration provided in ENV vars like most software are doing in their Github repo here: https://github.com/glpi-project/glpi

compgeniuses commented 6 months ago

Hello @jbenguira we have managed to build a proper docker image that implements pre-dataabse configurations.

the source is found here https://github.com/geniusdynamics/docker-glpi/tree/combined

you can get the image here: https://hub.docker.com/r/geniusdynamics/glpi/tags the one named combined

We have done all the necessary tests, and would make proper tag changes once validated completely. feel free to test it out and report any challenges found.

jbenguira commented 6 months ago

@compgeniuses thanks! we will review and update our template early next week :)

compgeniuses commented 6 months ago

the master branch also implements the database, however, it compiles the glpi version locally during install similar to how yours is implemented.