Compare commits
No commits in common. "614c16750dda6b174752de71b8de7ba7b1d50a3c" and "50e7693e9ae8ae2b70a17dbc3a3fcdc96788d11a" have entirely different histories.
614c16750d
...
50e7693e9a
2
.vscode/settings.json
vendored
Normal file
2
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
import docker
|
||||
|
||||
client = docker.from_env()
|
||||
for container in client.containers.list():
|
||||
if container.name == "thsf":
|
||||
print("[+] Rebooting container<br>")
|
||||
print(" '-> Stopping container<br>")
|
||||
container.stop()
|
||||
print(" '-> Starting container<br>")
|
||||
container.start()
|
||||
print("[\o/] Container restarted<br>")
|
||||
|
@ -1,13 +0,0 @@
|
||||
function reboot() {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
document.getElementById("logs").innerHTML = this.responseText;
|
||||
}
|
||||
};
|
||||
xhttp.open("GET", "https://www.thsf.net/maintenance/reboot.py", true);
|
||||
xhttp.send();
|
||||
setTimeout(function () {
|
||||
document.location="https://www.thsf.net/maintenance/status.py"}, 5000
|
||||
);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
import docker
|
||||
import jinja2
|
||||
|
||||
base_path = "/var/www/www.thsf.net/thsf.net/maintenance/templates"
|
||||
status_template = "status.html"
|
||||
|
||||
env = jinja2.Environment(loader=jinja2.FileSystemLoader(base_path),
|
||||
autoescape=True)
|
||||
template = env.get_template(status_template)
|
||||
|
||||
client = docker.from_env()
|
||||
for container in client.containers.list():
|
||||
if container.name == "thsf":
|
||||
cont = dict()
|
||||
cont["name"] = container.name
|
||||
cont["status"] = container.status
|
||||
cont["log"] = container.logs().decode('utf-8').replace('\n', '<br>')
|
||||
print(template.render(containers=[container]))
|
@ -1,59 +0,0 @@
|
||||
.body {
|
||||
|
||||
}
|
||||
.page_wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
text-align: center;
|
||||
padding-bottom: 5em;
|
||||
background-color: red;
|
||||
}
|
||||
.center_wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
background-color: blue;
|
||||
}
|
||||
.container_list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
background-color: yellow;
|
||||
}
|
||||
.table_headers, .line {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: green;
|
||||
}
|
||||
.header, .status {
|
||||
font-weight: bold;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
background-color: violet;
|
||||
}
|
||||
.table_content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
background-color: cyan;
|
||||
}
|
||||
.status {
|
||||
font-weight: normal;
|
||||
}
|
||||
.container_log {
|
||||
|
||||
}
|
||||
.button {
|
||||
font-weight: bold;
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang='zxx'>
|
||||
<head>
|
||||
<title>THSF 2023: Status page</title>
|
||||
<meta name="viewport" content="initial-scale=1.0">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<script src="/maintenance/scripts/maintenance.js"></script>
|
||||
<link rel="stylesheet"
|
||||
href="/maintenance/style/maintenance.css">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="page_wrapper">
|
||||
<div class="center_wrapper">
|
||||
<div class="container_list">
|
||||
<div class="table_headers">
|
||||
<div class="header">Name</div>
|
||||
<div class="header">Status</div>
|
||||
<div class="header">Action</div>
|
||||
</div>
|
||||
<div class="table_content">
|
||||
{% for container in containers %}
|
||||
<div class="line">
|
||||
<div class="status">{{ container.name }}</div>
|
||||
<div class="status">{{ container.status }}</div>
|
||||
<div class="status">
|
||||
<i class="button fa-regular fa-recycle" onclick=""></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container_log" id="logs">
|
||||
{{ container.logs }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Before Width: | Height: | Size: 55 KiB |
Loading…
Reference in New Issue
Block a user