Skip to content

Commit 8128924

Browse files
committed
Improve docs
1 parent 2d8c9d2 commit 8128924

4 files changed

Lines changed: 76 additions & 5 deletions

File tree

Fedora.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## Diable cockpit
2+
- ``systemctl disable --now cockpit.socket``
3+
14
## Install packages
25
- gcc
36
- python3-devel
@@ -38,8 +41,48 @@ Note: connecting may take some time
3841
- ``virsh net-start br0``
3942
- ``virsh net-autostart br0``
4043

44+
## Download VmManager
45+
```
46+
#!/usr/bin/env bash
47+
48+
# Authorize to GitHub to get the latest release tar.gz
49+
# Requires: oauth token, https://help.github.com/articles/creating-an-access-token-for-command-line-use/
50+
# Requires: jq package to parse json
51+
52+
# Your oauth token goes here, see link above
53+
OAUTH_TOKEN="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"
54+
# Repo owner (user id)
55+
OWNER="macOS-KVM"
56+
# Repo name
57+
REPO="VmManager"
58+
# The file name expected to download. This is deleted before curl pulls down a new one
59+
FILE_NAME="VmManager-build.zip"
60+
61+
# Concatenate the values together for a
62+
API_URL="https://$OAUTH_TOKEN:@api.github.com/repos/$OWNER/$REPO"
63+
64+
# Gets info on latest release, gets first uploaded asset id of a release,
65+
# More info on jq being used to parse json: https://stedolan.github.io/jq/tutorial/
66+
ASSET_ID=$(curl $API_URL/releases/latest | jq -r '.assets[0].id')
67+
echo "Asset ID: $ASSET_ID"
68+
69+
# curl does not allow overwriting file from -O, nuke
70+
rm -f $FILE_NAME
71+
72+
# curl:
73+
# -O: Use name provided from endpoint
74+
# -J: "Content Disposition" header, in this case "attachment"
75+
# -L: Follow links, we actually get forwarded in this request
76+
# -H "Accept: application/octet-stream": Tells api we want to dl the full binary
77+
curl -O -J -L -H "Accept: application/octet-stream" "$API_URL/releases/assets/$ASSET_ID"
78+
```
79+
80+
4181
## Install python modules
4282
- ``pip3 install -r requirements.txt``
4383

44-
## Start VmManager
45-
- ``python3 VmManager.py``
84+
## Disable firewall
85+
- ``systemctl disable --now firewalld``
86+
87+
## Done
88+
- Follow the instructions in the README.md file to run VmManager

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,30 @@ Web UI for managing libvirt based virtual machines
44
## Usage (production)
55
- Download the latest release
66
- Extract the archive
7+
- Run `python3 init_database.py`
78
- Run `gunicorn --worker-class gevent -w 1 main:app --bind :80`
89

910
## Usage (development)
1011
- Download the source code
12+
- Run `python3 init_database.py`
1113
- Run `python3 main.py`
14+
15+
## Run as a service
16+
- Create a file named `VmManager.service` in `/etc/systemd/system/`
17+
- Copy the following content into the file
18+
```
19+
[Unit]
20+
Description=VmManager
21+
After=multi-user.target
22+
[Service]
23+
Type=simple
24+
Restart=always
25+
ExecStart=gunicorn --worker-class gevent -w 1 main:app --bind :80
26+
WorkingDirectory=/path/to/VmManager
27+
[Install]
28+
WantedBy=multi-user.target
29+
```
30+
- Replace `/path/to/VmManager` with the path to the VmManager directory
31+
- Run `systemctl daemon-reload`
32+
- Run `systemctl enable --now VmManager.service`
33+
- Run `systemctl status VmManager.service` to check if the service is running

backend/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,9 +2252,14 @@ class api_host_system_info(Resource):
22522252
def get(self, action):
22532253
if action == "all":
22542254
sysInfo = ET.fromstring(conn.getSysinfo(0))
2255-
baseboard_manufacturer = sysInfo.find("baseBoard/entry[@name='manufacturer']").text
2256-
baseboard_product = sysInfo.find("baseBoard/entry[@name='product']").text
2257-
baseboard_version = sysInfo.find("baseBoard/entry[@name='version']").text
2255+
# if baseboard exists in sysinfo
2256+
baseboard_manufacturer = "Unknown"
2257+
baseboard_product = ""
2258+
baseboard_version = ""
2259+
if sysInfo.find("baseBoard") is not None:
2260+
baseboard_manufacturer = sysInfo.find("baseBoard/entry[@name='manufacturer']").text
2261+
baseboard_product = sysInfo.find("baseBoard/entry[@name='product']").text
2262+
baseboard_version = sysInfo.find("baseBoard/entry[@name='version']").text
22582263
processor_version = sysInfo.find("processor/entry[@name='version']").text
22592264
memory_size = sysInfo.find("memory_device/entry[@name='size']").text
22602265
return {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ flask-jwt-extended
1212
python-pam
1313
gevent
1414
gunicorn
15+
LibvirtKVMBackup

0 commit comments

Comments
 (0)