feat: init

This commit is contained in:
2026-03-31 17:21:33 +02:00
commit 0b7deee59e
10 changed files with 498 additions and 0 deletions

25
backend/docker_utils.py Normal file
View File

@@ -0,0 +1,25 @@
import os
from fastapi import APIRouter, HTTPException
router = APIRouter()
NOMADNET_CONTAINER = os.environ.get("NOMADNET_CONTAINER", "nomadnet")
@router.post("/restart")
async def restart_nomadnet():
try:
import docker
client = docker.from_env()
container = client.containers.get(NOMADNET_CONTAINER)
container.restart()
return {"status": "restarted", "container": NOMADNET_CONTAINER}
except docker.errors.NotFound:
raise HTTPException(
status_code=404,
detail=f"Container '{NOMADNET_CONTAINER}' not found",
)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))