1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00
webvirtcloud/README.md

244 lines
6.3 KiB
Markdown
Raw Normal View History

2015-05-21 12:07:55 +00:00
## WebVirtCloud Beta
## Features
2015-05-27 13:41:08 +00:00
* User can add SSH public key to root in Instance (Tested only Ubuntu)
* User can change root password in Instance (Tested only Ubuntu)
* Supports cloud-init datasource interface
2015-05-27 13:41:08 +00:00
### Warning!!!
2015-06-03 05:18:47 +00:00
How to update <code>gstfsd</code> daemon on hypervisor:
2015-05-27 13:41:08 +00:00
```bash
wget -O - https://clck.ru/9VMRH | sudo tee -a /usr/local/bin/gstfsd
sudo service supervisor restart
```
2015-03-27 14:17:28 +00:00
### Description
2015-08-19 13:16:32 +00:00
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.
2015-03-27 14:17:28 +00:00
### Generate secret key
You should generate SECRET_KEY after cloning repo. Then put it into webvirtcloud/settings.py.
```python
import random, string
haystack = string.ascii_letters + string.digits + string.punctuation
print(''.join([random.SystemRandom().choice(haystack) for _ in range(50)]))
```
2015-07-31 21:12:53 +00:00
### Install WebVirtCloud panel (Ubuntu)
2015-03-27 14:17:28 +00:00
```bash
sudo apt-get -y install git python-virtualenv python-dev python-lxml libvirt-dev zlib1g-dev nginx supervisor libsasl2-modules gcc pkg-config python-guestfs
2015-03-27 14:17:28 +00:00
git clone https://github.com/retspen/webvirtcloud
2015-05-08 07:43:43 +00:00
cd webvirtcloud
cp webvirtcloud/settings.py.template webvirtcloud/settings.py
# now put secret key to webvirtcloud/settings.py
2015-03-27 14:17:28 +00:00
sudo cp conf/supervisor/webvirtcloud.conf /etc/supervisor/conf.d
sudo cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d
cd ..
2015-06-16 05:49:30 +00:00
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
2015-06-27 13:38:10 +00:00
sudo chown -R www-data:www-data /srv/webvirtcloud
sudo rm /etc/nginx/sites-enabled/default
2015-03-27 14:17:28 +00:00
```
Restart services for running WebVirtCloud:
```bash
sudo service nginx restart
sudo service supervisor restart
```
2015-03-27 14:23:49 +00:00
2015-07-31 21:12:53 +00:00
Setup libvirt and KVM on server
2015-03-27 14:23:49 +00:00
```bash
2015-05-19 19:39:47 +00:00
wget -O - https://clck.ru/9V9fH | sudo sh
2015-03-27 14:23:49 +00:00
```
2015-03-27 14:32:33 +00:00
2015-07-31 21:12:53 +00:00
### Install WebVirtCloud panel (CentOS)
2015-07-31 21:16:53 +00:00
```bash
sudo yum -y install python-virtualenv python-devel libvirt-devel glibc gcc nginx supervisor python-lxml git python-libguestfs
2015-07-31 21:12:53 +00:00
```
#### Creating directories and cloning repo
2015-07-31 21:16:53 +00:00
```bash
sudo mkdir /srv && cd /srv
sudo git clone https://github.com/retspen/webvirtcloud && cd webvirtcloud
cp webvirtcloud/settings.py.template webvirtcloud/settings.py
# now put secret key to webvirtcloud/settings.py
2015-07-31 21:12:53 +00:00
```
#### Start installation webvirtcloud
```
2015-07-31 21:16:53 +00:00
sudo virtualenv venv
sudo source venv/bin/activate
2015-10-29 06:25:37 +00:00
sudo venv/bin/pip install -r conf/requirements.txt
2015-07-31 21:16:53 +00:00
sudo cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
2015-10-29 06:25:37 +00:00
sudo venv/bin/python manage.py migrate
2015-07-31 21:12:53 +00:00
```
#### Configure the supervisor for CentOS
Add the following after the [include] line (after **files = ... ** actually):
2015-07-31 21:16:53 +00:00
```bash
sudo vim /etc/supervisord.conf
2015-07-31 21:12:53 +00:00
[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:
```
2015-10-29 08:19:10 +00:00
upstream gunicorn_server {
#server unix:/srv/webvirtcloud/venv/wvcloud.socket fail_timeout=0;
server 127.0.0.1:8000 fail_timeout=0;
}
2015-07-31 21:12:53 +00:00
server {
listen 80;
server_name servername.domain.com;
access_log /var/log/nginx/webvirtcloud-access_log;
location /static/ {
root /srv/webvirtcloud;
expires max;
}
location / {
2015-10-29 08:19:10 +00:00
proxy_pass http://gunicorn_server;
2015-07-31 21:12:53 +00:00
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:
2015-07-31 21:16:53 +00:00
```bash
sudo chown -R nginx:nginx /srv/webvirtcloud
2015-07-31 21:12:53 +00:00
```
2015-08-01 06:42:47 +00:00
Change permission for selinux:
2015-07-31 21:16:53 +00:00
```bash
2015-08-01 06:42:47 +00:00
sudo semanage fcontext -a -t httpd_sys_content_t "/srv/webvirtcloud(/.*)"
2015-07-31 21:12:53 +00:00
```
2015-08-01 06:42:47 +00:00
Add required user to the kvm group:
2015-07-31 21:16:53 +00:00
```bash
2015-08-01 06:42:47 +00:00
sudo usermod -G kvm -a webvirtmgr
2015-07-31 21:12:53 +00:00
```
Let's restart nginx and the supervisord services:
2015-07-31 21:16:53 +00:00
```bash
sudo systemctl restart nginx && systemctl restart supervisord
2015-07-31 21:12:53 +00:00
```
And finally, check everything is running:
2015-07-31 21:16:53 +00:00
```bash
sudo supervisorctl status
2015-07-31 21:12:53 +00:00
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_custom.py
```
2015-08-01 06:42:47 +00:00
#### Install final required packages for libvirtd and others on Host Server
```bash
wget -O - https://clck.ru/9V9fH | sudo sh
```
2015-07-31 21:12:53 +00:00
Done!!
Go to http://serverip and you should see the login screen.
2015-03-27 14:32:33 +00:00
### Default credentials
<pre>
2015-03-27 14:32:33 +00:00
login: admin
password: admin
</pre>
2015-05-18 19:00:30 +00:00
### Cloud-init
Currently supports only root ssh authorized keys and hostname. Example configuration of the cloud-init client follows.
```
datasource:
OpenStack:
metadata_urls: [ "http://webvirtcloud.domain.com/datasource" ]
```
2015-05-18 19:00:30 +00:00
### How To Update
```bash
sudo virtualenv venv
sudo source venv/bin/activate
2015-05-27 13:41:08 +00:00
git pull
2018-07-18 12:09:50 +00:00
pip install -U -r conf/requirements.txt
2015-05-27 13:41:08 +00:00
python manage.py migrate
sudo service supervisor restart
2015-05-18 19:08:14 +00:00
```
2015-10-02 10:51:54 +00:00
### License
WebVirtCloud is licensed under the [Apache Licence, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).