mirror of
https://github.com/retspen/webvirtcloud
synced 2025-03-13 13:35:17 +00:00
Rename webvirtcloud to webvirt
This commit is contained in:
parent
3488661dc9
commit
5130871248
21 changed files with 45 additions and 99 deletions
20
Dockerfile
20
Dockerfile
|
@ -8,37 +8,37 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -qyy install \
|
||||||
-o APT::Install-Suggests=false \
|
-o APT::Install-Suggests=false \
|
||||||
git python-virtualenv python-dev python-lxml libvirt-dev zlib1g-dev nginx libsasl2-modules
|
git python-virtualenv python-dev python-lxml libvirt-dev zlib1g-dev nginx libsasl2-modules
|
||||||
|
|
||||||
ADD . /srv/webvirtcloud
|
ADD . /srv/webvirt
|
||||||
RUN chown -R www-data:www-data /srv/webvirtcloud
|
RUN chown -R www-data:www-data /srv/webvirt
|
||||||
|
|
||||||
# Setup webvirtcloud
|
# Setup webvirt
|
||||||
RUN cd /srv/webvirtcloud && \
|
RUN cd /srv/webvirt && \
|
||||||
virtualenv venv && \
|
virtualenv venv && \
|
||||||
. venv/bin/activate && \
|
. venv/bin/activate && \
|
||||||
pip install -U pip && \
|
pip install -U pip && \
|
||||||
pip install -r conf/requirements.txt && \
|
pip install -r conf/requirements.txt && \
|
||||||
chown -R www-data:www-data /srv/webvirtcloud
|
chown -R www-data:www-data /srv/webvirt
|
||||||
|
|
||||||
RUN cd /srv/webvirtcloud && . venv/bin/activate && \
|
RUN cd /srv/webvirt && . venv/bin/activate && \
|
||||||
python manage.py migrate && \
|
python manage.py migrate && \
|
||||||
chown -R www-data:www-data /srv/webvirtcloud
|
chown -R www-data:www-data /srv/webvirt
|
||||||
|
|
||||||
# Setup Nginx
|
# Setup Nginx
|
||||||
RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
|
RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
|
||||||
rm /etc/nginx/sites-enabled/default && \
|
rm /etc/nginx/sites-enabled/default && \
|
||||||
chown -R www-data:www-data /var/lib/nginx
|
chown -R www-data:www-data /var/lib/nginx
|
||||||
|
|
||||||
ADD conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
|
ADD conf/nginx/webvirt.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
# Register services to runit
|
# Register services to runit
|
||||||
RUN mkdir /etc/service/nginx && \
|
RUN mkdir /etc/service/nginx && \
|
||||||
mkdir /etc/service/nginx-log-forwarder && \
|
mkdir /etc/service/nginx-log-forwarder && \
|
||||||
mkdir /etc/service/webvirtcloud && \
|
mkdir /etc/service/webvirt && \
|
||||||
mkdir /etc/service/novnc
|
mkdir /etc/service/novnc
|
||||||
ADD conf/runit/nginx /etc/service/nginx/run
|
ADD conf/runit/nginx /etc/service/nginx/run
|
||||||
ADD conf/runit/nginx-log-forwarder /etc/service/nginx-log-forwarder/run
|
ADD conf/runit/nginx-log-forwarder /etc/service/nginx-log-forwarder/run
|
||||||
ADD conf/runit/novncd.sh /etc/service/novnc/run
|
ADD conf/runit/novncd.sh /etc/service/novnc/run
|
||||||
ADD conf/runit/webvirtcloud.sh /etc/service/webvirtcloud/run
|
ADD conf/runit/webvirt.sh /etc/service/webvirt/run
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 6080
|
EXPOSE 6080
|
||||||
|
|
53
Vagrantfile
vendored
53
Vagrantfile
vendored
|
@ -1,53 +0,0 @@
|
||||||
# -*- mode: ruby -*-
|
|
||||||
# vi: set ft=ruby :
|
|
||||||
|
|
||||||
Vagrant.configure(2) do |config|
|
|
||||||
# Default machine, if name not specified...
|
|
||||||
config.vm.define "dev", primary: true do |dev|
|
|
||||||
dev.vm.box = "ubuntu/bionic64"
|
|
||||||
dev.vm.hostname = "webvirtcloud"
|
|
||||||
dev.vm.network "private_network", ip: "192.168.33.10"
|
|
||||||
dev.vm.provision "shell", inline: <<-SHELL
|
|
||||||
sudo sh /vagrant/dev/libvirt-bootstrap.sh
|
|
||||||
sudo sed -i 's/auth_tcp = \"sasl\"/auth_tcp = \"none\"/g' /etc/libvirt/libvirtd.conf
|
|
||||||
sudo service libvirt-bin restart
|
|
||||||
sudo adduser vagrant libvirtd
|
|
||||||
sudo apt-get -y install python-virtualenv python-dev python-lxml libvirt-dev zlib1g-dev
|
|
||||||
virtualenv /vagrant/venv
|
|
||||||
source /vagrant/venv/bin/activate
|
|
||||||
pip install -r /vagrant/dev/requirements.txt
|
|
||||||
SHELL
|
|
||||||
end
|
|
||||||
# To start this machine run "vagrant up prod"
|
|
||||||
# To enter this machine run "vagrant ssh prod"
|
|
||||||
config.vm.define "prod", autostart: false do |prod|
|
|
||||||
prod.vm.box = "ubuntu/bionic64"
|
|
||||||
prod.vm.hostname = "webvirtcloud"
|
|
||||||
prod.vm.network "private_network", ip: "192.168.33.11"
|
|
||||||
#prod.vm.synced_folder ".", "/srv/webvirtcloud"
|
|
||||||
prod.vm.provision "shell", inline: <<-SHELL
|
|
||||||
sudo mkdir /srv/webvirtcloud
|
|
||||||
sudo cp -R /vagrant/* /srv/webvirtcloud
|
|
||||||
sudo sh /srv/webvirtcloud/dev/libvirt-bootstrap.sh
|
|
||||||
sudo sed -i 's/auth_tcp = \"sasl\"/auth_tcp = \"none\"/g' /etc/libvirt/libvirtd.conf
|
|
||||||
sudo service libvirt-bin restart
|
|
||||||
sudo adduser vagrant libvirtd
|
|
||||||
sudo chown -R vagrant:vagrant /srv/webvirtcloud
|
|
||||||
sudo apt-get -y install python-virtualenv python-dev python-lxml python-pip libvirt-dev zlib1g-dev libxslt1-dev nginx supervisor libsasl2-modules gcc pkg-config python-guestfs
|
|
||||||
virtualenv /srv/webvirtcloud/venv
|
|
||||||
source /srv/webvirtcloud/venv/bin/activate
|
|
||||||
pip install -r /srv/webvirtcloud/dev/requirements.txt
|
|
||||||
sudo cp /srv/webvirtcloud/conf/supervisor/webvirtcloud.conf /etc/supervisor/conf.d
|
|
||||||
sudo cp /srv/webvirtcloud/conf/nginx/webvirtcloud.conf /etc/nginx/conf.d
|
|
||||||
sudo cp /srv/webvirtcloud/webvirtcloud/settings.py.template /srv/webvirtcloud/webvirtcloud/settings.py
|
|
||||||
sudo sed "s/SECRET_KEY = ''/SECRET_KEY = '"`python /srv/webvirtcloud/conf/runit/secret_generator.py`"'/" -i /srv/webvirtcloud/webvirtcloud/settings.py
|
|
||||||
python /srv/webvirtcloud/manage.py migrate
|
|
||||||
sudo rm /etc/nginx/sites-enabled/default
|
|
||||||
sudo chown -R www-data:www-data /srv/webvirtcloud
|
|
||||||
sudo service nginx restart
|
|
||||||
sudo service supervisor restart
|
|
||||||
SHELL
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import django
|
||||||
|
|
||||||
DIR_PATH = os.path.dirname(os.path.abspath(__file__))
|
DIR_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||||
ROOT_PATH = os.path.abspath(os.path.join(DIR_PATH, '..', ''))
|
ROOT_PATH = os.path.abspath(os.path.join(DIR_PATH, '..', ''))
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirtcloud.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirt.settings")
|
||||||
CERT = DIR_PATH + '/cert.pem'
|
CERT = DIR_PATH + '/cert.pem'
|
||||||
|
|
||||||
if ROOT_PATH not in sys.path:
|
if ROOT_PATH not in sys.path:
|
||||||
|
@ -22,7 +22,7 @@ django.setup()
|
||||||
import re
|
import re
|
||||||
import http.cookies
|
import http.cookies
|
||||||
import socket
|
import socket
|
||||||
from webvirtcloud.settings import WS_PORT, WS_HOST, WS_CERT
|
from webvirt.settings import WS_PORT, WS_HOST, WS_CERT
|
||||||
from vrtManager.connection import CONN_SSH, CONN_SOCKET
|
from vrtManager.connection import CONN_SSH, CONN_SOCKET
|
||||||
from console.tunnel import Tunnel
|
from console.tunnel import Tunnel
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<link rel="shortcut icon" href="{% static "favicon.ico" %}">
|
<link rel="shortcut icon" href="{% static "favicon.ico" %}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="{% static "css/bootstrap.min.css" %}">
|
<link rel="stylesheet" href="{% static "css/bootstrap.min.css" %}">
|
||||||
<link href="{% static "css/webvirtcloud.css" %}" rel="stylesheet">
|
<link href="{% static "css/webvirt.css" %}" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
|
|
|
@ -3,8 +3,8 @@ from django.shortcuts import render
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from instances.models import Instance
|
from instances.models import Instance
|
||||||
from vrtManager.instance import wvmInstance
|
from vrtManager.instance import wvmInstance
|
||||||
from webvirtcloud.settings import WS_PORT
|
from webvirt.settings import WS_PORT
|
||||||
from webvirtcloud.settings import WS_PUBLIC_HOST
|
from webvirt.settings import WS_PUBLIC_HOST
|
||||||
from libvirt import libvirtError
|
from libvirt import libvirtError
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from create.models import Flavor
|
from create.models import Flavor
|
||||||
from webvirtcloud.settings import QEMU_CONSOLE_LISTEN_ADDRESSES
|
from webvirt.settings import QEMU_CONSOLE_LISTEN_ADDRESSES
|
||||||
|
|
||||||
|
|
||||||
class FlavorAddForm(forms.Form):
|
class FlavorAddForm(forms.Form):
|
||||||
|
|
|
@ -10,9 +10,9 @@ from instances.models import Instance
|
||||||
from vrtManager.create import wvmCreate
|
from vrtManager.create import wvmCreate
|
||||||
from vrtManager import util
|
from vrtManager import util
|
||||||
from libvirt import libvirtError
|
from libvirt import libvirtError
|
||||||
from webvirtcloud.settings import QEMU_CONSOLE_LISTEN_ADDRESSES
|
from webvirt.settings import QEMU_CONSOLE_LISTEN_ADDRESSES
|
||||||
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_CACHE
|
from webvirt.settings import INSTANCE_VOLUME_DEFAULT_CACHE
|
||||||
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_BUS
|
from webvirt.settings import INSTANCE_VOLUME_DEFAULT_BUS
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from logs.views import addlogmsg
|
from logs.views import addlogmsg
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import os
|
||||||
# range.
|
# range.
|
||||||
#
|
#
|
||||||
|
|
||||||
#bind = 'unix:/srv/webvirtcloud/venv/wvcloud.socket'
|
|
||||||
bind = '127.0.0.1:8000'
|
bind = '127.0.0.1:8000'
|
||||||
backlog = 2048
|
backlog = 2048
|
||||||
|
|
||||||
|
|
|
@ -1077,7 +1077,7 @@ def inst_graph(request, compute_id, vname):
|
||||||
|
|
||||||
|
|
||||||
def _get_dhcp_mac_address(vname):
|
def _get_dhcp_mac_address(vname):
|
||||||
dhcp_file = '/srv/webvirtcloud/dhcpd.conf'
|
dhcp_file = '/srv/webvirt/dhcpd.conf'
|
||||||
mac = ''
|
mac = ''
|
||||||
if os.path.isfile(dhcp_file):
|
if os.path.isfile(dhcp_file):
|
||||||
with open(dhcp_file, 'r') as f:
|
with open(dhcp_file, 'r') as f:
|
||||||
|
@ -1119,7 +1119,7 @@ def random_mac_address(request):
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def guess_clone_name(request):
|
def guess_clone_name(request):
|
||||||
dhcp_file = '/srv/webvirtcloud/dhcpd.conf'
|
dhcp_file = '/srv/webvirt/dhcpd.conf'
|
||||||
prefix = settings.CLONE_INSTANCE_DEFAULT_PREFIX
|
prefix = settings.CLONE_INSTANCE_DEFAULT_PREFIX
|
||||||
if os.path.isfile(dhcp_file):
|
if os.path.isfile(dhcp_file):
|
||||||
instance_names = [i.name for i in Instance.objects.filter(name__startswith=prefix)]
|
instance_names = [i.name for i in Instance.objects.filter(name__startswith=prefix)]
|
||||||
|
|
|
@ -3,7 +3,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirtcloud.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirt.settings")
|
||||||
|
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
|
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
|
||||||
|
|
||||||
<!-- WebVirtCloud CSS -->
|
<!-- WebVirtCloud CSS -->
|
||||||
<link href="{% static "css/webvirtcloud.css" %}" rel="stylesheet">
|
<link href="{% static "css/webvirt.css" %}" rel="stylesheet">
|
||||||
|
|
||||||
<!-- Aditional CSS -->
|
<!-- Aditional CSS -->
|
||||||
{% block style %}{% endblock %}
|
{% block style %}{% endblock %}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import string
|
import string
|
||||||
from vrtManager import util
|
from vrtManager import util
|
||||||
from vrtManager.connection import wvmConnect
|
from vrtManager.connection import wvmConnect
|
||||||
from webvirtcloud.settings import QEMU_CONSOLE_DEFAULT_TYPE
|
from webvirt.settings import QEMU_CONSOLE_DEFAULT_TYPE
|
||||||
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_OWNER as default_owner
|
from webvirt.settings import INSTANCE_VOLUME_DEFAULT_OWNER as default_owner
|
||||||
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_FORMAT
|
from webvirt.settings import INSTANCE_VOLUME_DEFAULT_FORMAT
|
||||||
|
|
||||||
|
|
||||||
def get_rbd_storage_data(stg):
|
def get_rbd_storage_data(stg):
|
||||||
|
|
|
@ -10,8 +10,8 @@ from xml.etree import ElementTree
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from vrtManager.connection import wvmConnect
|
from vrtManager.connection import wvmConnect
|
||||||
from vrtManager.storage import wvmStorage
|
from vrtManager.storage import wvmStorage
|
||||||
from webvirtcloud.settings import QEMU_CONSOLE_TYPES
|
from webvirt.settings import QEMU_CONSOLE_TYPES
|
||||||
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_OWNER as owner
|
from webvirt.settings import INSTANCE_VOLUME_DEFAULT_OWNER as owner
|
||||||
|
|
||||||
|
|
||||||
class wvmInstances(wvmConnect):
|
class wvmInstances(wvmConnect):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from vrtManager import util
|
from vrtManager import util
|
||||||
from vrtManager.connection import wvmConnect
|
from vrtManager.connection import wvmConnect
|
||||||
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_OWNER as owner
|
from webvirt.settings import INSTANCE_VOLUME_DEFAULT_OWNER as owner
|
||||||
|
|
||||||
|
|
||||||
class wvmStorages(wvmConnect):
|
class wvmStorages(wvmConnect):
|
||||||
|
|
11
webvirt/settings-dev.py
Normal file
11
webvirt/settings-dev.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
"""
|
||||||
|
Django dev settings for webvirt project.
|
||||||
|
|
||||||
|
HowTo: python manage.py runserver 0:8000 --settings=webvirt.settings-dev
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from webvirt.settings import *
|
||||||
|
|
||||||
|
DEBUG = True
|
||||||
|
TEMPLATE_DEBUG = True
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Django settings for webvirtcloud project.
|
Django settings for webvirt project.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -51,9 +51,9 @@ AUTHENTICATION_BACKENDS = (
|
||||||
|
|
||||||
LOGIN_URL = '/accounts/login'
|
LOGIN_URL = '/accounts/login'
|
||||||
|
|
||||||
ROOT_URLCONF = 'webvirtcloud.urls'
|
ROOT_URLCONF = 'webvirt.urls'
|
||||||
|
|
||||||
WSGI_APPLICATION = 'webvirtcloud.wsgi.application'
|
WSGI_APPLICATION = 'webvirt.wsgi.application'
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
WSGI config for webvirtcloud project.
|
WSGI config for webvirt project.
|
||||||
|
|
||||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirtcloud.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirt.settings")
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
|
@ -1,11 +0,0 @@
|
||||||
"""
|
|
||||||
Django dev settings for webvirtcloud project.
|
|
||||||
|
|
||||||
HowTo: python manage.py runserver 0:8000 --settings=webvirtcloud.settings-dev
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
from webvirtcloud.settings import *
|
|
||||||
|
|
||||||
DEBUG = True
|
|
||||||
TEMPLATE_DEBUG = True
|
|
Loading…
Reference in a new issue