Skip to content

Cestc #697

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

Open
wants to merge 107 commits into
base: master
Choose a base branch
from
Open

Cestc #697

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
c85e92d
1.listen ip changed to 0.0.0.0
Dec 25, 2020
676a12b
1.add update and needs record files.
Dec 25, 2020
96947c9
renew codes
Dec 30, 2020
9a18445
1.change requirements.txt
Jan 5, 2021
8b0a7be
1.add charfiled arch in Computor for arm bare metal.
Jan 5, 2021
9956a43
1.cancel print log
Jan 5, 2021
12f82fb
1.change for docker build
Jan 12, 2021
aff385a
1.update for docker build
Jan 12, 2021
9dd32d9
1.update for docker build
Jan 12, 2021
c053824
1.update for docker build
Jan 12, 2021
0424b4d
1.update for docker build
Jan 12, 2021
6a943e2
1.update for docker build
Jan 13, 2021
26da8ff
1.update for docker build
Jan 13, 2021
9ac5c37
1.update django to 1.8
Jan 13, 2021
2e99e79
1.add start dev docker instance command.
Jan 13, 2021
804f19d
1.change input limit for cpu,mem,hd.
Jan 15, 2021
c2a2400
1.change docker build without cache. because git did not reflash.
Jan 15, 2021
eb0d09b
1.add arch for servers model
Jan 15, 2021
d7f865d
1.django and gunicorn upgrade.change files for it
Jan 15, 2021
db4f526
1.change urls
Jan 15, 2021
d5a63cd
1.change urls
Jan 15, 2021
079fbbb
1.for new django version
Jan 15, 2021
42f517a
1.change for migration files
Jan 18, 2021
0410918
1.add arch for create server databases
Jan 18, 2021
505ee15
1.modify suggest values of mem.
Jan 18, 2021
0f0c7ec
1.add func to create vm in arm64.
Jan 18, 2021
42e5cad
1.modify novnc page for django 1.11
Jan 19, 2021
4e38c88
1.modify novnc page for django 1.11
Jan 19, 2021
84c3068
1.modify novnc service for django 1.11
Jan 20, 2021
3190e03
Merge branch 'master' into cestc
Jan 21, 2021
458f8de
1.change for docker build
Jan 12, 2021
f13973a
1.update for docker build
Jan 12, 2021
fb43521
1.update for docker build
Jan 12, 2021
ef30f68
1.update for docker build
Jan 12, 2021
72c058e
1.update for docker build
Jan 12, 2021
f7560e4
1.update for docker build
Jan 13, 2021
aeafc21
1.request.txt update for django
Jan 13, 2021
d42673a
1.update django to 1.8
Jan 13, 2021
50823a0
1.add start dev docker instance command.
Jan 13, 2021
0af35ce
1.change input limit for cpu,mem,hd.
Jan 15, 2021
e521205
1.change docker build without cache. because git did not reflash.
Jan 15, 2021
ac3e6e1
1.add arch for servers model
Jan 15, 2021
ff9a271
1.django and gunicorn upgrade.change files for it
Jan 15, 2021
d73c8a3
1.change urls
Jan 15, 2021
3f0a604
1.change urls
Jan 15, 2021
2827e25
1.for new django version
Jan 15, 2021
70ed6dd
1.change for migration files
Jan 18, 2021
a2ea791
1.add arch for create server databases
Jan 18, 2021
97b3625
1.modify suggest values of mem.
Jan 18, 2021
de640ff
1.add func to create vm in arm64.
Jan 18, 2021
daba3a1
1.modify novnc page for django 1.11
Jan 19, 2021
52d6c0d
1.modify novnc page for django 1.11
Jan 19, 2021
b5d1bdf
1.modify novnc service for django 1.11
Jan 20, 2021
6cdd191
Merge branch 'cestc' into master
Jan 21, 2021
6a09614
1.update readme
Jan 21, 2021
ed1e705
1.change for docker build
Jan 12, 2021
7243655
1.change input limit for cpu,mem,hd.
Jan 15, 2021
a360f42
1.add arch for servers model
Jan 15, 2021
9e74288
1.update readme
Jan 21, 2021
a08af68
1.update readme
Jan 21, 2021
61d0bd2
1.update readme
Jan 21, 2021
916add1
1.adjust Dockerfile
Jan 21, 2021
f2d59b5
1.cancel arch input
Jan 21, 2021
d230fc7
Merge branch 'cestc' into master
Jan 21, 2021
5cb40df
1.fix bug for v5.0.0
Jan 21, 2021
820cedf
1.add dev of build for v5.0.0
Jan 22, 2021
1c8492e
1.update docker build for v5.0.0
Jan 22, 2021
326b1c9
1.update server page for v5.0.0
Jan 22, 2021
133946a
1.update server page for v5.0.0
Jan 22, 2021
c56199b
1.update i18n for django 1.11
Jan 26, 2021
83b0faa
1.update i18n zh_Hans mo file for django 1.11
Jan 26, 2021
0e36bc8
1.update dockerfile for i18n package
Jan 26, 2021
1643ce0
1.add admin site for dev
Jan 26, 2021
87c18ca
Merge branch 'cestc' into master
Jan 27, 2021
df049df
1.update readme info
Jan 27, 2021
e0c66fc
1.update dockerfile
Jan 27, 2021
3ab3cc3
1.add snapshot for uefi mode for arm
Jan 28, 2021
4de2a47
1.update docker file
Feb 7, 2021
a80470a
1.fix volumes order bug
Feb 7, 2021
3a24331
1.update v5.0.2
Feb 7, 2021
635c9e4
1.add rbac app
Feb 7, 2021
8075dd3
1.add interfaces list
Feb 8, 2021
52834f7
1.change files lf
Feb 26, 2021
2c65195
1.update bootstrap.sh
Feb 26, 2021
6240fcc
1.update bootstrap.sh
Feb 26, 2021
b6109b4
1.update docker boot
Mar 1, 2021
3995e61
1.update for v5.0.4
Mar 1, 2021
e153f2e
1.update ssh keygen
Mar 1, 2021
ffcd568
1.update keygen script
Mar 2, 2021
af44ff1
1.modify readme
Mar 2, 2021
198e404
1.add app rbac
Mar 8, 2021
17e3878
1.fix ssh trust script bug
Mar 9, 2021
a3013fa
1.add login with new permission tables
Mar 10, 2021
71408f3
1.add self login and logout
Mar 11, 2021
bd5b21c
1.add menu and button tables
Mar 19, 2021
6797792
1.modify menu and button tables
Mar 24, 2021
6a42e00
1.fix bug
Mar 24, 2021
a7a9745
1.fix bug
Mar 25, 2021
718e688
1.delete print
Mar 25, 2021
494541a
1.fix bug with overviews graph
Mar 25, 2021
8fb8570
1.fix bugs
Mar 30, 2021
ee776a8
1.fix data in init.json
Mar 30, 2021
d7d8b97
1.fix dockerfile version
Mar 30, 2021
92398e7
1.fix dockerfile bug
Mar 31, 2021
74289be
1.fix dockerfile bug
Mar 31, 2021
00e57c1
1.fix dockerfile bug
Apr 6, 2021
a8ebc86
1.fix file type for linux
Jun 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ webvirtmgr/local/.secret_key_store
webvirtmgr/local/local_settings.py
dist
webvirtmgr.egg-info
migrations/*.py
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: python
python:
- "2.6"
- "2.7"
env:
- DJANGO=1.5.5
install:
- pip install -r dev-requirements.txt
- pip install -r dev-requirements.txt --use-mirrors
script:
- pep8 --exclude=IPy.py --ignore=E501 console hostdetail instance networks servers storages vrtManager
- pyflakes console hostdetail instance networks servers storages vrtManager
Expand Down
52 changes: 52 additions & 0 deletions OPERATIONS
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
创建docker镜像
git clone https://github.com/jxph025319/webvirtmgr.git
cd webvirtmgr/build
或者
cp webvirtmgr/build_dev ~
注意更新目录文件
mv webvirtmgr ~/build_dev

docker build --no-cache -t whharbor.centos.org/centos/webvirtmgr:v1 .

webvirtmgr容器部署
groupadd -g 1010 libvirtd
useradd -u 1010 -g libvirtd -s /sbin/nologin -d /data/vm webvirtmgr
chown -R webvirtmgr:libvirtd /data/vm
# 默認賬號密碼為root/Cestc_01

开发部署命令
docker run -d --name webvirtmgr_dev -h webvirtmgr_dev -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime --privileged=true -v /data/vm1:/data/vm -p 2100:22 -p 8080:8080 -p 6080:6080 -m 4g whharbor.cestc.cn/centos/webvirtmgr:v5.0.5 /usr/sbin/init
生产部署命令
docker run -d --name webvirtmgr -h webvirtmgr -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime --privileged=true -v /data/vm:/data/vm -p 8080:8080 -p 6080:6080 -m 4g whharbor.cestc.cn/centos/webvirtmgr:v6.0.0


docker实例内信任部署:
chown -R webvirtmgr:libvirtd /data/vm
su - webvirtmgr -s /bin/bash
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
touch ~/.ssh/config && echo -e "StrictHostKeyChecking=no\nUserKnownHostsFile=/dev/null" >> ~/.ssh/config
chmod 0600 ~/.ssh/config

删除数据库文件和用户
rm -rf /data/vm
userdel webvirtmgr

針對客戶物理機的操作
su - webvirtmgr -s /bin/bash
ssh-copy-id [email protected]

宿主机创建信任
docker exec -it webvirtmgr_dev su - webvirtmgr -c "ssh-keygen -t rsa"
docker exec -it webvirtmgr_dev su - webvirtmgr -c "sshpass -p yHTq58js\&s9C\!ceV ssh-copy-id -o StrictHostKeyChecking=no [email protected]"

初始化admin 账号密码
echo "from rbac.models import UserInfo as User ; User.objects.create_superuser('admin', 'admin@localhost', 'Cestc_01')" | /usr/bin/python /opt/webvirtmgr/manage.py shell

国际化
python manage.py makemessages -l zh_Hans
vim /opt/webvirtmgr/locale/zh_Hans/LC_MESSAGES/django.po
python manage.py compilemessages --locale /opt/webvirtmgr/locale/zh_Hans

备份和还原数据库
python manage.py dumpdata rbac > init.json
python manage.py loaddata init.json
55 changes: 5 additions & 50 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,56 +1,11 @@
=========================
WebVirtMgr panel - v4.8.9
WebVirtMgr panel - v6.0.0
=========================
-------
New project like WebVirtMgr with User Management and Filesystem management - `WebVirtCloud <https://github.com/retspen/webvirtcloud>`_
-------

-------
Warning
更新信息
-------

In latest version app `console/webvirtmgr-novnc` move to `console/webvirtmgr-console` you need check your supervisor settings.

----------
Whats new?
----------

- Added RPM specs (Thanks: `Edoardo Spadoni <https://github.com/edospadoni>`_)
- Added support SPICE, SSH Tunnel, fixed some bugs (Thanks: `brenard <https://github.com/brenard>`_)
- Responsive design (Thanks: `Michel Käser <https://github.com/MaddinXx>`_)
- Added VNC WebSocket support (Thanks: `Tolbkni Kao <https://github.com/tolbkni>`_)
- Added novnc proxy supporting new websockify versions (Thanks: `casell <https://github.com/casell>`_)
- Added support `TLS <http://libvirt.org/remote.html#Remote_certificates>`_ connection (Thanks: `junkb <https://github.com/junkb>`_)
- `Puppet module to control libvirt/kvm <https://github.com/ITBlogger/puppet-kvm>`_ (Thanks: `Alex Scoble <https://github.com/ITBlogger>`_)
- `Deployment via Fabric/Fabtools <https://github.com/retspen/webvirtmgr/tree/master/deploy/fabric>`_ (Thanks: `Mohab Usama <https://github.com/mohabusama>`_)

Screenshots
-----------
`Show <https://github.com/retspen/webvirtmgr/wiki/Screenshots>`_


Introduction
------------

WebVirtMgr is a libvirt-based Web interface for managing virtual machines. It allows you to create and configure new domains, and adjust a domain's resource allocation. A VNC viewer presents a full graphical console to the guest domain. KVM is currently the only hypervisor supported.

Technology:
***********

The application logic is written in Python & Django. The LIBVIRT Python bindings are used to interacting with the underlying hypervisor.

Installation (Only web panel)
-----------------------------

`Install WebVirtMgr <https://github.com/retspen/webvirtmgr/wiki/Install-WebVirtMgr>`_


Setup host server (Server for VM's)
-----------------------------------

`Setup Host Server <https://github.com/retspen/webvirtmgr/wiki/Setup-Host-Server>`_

License
*******

WebVirtMgr is licensed under the `Apache Licence, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0.html>`_.
1、对页面、菜单和按钮新增权限,默认对使用者分成2组,管理员和viewer。
2、新增对虚拟机添加和删除磁盘功能,其中删除必须在虚拟机关闭后才可以。
3、调整国际化
Binary file added appinterfaces.xlsx
Binary file not shown.
11 changes: 11 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ ! -f "/data/vm/webvirtmgr.sqlite3" ]; then
#chown webvirtmgr /var/run/libvirt/libvirt-sock
#/usr/bin/python /opt/webvirtmgr/manage.py syncdb --noinput
/usr/bin/python /opt/webvirtmgr/manage.py makemigrations && /usr/bin/python /opt/webvirtmgr/manage.py migrate
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@localhost', 'Cestc_01')" | /usr/bin/python /opt/webvirtmgr/manage.py shell
/usr/bin/python /opt/webvirtmgr/manage.py loaddata /opt/webvirtmgr/init.json
chown -R webvirtmgr:libvirtd /data/vm
fi

28 changes: 28 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM centos:centos7.4.1708
MAINTAINER Jiajun Chen<[email protected]>

RUN yum -y install epel-release vim openssh-clients openssh-server net-tools sshpass && \
yum -y install python2-pip python-devel libvirt-python libxml2-python git novnc python-websockify numpy supervisor gettext && \
yum clean all && rm -rf /var/cache/yum
RUN echo cestc01 | passwd --stdin root
RUN git clone -b cestc https://github.com/jxph025319/webvirtmgr.git /opt/webvirtmgr
WORKDIR /opt/webvirtmgr
RUN git checkout v6.0.0
RUN pip install -r requirements.txt
#ADD local_settings.py /opt/webvirtmgr/webvirtmgr/local/local_settings.py
#RUN sed -i 's/0.0.0.0/172.17.42.1/g' vrtManager/create.py
RUN /usr/bin/python /opt/webvirtmgr/manage.py collectstatic --noinput
RUN cp build/webvirtmgr.ini /etc/supervisord.d/webvirtmgr.ini && mkdir -p /data/vm/ && \
cp /opt/webvirtmgr/build/local_settings.py /opt/webvirtmgr/webvirtmgr/local/local_settings.py
#ADD gunicorn.conf.py /opt/webvirtmgr/conf/gunicorn.conf.py
#ADD bootstrap.sh /opt/webvirtmgr/bootstrap.sh

#RUN groupadd -g 1010 libvirtd && useradd webvirtmgr -g libvirtd -u 1010 -d /data/vm/ -s /sbin/nologin
RUN groupadd -g 1010 libvirtd && useradd webvirtmgr -g libvirtd -u 1010 -d /data/vm/ && chown webvirtmgr:libvirtd -R /opt/webvirtmgr && echo cestc01 | passwd --stdin webvirtmgr

WORKDIR /opt/webvirtmgr
VOLUME /data/vm

EXPOSE 8080
EXPOSE 6080
CMD ["supervisord", "-n"]
10 changes: 10 additions & 0 deletions build/local_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/data/vm/webvirtmgr.sqlite3',
}
}


17 changes: 17 additions & 0 deletions build/webvirtmgr.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[program:webvirtmgr]
command=/bin/sh -c "bash /opt/webvirtmgr/bootstrap.sh 2>&1 > boot.log && /usr/bin/gunicorn -c /opt/webvirtmgr/conf/gunicorn.conf.py webvirtmgr.wsgi"
directory=/opt/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/tmp/sup_webvirtmgr.log
stderr_logfile=/tmp/sup_webvirtmgr_err.log
user=webvirtmgr

[program:webvirtmgr-console]
command=/usr/bin/python /opt/webvirtmgr/console/webvirtmgr-console
directory=/opt/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/tmp/sup_webvirtmgr-console.log
stderr_logfile=/tmp/sup_webvirtmgr-console_err.log
user=webvirtmgr
29 changes: 29 additions & 0 deletions build_dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM whharbor.centos.org/centos/bash:v1
MAINTAINER Jiajun Chen<[email protected]>

RUN yum -y install epel-release vim sshpass && \
yum -y install python2-pip python-devel libvirt-python libxml2-python git novnc python-websockify numpy supervisor gettext && \
yum clean all && rm -rf /var/cache/yum

#RUN git clone -b cestc https://github.com/jxph025319/webvirtmgr.git /opt/webvirtmgr
COPY webvirtmgr /opt/webvirtmgr
WORKDIR /opt/webvirtmgr
#RUN git checkout v5.0.2
RUN pip install -r requirements.txt
#ADD local_settings.py /opt/webvirtmgr/webvirtmgr/local/local_settings.py
#RUN sed -i 's/0.0.0.0/172.17.42.1/g' vrtManager/create.py
RUN /usr/bin/python /opt/webvirtmgr/manage.py collectstatic --noinput
RUN cp build/webvirtmgr.ini /etc/supervisord.d/webvirtmgr.ini && mkdir -p /data/vm/.ssh && \
cp /opt/webvirtmgr/build/local_settings.py /opt/webvirtmgr/webvirtmgr/local/local_settings.py
#ADD gunicorn.conf.py /opt/webvirtmgr/conf/gunicorn.conf.py
#ADD bootstrap.sh /opt/webvirtmgr/bootstrap.sh

#RUN groupadd -g 1010 libvirtd && useradd webvirtmgr -g libvirtd -u 1010 -d /data/vm/ -s /sbin/nologin
RUN groupadd -g 1010 libvirtd && useradd webvirtmgr -g libvirtd -u 1010 -d /data/vm/ && chown webvirtmgr:libvirtd -R /opt/webvirtmgr

WORKDIR /opt/webvirtmgr
VOLUME /data/vm

EXPOSE 8080
EXPOSE 6080
CMD ["supervisord", "-n"]
10 changes: 10 additions & 0 deletions build_dev/local_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/data/vm/webvirtmgr.sqlite3',
}
}


17 changes: 17 additions & 0 deletions build_dev/webvirtmgr.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[program:webvirtmgr]
command=/bin/sh -c "bash /opt/webvirtmgr/bootstrap.sh 2>&1 > boot.log && /usr/bin/gunicorn -c /opt/webvirtmgr/conf/gunicorn.conf.py webvirtmgr.wsgi"
directory=/opt/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/tmp/sup_webvirtmgr.log
stderr_logfile=/tmp/sup_webvirtmgr_err.log
user=webvirtmgr

[program:webvirtmgr-console]
command=/usr/bin/python /opt/webvirtmgr/console/webvirtmgr-console
directory=/opt/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/tmp/sup_webvirtmgr-console.log
stderr_logfile=/tmp/sup_webvirtmgr-console_err.log
user=webvirtmgr
Loading