Hype/README.md

200 lines
4.2 KiB
Markdown
Raw Normal View History

2023-06-22 13:30:22 +00:00
# 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.
![ScreenShot](./tools/images/screenshot.png)
![ScreenShot2](./tools/images/Login.png)
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/) [![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/) [![AGPL License](https://img.shields.io/badge/license-AGPL-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)
## Login
Be carefull !!
By default, the authentification is PAM.
This PAM auth is based on the library [simplepam](https://github.com/leonnnn/python3-simplepam).
This means that by default, the allowed users, are the user in the server.
## Install
Some requirements are needed :
```sh
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:
```ss
<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 :
```sh
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:
```sh
<network>
<name>bridged</name>
<forward mode="bridge" />
<bridge name="br0" />
</network>
```
Then enable anc activate this interface :
```sh
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 :
```sh
#. 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 :
```sh
http://{{IP}}:5005
```
## WebTerminal
The Containers are accessible thought a Web Terminal.
It use the librairy [PyXtermJS](https://github.com/cs01/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
- [x] Update Changelog
- [x] Add Console
- [x] Add VM
- [x] Add Storage View
- [x] Add ISO (upload/use)
- [x] Add VM creation
- [x] Add forced stop on VM (when shutdown is not enought)
- [x] Add Snapshot Management:
- [x] Creation
- [x] Restore
- [x] Delete
- [x] Add Info:
- [x] lxc/vm
- [x] system ressources (?)
- [x] Storage :
- [x] improve Pool location
- [x] Correct Pool issue in case of manual deletion
- [x] Monitoring :
- [x] improve CPU and RAM
- [x] Network :
- [x] Correct IPv4 issue for VM
- [x] Interface :
- [x] Adding Dashboard
- [x] Drivers :
- [x] 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