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

Deploy cannot connect to mysql #27

Closed
jameslzhu opened this issue Jan 18, 2019 · 4 comments
Closed

Deploy cannot connect to mysql #27

jameslzhu opened this issue Jan 18, 2019 · 4 comments

Comments

@jameslzhu
Copy link
Member

Fabric attempts to connect through the default socket file: /var/run/mysql/mysql.sock. However this is non-existent on the OCF apphost.

TODO: research how the default mysql command connects to the mariadb server, and setup django to use that instead of the socket. (Or find the socket file.)

@jameslzhu jameslzhu added the bug label Jan 18, 2019
@jvperrin
Copy link
Member

This should be possible through just using the hostname mysql (as mentioned in the docs) and the account username/password. The mysql command I believe uses /etc/mysql/my.cnf for configuration, which just has this:

[client]
host=mysql
password

@jvperrin
Copy link
Member

https://stackoverflow.com/a/29655281 might be relevant, not sure how much that would help. Does fabric need to connect from the machine you are deploying from, or does it connect from where the django app is being deployed to?

@jameslzhu
Copy link
Member Author

Hm, it looks more like a deployed project issue than a fabric issue. The fabfile (https://github.com/compserv/hknweb/blob/deploy/fabfile.py) doesn’t do anything with MySQL.

In hknweb/settings/common.py (https://github.com/compserv/hknweb/blob/863407747d1f4e0cbfb5212354c8f4eb5d37e8d9/hknweb/settings/common.py), the DATABASES variable should be responsible for the MySQL settings, but right now (I’m the deploy branch) I’ve only set HOST and NAME (the database name), and leaned on the MySQL config file hierarchy for user credentials.

@jameslzhu
Copy link
Member Author

Fixed! eec0971

Among other things, I specified the mysql conf file at ~/.my.cnf on the apphost, and the mysql host name mysql.

This does break the mysql connection on the Vagrant VM, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants