feat: add VPS Monitor backend and frontend services
Some checks failed
Build and Push Docker Images / docker (push) Failing after 5s

- Create systemd service for VPS Monitor agent.
- Add FastAPI backend with endpoints for managing VPS configurations and statuses.
- Implement Dockerfile for backend service with required dependencies.
- Create frontend using React with Vite and Tailwind CSS for styling.
- Add API client for communicating with the backend.
- Implement components for displaying VPS information and logs.
- Set up Docker Compose for orchestrating backend and frontend services.
- Add environment configuration files for backend and agent.
- Implement CORS support in the backend for frontend communication.
This commit is contained in:
jeanotx32
2026-05-18 22:31:36 -04:00
parent f83f8f97fa
commit cf0b3f0acf
28 changed files with 1601 additions and 16 deletions

View File

@@ -0,0 +1,42 @@
const BASE = '/api'
export async function fetchAllStatus() {
const res = await fetch(`${BASE}/status`)
if (!res.ok) throw new Error(`HTTP ${res.status}`)
return res.json()
}
export async function fetchLogs(vpsId, containerId, lines = 200) {
const res = await fetch(`${BASE}/vps/${vpsId}/containers/${containerId}/logs?lines=${lines}`)
if (!res.ok) throw new Error(`HTTP ${res.status}`)
return res.json()
}
export async function containerAction(vpsId, containerId, action) {
const res = await fetch(`${BASE}/vps/${vpsId}/containers/${containerId}/action`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action }),
})
if (!res.ok) throw new Error(`HTTP ${res.status}`)
return res.json()
}
export async function addVps(data) {
const res = await fetch(`${BASE}/vps`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
if (!res.ok) {
const err = await res.json().catch(() => ({}))
throw new Error(err.detail ?? `HTTP ${res.status}`)
}
return res.json()
}
export async function deleteVps(vpsId) {
const res = await fetch(`${BASE}/vps/${vpsId}`, { method: 'DELETE' })
if (!res.ok) throw new Error(`HTTP ${res.status}`)
return res.json()
}