1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00
No description
Find a file
2017-10-26 15:51:10 +02:00
accounts add migration userattributes.can_clone_instances dafaults to True 2017-10-26 10:10:52 +02:00
computes Merge remote-tracking branch 'andrem/master' 2016-03-23 10:54:25 +01:00
conf Updated Python dependencies 2016-03-30 16:24:22 +03:00
console fix STATIC_URL in templates. static urls should be generated by "static" template tag 2017-06-06 14:49:11 +02:00
create Fix typos 2016-06-02 13:47:48 +02:00
dev Update libvirt-bootstrap.sh 2016-04-04 14:52:14 +05:00
instances users with can_clone_instances ability are allowed to change_options of vm 2017-10-26 15:51:10 +02:00
interfaces request.user.is_authenticated() substitued for @login_required decorator 2015-12-22 15:09:02 +01:00
logs logs view adds paging ability 2016-03-23 10:38:33 +01:00
networks request.user.is_authenticated() substitued for @login_required decorator 2015-12-22 15:09:02 +01:00
secrets request.user.is_authenticated() substitued for @login_required decorator 2015-12-22 15:09:02 +01:00
static add js.cookie.js to base.html 2016-05-06 10:55:24 +02:00
storages request.user.is_authenticated() substitued for @login_required decorator 2015-12-22 15:09:02 +01:00
templates disable page reloading while migrating vm and pleaseWaitDialog is displayed 2017-03-09 15:14:38 +01:00
vrtManager added new feature: create and attach new volume to existing instance 2017-07-19 15:34:03 +02:00
webvirtcloud UserAttributes.default_instances moved to django.conf.settings.NEW_USER_DEFAULT_INSTANCES 2017-10-05 08:08:04 +02:00
.gitignore ignore db.sqlite3* (backups, dumps) 2017-10-05 08:30:15 +02:00
.travis.yml Cleaned some places 2015-04-21 17:13:53 +03:00
Dockerfile Dockerization 2015-10-15 20:47:10 +08:00
gunicorn.conf.py Update gunicorn.conf.py 2015-10-29 13:37:39 +05:00
manage.py Initial commit 2015-02-27 10:53:51 +02:00
README.md wsgi.py customized for use mod_wsgi with apache module 2015-12-22 15:04:23 +01:00
Vagrantfile Moved all to virtualenv 2015-06-16 08:49:30 +03:00

WebVirtCloud Beta

Features

  • User can add SSH public key to root in Instance (Tested only Ubuntu)
  • User can change root password in Instance (Tested only Ubuntu)

Warning!!!

How to update gstfsd daemon on hypervisor:

wget -O - https://clck.ru/9VMRH | sudo tee -a /usr/local/bin/gstfsd
sudo service supervisor restart

Description

WebVirtCloud is a virtualization web interface for admins and users. It can delegate Virtual Machine's to users. A noVNC viewer presents a full graphical console to the guest domain. KVM is currently the only hypervisor supported.

Install WebVirtCloud panel (Ubuntu)

sudo apt-get -y install git python-virtualenv python-dev libxml2-dev libvirt-dev zlib1g-dev nginx supervisor libsasl2-modules gcc pkg-config
git clone https://github.com/retspen/webvirtcloud
cd webvirtcloud
sudo cp conf/supervisor/webvirtcloud.conf /etc/supervisor/conf.d
sudo cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d
cd ..
sudo mv webvirtcloud /srv
sudo chown -R www-data:www-data /srv/webvirtcloud
cd /srv/webvirtcloud
virtualenv venv
source venv/bin/activate
pip install -r conf/requirements.txt
python manage.py migrate
sudo chown -R www-data:www-data /srv/webvirtcloud
sudo rm /etc/nginx/sites-enabled/default

Restart services for running WebVirtCloud:

sudo service nginx restart
sudo service supervisor restart

Setup libvirt and KVM on server

wget -O - https://clck.ru/9V9fH | sudo sh

Install WebVirtCloud panel (CentOS)

sudo yum -y install python-virtualenv python-devel libvirt-devel glibc gcc nginx supervisor libxml2 libxml2-devel git

Creating directories and cloning repo

sudo mkdir /srv && cd /srv
sudo git clone https://github.com/retspen/webvirtcloud && cd webvirtcloud

Start installation webvirtcloud

sudo virtualenv venv
sudo source venv/bin/activate
sudo venv/bin/pip install -r conf/requirements.txt
sudo cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
sudo venv/bin/python manage.py migrate

Configure the supervisor for CentOS

Add the following after the [include] line (after **files = ... ** actually):

sudo vim /etc/supervisord.conf

[program:webvirtcloud]
command=/srv/webvirtcloud/venv/bin/gunicorn webvirtcloud.wsgi:application -c /srv/webvirtcloud/gunicorn.conf.py
directory=/srv/webvirtcloud
user=nginx
autostart=true
autorestart=true
redirect_stderr=true

[program:novncd]
command=/srv/webvirtcloud/venv/bin/python /srv/webvirtcloud/console/novncd
directory=/srv/webvirtcloud
user=nginx
autostart=true
autorestart=true
redirect_stderr=true

Edit the nginx.conf file

You will need to edit the main nginx.conf file as the one that comes from the rpm's will not work. Comment the following lines:

#    server {
#        listen       80 default_server;
#        listen       [::]:80 default_server;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
#        location / {
#        }
#
#        error_page 404 /404.html;
#            location = /40x.html {
#        }
#
#        error_page 500 502 503 504 /50x.html;
#            location = /50x.html {
#        }
#    }
}

Also make sure file in /etc/nginx/conf.d/webvirtcloud.conf has the proper paths:

upstream gunicorn_server {
    #server unix:/srv/webvirtcloud/venv/wvcloud.socket fail_timeout=0;
    server 127.0.0.1:8000 fail_timeout=0;
}
server {
    listen 80;

    server_name servername.domain.com;
    access_log /var/log/nginx/webvirtcloud-access_log; 

    location /static/ {
        root /srv/webvirtcloud;
        expires max;
    }

    location / {
        proxy_pass http://gunicorn_server;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Forwarded-Proto $remote_addr;
        proxy_connect_timeout 600;
        proxy_read_timeout 600;
        proxy_send_timeout 600;
        client_max_body_size 1024M;
    }
}

Change permissions so nginx can read the webvirtcloud folder:

sudo chown -R nginx:nginx /srv/webvirtcloud

Change permission for selinux:

sudo semanage fcontext -a -t httpd_sys_content_t "/srv/webvirtcloud(/.*)"

Add required user to the kvm group:

sudo usermod -G kvm -a webvirtmgr

Let's restart nginx and the supervisord services:

sudo systemctl restart nginx && systemctl restart supervisord

And finally, check everything is running:

sudo supervisorctl status

novncd                           RUNNING    pid 24186, uptime 2:59:14
webvirtcloud                     RUNNING    pid 24185, uptime 2:59:14

Apache mod_wsgi configuration

WSGIDaemonProcess webvirtcloud threads=2 maximum-requests=1000 display-name=webvirtcloud
WSGIScriptAlias / /srv/webvirtcloud/webvirtcloud/wsgi.py

Install final required packages for libvirtd and others on Host Server

wget -O - https://clck.ru/9V9fH | sudo sh

Done!!

Go to http://serverip and you should see the login screen.

Default credentials

login: admin
password: admin

How To Update

git pull
python manage.py migrate
sudo service supervisor restart

License

WebVirtCloud is licensed under the Apache Licence, Version 2.0.