Closed Maddosaurus closed 5 years ago
After testing with the compose file a bit more, it seems there are side effects that I am not sure how to counter.
The first build on a fresh system succeeds, but if I change anything in the docker-compose file, I am presented with the internal error.
Even cleaning the system via
docker-compose rm -v
docker system prune
docker rmi misp
docker rmi mysql/mysql-server
removing all data dirs and resetting the git repo to HEAD does not change the outcome.
If you need any detailed logs or further info, please give me a heads up, I'm happy to help.
Seems like I have tracked down the problem.
It all boils down to a faulty MySQL DB-Connection. The config in app/Config/database.php
correctly makes use of the DNS-name of the Docker-container.
However, somewhere deeper the line, something seems to cache the initial IP address of the db
container. As soon as the addresses change (i.e. update, restart, ...), MISP fails with an internal error, as it cannot establish a connection to the database.
I'm not deep enough into the architecture to track it down further, but a workaround seems to be to assign fixed addresses to the containers in the docker-compose.yml
. We should definitely try to track this down, but this might be a workaround for the time being.
The problem can be reproduced by restarting the Docker containers multiple times until there's an IP change. Afterwards, errors like this show up in the error.log:
2019-07-28 10:26:55 Error: [MissingConnectionException] Database connection "Mysql" is missing, or could not be created.
Exception Attributes: array (
'class' => 'Mysql',
'message' => 'SQLSTATE[HY000] [1045] Access denied for user \'misp\'@\'172.18.0.15\' (using password: YES)',
'enabled' => true,
)
Request URL: /
Stack Trace:
#0 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Datasource/DboSource.php(278): Mysql->connect()
#1 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/ConnectionManager.php(105): DboSource->__construct(Array)
#2 /var/www/MISP/app/Controller/AppController.php(126): ConnectionManager::getDataSource('default')
#3 /var/www/MISP/app/Controller/EventsController.php(55): AppController->beforeFilter()
#4 /var/www/MISP/app/Lib/cakephp/lib/Cake/Event/CakeEventManager.php(243): EventsController->beforeFilter(Object(CakeEvent))
#5 /var/www/MISP/app/Lib/cakephp/lib/Cake/Controller/Controller.php(682): CakeEventManager->dispatch(Object(CakeEvent))
#6 /var/www/MISP/app/Lib/cakephp/lib/Cake/Routing/Dispatcher.php(189): Controller->startupProcess()
#7 /var/www/MISP/app/Lib/cakephp/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(EventsController), Object(CakeRequest))
#8 /var/www/MISP/app/webroot/index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#9 {main}
whereas 172.18.0.15 is the initial IP address of the db
container, but not its current.
I cannot reproduce this.
Trying to build the docker images via
docker-compose build
produces a MISP instance that displays "An Internal Error Has Occurred.".The db and web containers are running and the passwords seem to work (logging in with the defined db user and pw on the db container works as intended).
I did, however, find the following lines in the mysqld.log:
It seems something does not respect the
MYSQL_DATABASE
variable, as I have renamed the DB to something different (on both, the db and the web container).Edit: Leaving all environment vars untouched produces a running image. Changing any of them results in "An Internal Error Has Occured".
Environment: