Merge Fixes and Technical changes from development into main branch #1
91
.github/workflows/docker-release.yml
vendored
Normal file
91
.github/workflows/docker-release.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
name: Docker Publish (Release)
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Version tag to publish (e.g. 0.1.2 or v0.1.2)"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Build and Push Docker Images
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Optional repo variable. If unset, DOCKERHUB_USERNAME is used.
|
||||||
|
IMAGE_NAMESPACE: ${{ vars.DOCKERHUB_NAMESPACE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Resolve version/tag
|
||||||
|
id: ver
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
RAW_TAG="${{ github.event.release.tag_name }}"
|
||||||
|
if [ -z "$RAW_TAG" ]; then
|
||||||
|
RAW_TAG="${{ inputs.version }}"
|
||||||
|
fi
|
||||||
|
if [ -z "$RAW_TAG" ]; then
|
||||||
|
RAW_TAG="${GITHUB_REF_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLEAN_TAG="${RAW_TAG#v}"
|
||||||
|
echo "raw=$RAW_TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "clean=$CLEAN_TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Set image namespace
|
||||||
|
id: ns
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
NS="${IMAGE_NAMESPACE}"
|
||||||
|
if [ -z "$NS" ]; then
|
||||||
|
NS="${{ secrets.DOCKERHUB_USERNAME }}"
|
||||||
|
fi
|
||||||
|
if [ -z "$NS" ]; then
|
||||||
|
echo "Missing Docker Hub namespace. Set repo var DOCKERHUB_NAMESPACE or secret DOCKERHUB_USERNAME."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "value=$NS" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push backend image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./backend
|
||||||
|
file: ./backend/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ steps.ns.outputs.value }}/nexapg-backend:${{ steps.ver.outputs.clean }}
|
||||||
|
${{ steps.ns.outputs.value }}/nexapg-backend:latest
|
||||||
|
cache-from: type=registry,ref=${{ steps.ns.outputs.value }}/nexapg-backend:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ steps.ns.outputs.value }}/nexapg-backend:buildcache,mode=max
|
||||||
|
|
||||||
|
- name: Build and push frontend image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./frontend
|
||||||
|
file: ./frontend/Dockerfile
|
||||||
|
push: true
|
||||||
|
build-args: |
|
||||||
|
VITE_API_URL=/api/v1
|
||||||
|
tags: |
|
||||||
|
${{ steps.ns.outputs.value }}/nexapg-frontend:${{ steps.ver.outputs.clean }}
|
||||||
|
${{ steps.ns.outputs.value }}/nexapg-frontend:latest
|
||||||
|
cache-from: type=registry,ref=${{ steps.ns.outputs.value }}/nexapg-frontend:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ steps.ns.outputs.value }}/nexapg-frontend:buildcache,mode=max
|
||||||
@@ -2,7 +2,7 @@ from functools import lru_cache
|
|||||||
from pydantic import field_validator
|
from pydantic import field_validator
|
||||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
|
|
||||||
NEXAPG_VERSION = "0.1.2"
|
NEXAPG_VERSION = "0.1.3"
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ class DiskSpaceProvider:
|
|||||||
class NullDiskSpaceProvider(DiskSpaceProvider):
|
class NullDiskSpaceProvider(DiskSpaceProvider):
|
||||||
async def get_free_bytes(self, target_host: str) -> DiskSpaceProbeResult:
|
async def get_free_bytes(self, target_host: str) -> DiskSpaceProbeResult:
|
||||||
return DiskSpaceProbeResult(
|
return DiskSpaceProbeResult(
|
||||||
source="none",
|
source="agentless",
|
||||||
status="unavailable",
|
status="unavailable",
|
||||||
free_bytes=None,
|
free_bytes=None,
|
||||||
message=f"No infra probe configured for host {target_host}. Add SSH/Agent provider later.",
|
message=f"Agentless mode: host-level free disk is not available for {target_host}.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import { apiFetch } from "../api";
|
import { apiFetch } from "../api";
|
||||||
import { useAuth } from "../state";
|
import { useAuth } from "../state";
|
||||||
|
|
||||||
@@ -62,6 +62,7 @@ function buildQueryTips(row) {
|
|||||||
|
|
||||||
export function QueryInsightsPage() {
|
export function QueryInsightsPage() {
|
||||||
const { tokens, refresh } = useAuth();
|
const { tokens, refresh } = useAuth();
|
||||||
|
const refreshRef = useRef(refresh);
|
||||||
const [targets, setTargets] = useState([]);
|
const [targets, setTargets] = useState([]);
|
||||||
const [targetId, setTargetId] = useState("");
|
const [targetId, setTargetId] = useState("");
|
||||||
const [rows, setRows] = useState([]);
|
const [rows, setRows] = useState([]);
|
||||||
@@ -71,6 +72,10 @@ export function QueryInsightsPage() {
|
|||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
refreshRef.current = refresh;
|
||||||
|
}, [refresh]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
@@ -89,17 +94,26 @@ export function QueryInsightsPage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!targetId) return;
|
if (!targetId) return;
|
||||||
|
let active = true;
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const data = await apiFetch(`/targets/${targetId}/top-queries`, {}, tokens, refresh);
|
const data = await apiFetch(`/targets/${targetId}/top-queries`, {}, tokens, refreshRef.current);
|
||||||
|
if (!active) return;
|
||||||
setRows(data);
|
setRows(data);
|
||||||
setSelectedQuery(data[0] || null);
|
setSelectedQuery((prev) => {
|
||||||
setPage(1);
|
if (!prev) return data[0] || null;
|
||||||
|
const keep = data.find((row) => row.queryid === prev.queryid);
|
||||||
|
return keep || data[0] || null;
|
||||||
|
});
|
||||||
|
setPage((prev) => (prev === 1 ? prev : 1));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(String(e.message || e));
|
if (active) setError(String(e.message || e));
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}, [targetId, tokens, refresh]);
|
return () => {
|
||||||
|
active = false;
|
||||||
|
};
|
||||||
|
}, [targetId, tokens?.accessToken, tokens?.refreshToken]);
|
||||||
|
|
||||||
const dedupedByQueryId = [...rows].reduce((acc, row) => {
|
const dedupedByQueryId = [...rows].reduce((acc, row) => {
|
||||||
if (!row?.queryid) return acc;
|
if (!row?.queryid) return acc;
|
||||||
|
|||||||
@@ -41,6 +41,19 @@ function formatNumber(value, digits = 2) {
|
|||||||
return Number(value).toFixed(digits);
|
return Number(value).toFixed(digits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatHostMetricUnavailable() {
|
||||||
|
return "N/A (agentless)";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDiskSpaceAgentless(diskSpace) {
|
||||||
|
if (!diskSpace) return formatHostMetricUnavailable();
|
||||||
|
if (diskSpace.free_bytes !== null && diskSpace.free_bytes !== undefined) {
|
||||||
|
return formatBytes(diskSpace.free_bytes);
|
||||||
|
}
|
||||||
|
if (diskSpace.status === "unavailable") return formatHostMetricUnavailable();
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
|
||||||
function MetricsTooltip({ active, payload, label }) {
|
function MetricsTooltip({ active, payload, label }) {
|
||||||
if (!active || !payload || payload.length === 0) return null;
|
if (!active || !payload || payload.length === 0) return null;
|
||||||
const row = payload[0]?.payload || {};
|
const row = payload[0]?.payload || {};
|
||||||
@@ -346,6 +359,9 @@ export function TargetDetailPage() {
|
|||||||
{uiMode === "dba" && overview && (
|
{uiMode === "dba" && overview && (
|
||||||
<div className="card">
|
<div className="card">
|
||||||
<h3>Database Overview</h3>
|
<h3>Database Overview</h3>
|
||||||
|
<p className="muted" style={{ marginTop: 2 }}>
|
||||||
|
Agentless mode: host-level CPU, RAM, and free-disk metrics are not available.
|
||||||
|
</p>
|
||||||
<div className="grid three overview-kv">
|
<div className="grid three overview-kv">
|
||||||
<div><span>PostgreSQL Version</span><strong>{overview.instance.server_version || "-"}</strong></div>
|
<div><span>PostgreSQL Version</span><strong>{overview.instance.server_version || "-"}</strong></div>
|
||||||
<div>
|
<div>
|
||||||
@@ -366,8 +382,8 @@ export function TargetDetailPage() {
|
|||||||
<div title="Total WAL directory size (when available)">
|
<div title="Total WAL directory size (when available)">
|
||||||
<span>WAL Size</span><strong>{formatBytes(overview.storage.wal_directory_size_bytes)}</strong>
|
<span>WAL Size</span><strong>{formatBytes(overview.storage.wal_directory_size_bytes)}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div title="Optional metric via future Agent/SSH provider">
|
<div title={overview.storage.disk_space?.message || "Agentless mode: host-level free disk is unavailable."}>
|
||||||
<span>Free Disk</span><strong>{formatBytes(overview.storage.disk_space.free_bytes)}</strong>
|
<span>Free Disk</span><strong>{formatDiskSpaceAgentless(overview.storage.disk_space)}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div title="Replication replay delay on standby">
|
<div title="Replication replay delay on standby">
|
||||||
<span>Replay Lag</span>
|
<span>Replay Lag</span>
|
||||||
@@ -378,6 +394,12 @@ export function TargetDetailPage() {
|
|||||||
<div><span>Replication Slots</span><strong>{overview.replication.replication_slots_count ?? "-"}</strong></div>
|
<div><span>Replication Slots</span><strong>{overview.replication.replication_slots_count ?? "-"}</strong></div>
|
||||||
<div><span>Repl Clients</span><strong>{overview.replication.active_replication_clients ?? "-"}</strong></div>
|
<div><span>Repl Clients</span><strong>{overview.replication.active_replication_clients ?? "-"}</strong></div>
|
||||||
<div><span>Autovacuum Workers</span><strong>{overview.performance.autovacuum_workers ?? "-"}</strong></div>
|
<div><span>Autovacuum Workers</span><strong>{overview.performance.autovacuum_workers ?? "-"}</strong></div>
|
||||||
|
<div title="Host CPU requires OS-level telemetry">
|
||||||
|
<span>Host CPU</span><strong>{formatHostMetricUnavailable()}</strong>
|
||||||
|
</div>
|
||||||
|
<div title="Host RAM requires OS-level telemetry">
|
||||||
|
<span>Host RAM</span><strong>{formatHostMetricUnavailable()}</strong>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid two">
|
<div className="grid two">
|
||||||
|
|||||||
Reference in New Issue
Block a user