Bonjour,
J'ai suivi et construit un ocs server en utilisant la stack docker (https://github.com/OCSInventory-NG/OCSInventory-Docker-Stack) (docker version 18.09.9, Ubuntu 19.10)
La construction se passe correctement, le up aussi(1), mais lorsque j'accède à http://localhost:8080/ocsreports/, j'obtiens une page avec les messages d'erreur :
ERROR: MySql connection problem 2002
php_network_getaddresses: getaddrinfo failed: Name or service not known
ERROR: MySql connection problem 2002
php_network_getaddresses: getaddrinfo failed: Name or service not known
Voici, ci-dessous, quelques logs et éléments d'investigation, mais là je suis bloqué, merci de me dire comment je peux faire démarrer mon installation ?
Notez que je n'ai pas modifié le docker-compose.yml sauf pour utiliser le port 8080 pour accéder au serveur web.
En me connectant au container ocsinventory-server, j'obtiens le log d'erreur suivant (des warnings, des infos, mais pas d'erreur) :
cat /var/log/httpd/error_log
Scalar value @args[$i] better written as $args[$i] at /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm line 54.
ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable
[Tue Mar 10 19:44:50.318444 2020] [suexec:notice] [pid 158] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
Scalar value @args[$i] better written as $args[$i] at /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm line 54.
ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable
[Tue Mar 10 19:44:50.452854 2020] [lbmethod_heartbeat:notice] [pid 158] AH02282: No slotmem from mod_heartmonitor
[Tue Mar 10 19:44:50.480225 2020] [mpm_prefork:notice] [pid 158] AH00163: Apache/2.4.6 (CentOS) PHP/7.3.15 mod_perl/2.0.11 Perl/v5.16.3 configured -- resuming normal operations
[Tue Mar 10 19:44:50.480255 2020] [core:notice] [pid 158] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Mar 10 19:44:57.680203 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 161
[Tue Mar 10 19:44:57.748772 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 161
[Tue Mar 10 19:44:57.748873 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 67
[Tue Mar 10 19:44:57.748898 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 104
[Tue Mar 10 19:44:57.748904 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 38
[Tue Mar 10 19:44:58.974790 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 161
[Tue Mar 10 19:44:59.052784 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 161
[Tue Mar 10 19:44:59.052850 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 67
[Tue Mar 10 19:44:59.052860 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 104
[Tue Mar 10 19:44:59.052866 2020] [php7:warn] [pid 159] [client 172.18.0.1:39580] PHP Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 38
En me connectant au container ocsinventory-db, je peux me connecter à la base de données ocsweb avec le login root et le mot de passe mdp (inchangés dans la config). Avec un show databases et tables j'ai la liste des BDD (5) et des tables (101). Donc le serveur mysql semble fonctionner et être initialisé.
(1) Notez aussi qu'après un docker-compose up, il semblerait parfois que le container ocsinventory-server se termine tout seul, un seul container tourne alors
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cd037b900f4b mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up 41 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp ocsinventory-db
mais en stoppant le container ocsinventory-db, et en refaisant le docker compose up, ça fonctionne, les deux container s'exécutent, ceci n'est donc pas un problème bloquant pour le moment.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
238b85defb40 ocsinventory/ocsinventory-docker-image:latest "/usr/bin/docker-ent…" 2 hours ago Up 8 seconds 0.0.0.0:443->443/tcp, 0.0.0.0:8080->80/tcp ocsinventory-server
cd037b900f4b mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up 8 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp ocsinventory-db