4d9979354c | ||
---|---|---|
hypenv | ||
log | ||
storage/iso | ||
tools | ||
web | ||
README.md | ||
hype.py |
README.md
Hype
About
A simple interface in flask and python3, to mange and get a status of my vm and lxc containers.
Using the python3-lxc and libvirt to communcate with lxc/kvm api.
Creation need also the lxc-templates.
Login
Be carefull !! By default, the authentification is PAM. This PAM auth is based on the library simplepam. This means that by default, the allowed users, are the user in the server.
Install
Some requirements are needed :
Ubuntu/Debian:
Using basic package in apt debian repositories.
The script will install software dependencies, create a virtual environnement "hype_env" and download all Python dependancies in ths virtual env.
python3 -m venv hype_env --system-site-packages
Just launch the Debian install script :
In root or sudo user :
root$ chmod +x Debian_install.sh
root$ sh ./Debian_install.sh
Network
By default, Libvirt use a default network setting, creating a private LAN:
<network>
<name>default</name>
<bridge name='virbr0'/>
<forward/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
</ip>
</network>
If you want the server to be linked to you LAN, create a Bridge interface. For example in Debian (here eth0 is the main interface)
In /etc/network/interface :
allow-hotplug eth0
auto br0
iface br0 inet static
bridge_ports eth0
bridge_fd 0
bridge_maxwait 0
address 192.168.XX.XX
netmask 255.255.255.0
gateway 192.168.XX.XX
Restart the network manager and check if you can see your interface called br0.
You have then, to create a bridge interface in Libvirt:
<network>
<name>bridged</name>
<forward mode="bridge" />
<bridge name="br0" />
</network>
Then enable anc activate this interface :
virsh net-define bridge.xml
virsh net-start bridged
virsh net-autostart bridged
Don't forget to map this network on Virtual Server Creation.
Start
Debian install script, will create a virtual environement. To start in this venv :
#. hype_env/bin/activate
(hype_env)#python3 hype.py
Ensure that you are in the Virtal env, else you will not be able to user required python libs.
Then go on your browser :
http://{{IP}}:5005
WebTerminal
The Containers are accessible thought a Web Terminal.
It use the librairy PyXtermJS
The install script will change : - host listening from 127.0.0.1 to 0.0.0.0
The install script will keep the previous files *.save. just move the .save to original name to rollback.
Port configuration
- By default, the script run :
- 5005 for the website
- 5000 for the Terminal interface
- Please check your own configuration (firewall, proxy, reverse-proxy)
Roadmap
- Update Changelog
- Add Console
- Add VM
- Add Storage View
- Add ISO (upload/use)
- Add VM creation
- Add forced stop on VM (when shutdown is not enought)
- Add Snapshot Management:
- Creation
- Restore
- Delete
- Add Info:
- lxc/vm
- system ressources (?)
- Storage :
- improve Pool location
- Correct Pool issue in case of manual deletion
- Monitoring :
- improve CPU and RAM
- Network :
- Correct IPv4 issue for VM
- Interface :
- Adding Dashboard
- Drivers :
- Check CD Driver and manage it (add/remove/change)
To do :
- Console:
- Improve Xterm integration to avoid many ports
- Network :
- Add IPv6 address
- Add Interfaces
Sources / Resources
LIBVIRT (KVM/QEMU) https://libvirt.org/
PYXTERMJS : virtual Terminal https://github.com/cs01/pyxtermjs
LXC https://linuxcontainers.org/lxc/ https://github.com/lxc/python3-lxc