diff --git a/docker-compose.yml b/docker-compose.yml index f5bbbce..452699d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,32 +1,47 @@ version: '3.8' services: - vps-agent: - build: . - container_name: vps-ai-agent - restart: unless-stopped - expose: - - "8001" - ports: - - "8001:8001" - # Monta as credenciais e o socket do docker para o Bot conseguir comandar a VPS raiz! - volumes: - - .:/app - - /var/run/docker.sock:/var/run/docker.sock:rw - - /:/host_root:ro # Acesso em leitura à VPS para análise - - ./data:/app/data # Configs dinâmicas (API Keys, etc) - env_file: - - .env - networks: - - coolify - - ollama_net - labels: - - "traefik.enable=true" - - "traefik.http.routers.vps-agent.rule=Host(`claw.reifonas.cloud`)" - - "traefik.http.routers.vps-agent.entrypoints=https" - - "traefik.http.routers.vps-agent.tls=true" - - "traefik.http.routers.vps-agent.tls.certresolver=letsencrypt" - - "traefik.http.services.vps-agent.loadbalancer.server.port=8001" + vps-agent: + build: . + container_name: vps-ai-agent + restart: unless-stopped + expose: + - "8001" + ports: + - "8001:8001" + volumes: + - .:/app + - /var/run/docker.sock:/var/run/docker.sock:rw + - /:/host_root:ro + - ./data:/app/data + env_file: + - .env + networks: + - coolify + - ollama_net + labels: + - "traefik.enable=true" + - "traefik.http.routers.vps-agent.rule=Host(`claw.reifonas.cloud`)" + - "traefik.http.routers.vps-agent.entrypoints=https" + - "traefik.http.routers.vps-agent.tls=true" + - "traefik.http.routers.vps-agent.tls.certresolver=letsencrypt" + - "traefik.http.services.vps-agent.loadbalancer.server.port=8001" + + vnc: + build: ./vnc + container_name: vps-vnc + restart: unless-stopped + ports: + - "6080:6080" + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix:rw + networks: + - coolify + labels: + - "traefik.enable=true" + - "traefik.http.routers.vnc.rule=Host(`vnc.claw.reifonas.cloud`)" + - "traefik.http.routers.vnc.entrypoints=http" + - "traefik.http.services.vnc.loadbalancer.server.port=6080" networks: coolify: diff --git a/main.py b/main.py index a3848e1..3779da7 100644 --- a/main.py +++ b/main.py @@ -120,8 +120,23 @@ async def run_action(data: dict, is_auth: bool = Depends(verify_password)): return {"status": "success", "message": "Cache do servidor limpo com sucesso."} if action_type == "reboot_vps": return {"status": "error", "message": "⚠️ Reboot via Web desabilitado por segurança. Use o terminal SSH."} + if action_type == "toggle_vnc": + import subprocess + result = subprocess.run(["docker", "ps", "-q", "-f", "name=vps-vnc"], capture_output=True, text=True) + if result.stdout.strip(): + subprocess.run(["docker", "stop", "vps-vnc"], capture_output=True) + return {"status": "success", "message": "VNC desligado.", "vnc_status": "off"} + else: + subprocess.run(["docker", "start", "vps-vnc"], capture_output=True) + return {"status": "success", "message": "VNC ligado. https://vnc.claw.reifonas.cloud/vnc.html", "vnc_status": "on"} return {"status": "error", "message": f"Ação {action_type} desconhecida."} +@app.get("/api/vnc_status") +async def vnc_status(): + import subprocess + result = subprocess.run(["docker", "ps", "-q", "-f", "name=vps-vnc"], capture_output=True, text=True) + return {"vnc_status": "on" if result.stdout.strip() else "off"} + @app.get("/api/test_llm") async def test_llm_latency(is_auth: bool = Depends(verify_password)): t0 = time.time() diff --git a/templates/index.html b/templates/index.html index 5cec2aa..da7fd35 100644 --- a/templates/index.html +++ b/templates/index.html @@ -767,13 +767,21 @@ Limpar Cache - - + + +