This commit is contained in:
ilyastar9999
2025-12-02 19:47:32 +03:00
parent 30e923578c
commit d137f66314
2 changed files with 7 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ POSTGRES_DB=adctrl
SECRET_TOKEN=asdasdasd SECRET_TOKEN=asdasdasd
# Services Directory (where managed services will be stored) # Services Directory (where managed services will be stored)
SERVICES_DIR=./services SERVICES_DIR=/root/services
# Scoreboard Configuration # Scoreboard Configuration
SCOREBOARD_WS_URL=ws://10.60.0.1:8080/api/events SCOREBOARD_WS_URL=ws://10.60.0.1:8080/api/events

View File

@@ -110,10 +110,14 @@ async def create_service(service: ServiceCreate):
if not os.path.exists(service_path): if not os.path.exists(service_path):
raise HTTPException(status_code=404, detail=f"Service path not found: {service_path}") raise HTTPException(status_code=404, detail=f"Service path not found: {service_path}")
# Check if docker-compose.yml exists # Check if docker-compose file exists (yml or yaml)
compose_file = os.path.join(service_path, "docker-compose.yml") compose_file = os.path.join(service_path, "docker-compose.yml")
if not os.path.exists(compose_file): if not os.path.exists(compose_file):
raise HTTPException(status_code=404, detail=f"docker-compose.yml not found in {service_path}") compose_file = os.path.join(service_path, "docker-compose.yaml")
if not os.path.exists(compose_file):
compose_file = os.path.join(service_path, "compose.yml")
if not os.path.exists(compose_file):
raise HTTPException(status_code=404, detail=f"docker-compose file not found in {service_path}")
service_id = await conn.fetchval( service_id = await conn.fetchval(
"INSERT INTO services (name, path, git_url, status) VALUES ($1, $2, $3, $4) RETURNING id", "INSERT INTO services (name, path, git_url, status) VALUES ($1, $2, $3, $4) RETURNING id",