Bookworm-project / BookwormDB

Tools for text tokenization and encoding
MIT License
84 stars 12 forks source link

Wanting to replicate the visual presentation at bookworm.culturomics.org/oneclick/ #52

Closed tpmccallum closed 9 years ago

tpmccallum commented 9 years ago

Hi, I have installed https://github.com/Bookworm-project/BookwormDB on Ubuntu.

I would like to have the same visual representation as the bookworm.culturomics.org/oneclick/ site.

The database, apache etc is all working on the Ubuntu machine, I just can not see how to make the oneclick software display.

Thanks Tim

tpmccallum commented 9 years ago

Hi, I have installed Bookworm on an Amazon server at http://54.153.174.142/mccallum/ I would really appreciate a hand in getting it to render the graph, as far as I can see everything is in order; obviously there is something amiss. I am really happy to hand over details for ssh so that someone can take a look at the configuration. I logged all of the steps in installing this instance in a GitBook and can provide that also. Would really appreciate some help in getting the last leg of this project sorted! Thanks in advance Tim

econpy commented 9 years ago

I can help out here -- you have a simple problem. Inspecting the requests on your Bookworm, your error is that the Apache user doesn't have read access to your database:

OperationalError: (1045, "Access denied for user 'www-data'@'localhost' (using password: NO)")

The request that reveals this error is the API call:

http://54.153.174.142/cgi-bin/dbbindings.py?query=%7B%22groups%22%3A%5B%22date_year%22%5D%2C%22counttype%22%3A%22WordsPerMillion%22%2C%22words_collation%22%3A%22Case_Sensitive%22%2C%22database%22%3A%22mccallum%22%2C%22search_limits%22%3A%5B%7B%22word%22%3A%5B%22test%22%5D%2C%22date_year%22%3A%7B%22%24gte%22%3A2012%2C%22%24lte%22%3A2023%7D%7D%5D%2C%22method%22%3A%22return_json%22%7D

You need to:

GRANT SELECT ON *.* TO 'www-data'@'localhost';
FLUSH PRIVILEGES;

It is probably wiser to only grant select privileges to www-data@localhost on the DB for this Bookworm rather than every database on the SQL server. For example:

GRANT SELECT ON mccallum.* TO 'www-data'@'localhost';
FLUSH PRIVILEGES;
tpmccallum commented 9 years ago

Hi Thanks for your help, I really appreciate it.

I tried that but it still has the same error, I went further and tried the following but the same error still appears (even after restarting apache and mysql)

drop user'mccallum'@'localhost' drop user 'www-data'@'localhost'

CREATE USER 'mccallum'@'localhost' IDENTIFIED BY 'password'; CREATE USER 'www-data'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON mccallum.* TO 'mccallum'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON mccallum.* TO 'www-data'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH PRIVILEGES;

any ideas would be greatly appreciated!

tpmccallum commented 9 years ago

I found that adding a password to the my.cnf file worked eg: sudo vi /etc/mysql/my.cnf

[client] user = www-data password = password port = 3306 socket = /var/run/mysqld/mysqld.sock

Is there a better way to provide the www-data password to the application without storing it in this file? I tried putting the info in the ~/.my.cnf file but it did not work

tpmccallum commented 9 years ago

apart from not being sure where to place the password (for security reasons), I am going to close this ticket. I guess that is more of a SysAdmin thing anyway.