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

WebVirtMgr with MySQL on CentOS 6.5 and nginx setup notes #247

Closed
open-cloud-builder opened this issue Feb 26, 2014 · 1 comment
Closed

Comments

@open-cloud-builder
Copy link

Privjet,

First: Thank you for this great GUI.
Second: I have no experience in Django or Python, so I struggled with the setup.

I´m trying to set up WebVirtMgr with a MySQL db so I can use a HA MySQL DB backend. The goal is to have multiply redundand WebVirtMgr instances via ucarp with
identical settings & users on different hosts. In this scenario multiply hosts and
vm´s in the cluster can fail, still giving you a nice frontend to manage the
remaining hosts via a nice single web interface and ip/hostname without a complex
full cloud engine.

I´m using Centos 6.5 in this test. I skip the steps to configure a MySQL master/master
setup and ucarp.

Before starting edit the db backend in webvirtmgr/settings.py and settings_jenkins.py

You can enter the creditals for your ucarped master/master mysql db here.

Important changes:

'ENGINE': 'django.db.backends.mysql',
'NAME': 'webvirtmgr',

"NAME" here is the db name not a path. You first must create the db on your mysql server manually.

This further setup needs mysql-python.

python-pip install mysql-python didn´t work, so I used:

yum install MySQL-python

Continue with the steps in the current documentation for CentOS.


I will be using the official nginx repo with the latest nginx for CentOS from here:
http://wiki.nginx.org/Install

In this setup the default www base dir is not "/var/www" but "/usr/share/nginx/html"

So the setup step in the documentation is not

cp /var/www/webvirtmgr/conf/initd/webvirtmgr-novnc-redhat /etc/init.d/webvirtmgr-novnc

but

cp /usr/share/nginx/html/conf/initd/webvirtmgr-novnc-redhat /etc/init.d/webvirtmgr-novnc

Since this is a nginx server running

service webvirtmgr-novnc start

results in
chown: invalid user: `apache'

Therefor edit the webvirtmgr-novnc file:

nano /etc/init.d/webvirtmgr-novnc

Change
username="apache"
to
username="nginx" and save

Change
exec="/var/www/webvirtmgr/console/$prog"
to
exec="/usr/share/nginx/html/console/$prog"

Change the owner & group of "/var/run/webvirtmgr/" to the nginx user/group (498/497)

The novnc service can now start.

service webvirtmgr-novnc start

The documentation is missing the service registering, run:

chkconfig --add webvirtmgr-novnc

chkconfig webvirtmgr-novnc on

The novnc service can now start on every reboot.


The mentioned /etc/supervisor.conf don´t exist, but there is a /etc/supervisord.conf

So change it instead:

nano /etc/supervisord.conf

The correct settings for a nginx setup are:

[program:webvirtmgr]
command=/usr/bin/python /usr/share/nginx/html/manage.py run_gunicorn -c /usr/share/nginx/html/conf/gunicorn.conf.py
directory=/usr/share/nginx/html
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr.log
redirect_stderr=true
user=nginx


To enter the site you first must start supervisord:

service supervisord start

The supervisord is not enabled to start in the default setup (see "#chkconfig --list"),
enable it to start on each reboot:

chkconfig supervisord on


You must remove the default config for nginx afther adding webvirtmgr.conf
run:

mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak

Then run:

service nginx restart

Follow the other steps in the documentation accordingly.
You can now log in and use WebVirtMgr with ngingx and mysql on CentOS.

@retspen
Copy link
Owner

retspen commented Feb 27, 2014

Thanks! Nice article.

@retspen retspen closed this as completed Apr 29, 2014
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