gereksiz Projeler sekmesini kaldir, ana sayfa artik tum containerlar+kaynak kullanimi
Deploy / deploy (push) Successful in 41s
Deploy / deploy (push) Successful in 41s
This commit is contained in:
@@ -128,33 +128,6 @@ def port_summary(info):
|
|||||||
return ", ".join(out) if out else None
|
return ", ".join(out) if out else None
|
||||||
|
|
||||||
|
|
||||||
def list_projects():
|
|
||||||
out = subprocess.run(
|
|
||||||
["docker", "ps", "-a", "--filter", "label=traefik.enable=true", "--format", "{{.ID}}"],
|
|
||||||
capture_output=True, text=True, check=True,
|
|
||||||
).stdout.split()
|
|
||||||
|
|
||||||
projects = []
|
|
||||||
for cid in out:
|
|
||||||
info = inspect_all(cid)
|
|
||||||
name = info["Name"].lstrip("/")
|
|
||||||
if name == SELF_NAME:
|
|
||||||
continue
|
|
||||||
labels = info["Config"]["Labels"] or {}
|
|
||||||
state = info["State"]
|
|
||||||
status = state["Status"]
|
|
||||||
when = human_relative(state.get("StartedAt") if status == "running" else state.get("FinishedAt"))
|
|
||||||
projects.append({
|
|
||||||
"name": name,
|
|
||||||
"hostname": extract_hostname(labels),
|
|
||||||
"status": status,
|
|
||||||
"since": when,
|
|
||||||
"image": info["Config"]["Image"],
|
|
||||||
})
|
|
||||||
projects.sort(key=lambda p: p["name"])
|
|
||||||
return projects
|
|
||||||
|
|
||||||
|
|
||||||
def list_all_containers():
|
def list_all_containers():
|
||||||
out = subprocess.run(
|
out = subprocess.run(
|
||||||
["docker", "ps", "-a", "--format", "{{.ID}}"],
|
["docker", "ps", "-a", "--format", "{{.ID}}"],
|
||||||
@@ -329,13 +302,12 @@ BASE_STYLE = """
|
|||||||
|
|
||||||
NAV = """
|
NAV = """
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/" class="{{ 'active' if page == 'projects' else '' }}">Projeler</a>
|
<a href="/" class="{{ 'active' if page == 'containers' else '' }}">Container'lar</a>
|
||||||
<a href="/containers" class="{{ 'active' if page == 'containers' else '' }}">Tüm Container'lar</a>
|
|
||||||
<a href="/system" class="{{ 'active' if page == 'system' else '' }}">Sistem & Disk</a>
|
<a href="/system" class="{{ 'active' if page == 'system' else '' }}">Sistem & Disk</a>
|
||||||
</nav>
|
</nav>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PROJECTS_TEMPLATE = """
|
CONTAINERS_TEMPLATE = """
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@@ -347,7 +319,7 @@ PROJECTS_TEMPLATE = """
|
|||||||
<body>
|
<body>
|
||||||
<h1>Deploy Panel</h1>
|
<h1>Deploy Panel</h1>
|
||||||
""" + NAV + """
|
""" + NAV + """
|
||||||
<div class="sub">{{ projects|length }} proje · 20 saniyede bir otomatik yenilenir · <a href="/">şimdi yenile</a></div>
|
<div class="sub">{{ containers|length }} container · 20 saniyede bir otomatik yenilenir · <a href="/">şimdi yenile</a></div>
|
||||||
|
|
||||||
<div class="stats">
|
<div class="stats">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
@@ -380,53 +352,6 @@ PROJECTS_TEMPLATE = """
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if projects %}
|
|
||||||
<table>
|
|
||||||
<tr><th>Proje</th><th>Adres</th><th>Durum</th><th>İmaj</th><th></th></tr>
|
|
||||||
{% for p in projects %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ p.name }}</td>
|
|
||||||
<td>{% if p.hostname %}<a href="https://{{ p.hostname }}" target="_blank">{{ p.hostname }}</a>{% else %}—{% endif %}</td>
|
|
||||||
<td>
|
|
||||||
<span class="badge {{ p.status }}">{{ p.status }}</span>
|
|
||||||
{% if p.since %}<span class="since">{{ p.since }}</span>{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>{{ p.image }}</td>
|
|
||||||
<td>
|
|
||||||
<div class="actions">
|
|
||||||
<a class="btn btn-logs" href="/logs/{{ p.name }}">Loglar</a>
|
|
||||||
<form method="post" action="/restart/{{ p.name }}">
|
|
||||||
<button class="btn-restart" type="submit">Yeniden Başlat</button>
|
|
||||||
</form>
|
|
||||||
<form method="post" action="/delete/{{ p.name }}"
|
|
||||||
onsubmit="return confirm('{{ p.name }} silinsin mi? Container ve DNS kaydı kalıcı olarak kaldırılacak.');">
|
|
||||||
<button class="btn-delete" type="submit">Sil</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<p class="empty">Henüz deploy edilmiş bir proje yok.</p>
|
|
||||||
{% endif %}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
|
||||||
|
|
||||||
CONTAINERS_TEMPLATE = """
|
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Container'lar - Deploy Panel</title>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="refresh" content="20">
|
|
||||||
<style>""" + BASE_STYLE + """</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Deploy Panel</h1>
|
|
||||||
""" + NAV + """
|
|
||||||
<div class="sub">Sunucudaki TÜM container'lar (sadece Traefik projeleri değil) · {{ containers|length }} adet</div>
|
|
||||||
{% if containers %}
|
{% if containers %}
|
||||||
<table>
|
<table>
|
||||||
<tr><th>İsim</th><th>Adres</th><th>Portlar</th><th>Durum</th><th>İmaj</th><th></th></tr>
|
<tr><th>İsim</th><th>Adres</th><th>Portlar</th><th>Durum</th><th>İmaj</th><th></th></tr>
|
||||||
@@ -574,12 +499,9 @@ LOGS_TEMPLATE = """
|
|||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
return render_template_string(PROJECTS_TEMPLATE, projects=list_projects(), s=server_stats(), page="projects")
|
return render_template_string(
|
||||||
|
CONTAINERS_TEMPLATE, containers=list_all_containers(), s=server_stats(), page="containers"
|
||||||
|
)
|
||||||
@app.route("/containers")
|
|
||||||
def containers_ui():
|
|
||||||
return render_template_string(CONTAINERS_TEMPLATE, containers=list_all_containers(), page="containers")
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/system")
|
@app.route("/system")
|
||||||
|
|||||||
Reference in New Issue
Block a user