Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Image seems to be broken #9

Closed
phant0m3 opened this issue Dec 20, 2016 · 4 comments
Closed

Docker Image seems to be broken #9

phant0m3 opened this issue Dec 20, 2016 · 4 comments
Assignees
Labels

Comments

@phant0m3
Copy link

Not sure if this is related to MISP/MISP#1776 but the current docker image does not seem to work.

I get the following error in the log file:
``
2016-12-20 20:31:51 Error: [MissingControllerException] Controller class LoginController could not be found.
Exception Attributes: array (
'class' => 'LoginController',
'plugin' => NULL,
)
Request URL: /login
Stack Trace:
#0 /var/www/MISP/app/webroot/index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}
2016-12-20 20:31:52 Error: [MissingTableException] Table logs for model Log was not found in datasource default.
Exception Attributes: array (
'table' => 'logs',
'class' => 'Log',
'ds' => 'default',
)
Request URL: /
Stack Trace:
#0 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(3660): Model->setSource('logs')
#1 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(1394): Model->getDataSource()
#2 /var/www/MISP/app/Plugin/SysLogLogable/Model/Behavior/SysLogLogableBehavior.php(275): Model->schema()
#3 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/BehaviorCollection.php(145): SysLogLogableBehavior->setup(Object(User), Array)
#4 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/BehaviorCollection.php(66): BehaviorCollection->load('SysLogLogable.S...', Array)
#5 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(781): BehaviorCollection->init('User', Array)
#6 /var/www/MISP/app/Model/AppModel.php(31): Model->__construct(Array, NULL, NULL)
#7 [internal function]: AppModel->__construct(Array)
#8 /var/www/MISP/app/Lib/cakephp/lib/Cake/Utility/ClassRegistry.php(169): ReflectionClass->newInstance(Array)
#9 /var/www/MISP/app/Lib/cakephp/lib/Cake/Controller/Controller.php(742): ClassRegistry::init(Array)
#10 /var/www/MISP/app/Controller/AppController.php(90): Controller->loadModel('User')
#11 /var/www/MISP/app/Controller/EventsController.php(34): AppController->beforeFilter()
#12 [internal function]: EventsController->beforeFilter(Object(CakeEvent))
#13 /var/www/MISP/app/Lib/cakephp/lib/Cake/Event/CakeEventManager.php(243): call_user_func(Array, Object(CakeEvent))
#14 /var/www/MISP/app/Lib/cakephp/lib/Cake/Controller/Controller.php(677): CakeEventManager->dispatch(Object(CakeEvent))
#15 /var/www/MISP/app/Lib/cakephp/lib/Cake/Routing/Dispatcher.php(189): Controller->startupProcess()
#16 /var/www/MISP/app/Lib/cakephp/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(EventsController), Object(CakeRequest))
#17 /var/www/MISP/app/webroot/index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#18 {main}

If I try and import the mysql.sql from the INSTALL dir it tells me that the table does not support full text indexing so it may appear that the database does not get populated correctly.

I tried setting both complex and simple passwords in the env file but no luck.

@xme
Copy link
Owner

xme commented Dec 20, 2016

I did not update the Docker for a while. I'll have a look.

@xme xme self-assigned this Dec 20, 2016
@xme xme added the bug label Dec 20, 2016
@mallorybowes
Copy link
Contributor

mallorybowes commented Dec 22, 2016

Just wanted to add that I've confirmed the MissingTableException error message on my install but have not seen the MissingControllerException error.

I figured out a workaround to get the server working but tbh, I'm not a dba so the subtlety of what I changed may stick out to someone who knows a bit more about MySQL. From what I can tell, this workaround will still work for FULLTEXT indexing but YMMV.

It looks like the problem is the MYSQL.sql file included in the MISP installation and the version of MySQL installed in the default Ubuntu 14.04 image. MySQL v5.5 is installed by default during the build process. That version does not support FULLTEXT indexing for InnoDB tables so the process bails and the database doesn't get the full set of tables specified in the sql file. Not having the Logs table seems to be the cause of the MissingControllerException error in Cake.

  1. After the docker build, I got a bash shell from the container (docker exec -it misp bash), changed to /var/www/MISP/INSTALL
  2. Changed the type of all the tables in the base MYSQL.sql file from InnoDB to MYISAM (cat MYSQL.sql | sed -e s/InnoDB/MYISAM/g > MYSQL-myisam.sql).
  3. Loaded up the new sql file to the mysql server (mysql -u root -p misp < MYSQL-myisam.sql).

Doing that brought up the login page for the MISP server.

I think the best solution here would be to upgrade the mysql server to v5.7 but I tried the instructions here (https://askubuntu.com/questions/750498/mysql-5-5-update-to-mysql-5-7) but it borked the apt repo files and only partially installed the 5.7 components. For me, it was easier to rebuild the docker image then to try and track down the repo issues.

@mallorybowes
Copy link
Contributor

mallorybowes commented Dec 27, 2016

I've added a pull request with the updates to the Dockerfile to install MySQL v5.6 from the Ubuntu repo instead of v5.5. Seems to have taken care of the issue since v5.6 supports the FULLTEXT indexing for InnoDB tables specified in the default MISP sql file.

@phant0m3
Copy link
Author

I can confirm that the docker image now works again with the changes mentioned in the pull request. Thanks!

@xme xme closed this as completed Dec 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants