- Configure Traefik v3 with Dynu provider for Let's Encrypt challenges - Implement up.sh for automated network setup and service deployment - Scaffold services (Dozzle, Gitea, Ollama) with standardized labels - Initialize FastAPI dashboard with Docker SDK integration - Update README with new architecture and local domain mapping
27 lines
853 B
Python
27 lines
853 B
Python
import docker
|
|
from fastapi import FastAPI
|
|
|
|
app = FastAPI()
|
|
client = docker.from_env()
|
|
|
|
|
|
@app.get("/api/services")
|
|
def get_services():
|
|
services = []
|
|
# Filter for containers in our specific network
|
|
for container in client.containers.list(all=True):
|
|
networks = container.attrs["NetworkSettings"]["Networks"]
|
|
if "proxy-net" in networks:
|
|
services.append(
|
|
{
|
|
"name": container.name,
|
|
"status": container.status, # running, exited, etc.
|
|
"image": container.image.tags[0] if container.image.tags else "N/A",
|
|
"hostname": container.labels.get(
|
|
f"traefik.http.routers.{container.name}.rule",
|
|
"No Hostname",
|
|
),
|
|
}
|
|
)
|
|
return services
|