Import source: src/api/mocks/seed

Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
This commit is contained in:
arsam
2026-09-18 23:10:01 +03:30
parent 383bcdc8cd
commit 5536933de0
+572
View File
@@ -0,0 +1,572 @@
import { subDays, subHours } from "date-fns";
import { rolePermissions } from "@/lib/permissions";
import type {
AuditEntry,
Automation,
Backup,
Database,
DnsRecord,
Domain,
FileEntry,
HostingAccount,
Mailbox,
MetricPoint,
Notification,
ResourceUsage,
RuntimeDefinition,
SecurityFinding,
Server,
ServiceStatus,
User,
Website,
} from "@/api/contracts/models";
const now = new Date("2026-06-12T12:00:00Z");
const iso = (date: Date) => date.toISOString();
export const currentUser: User = {
id: "usr-1",
name: "Mara Ellis",
email: "mara@coaxys.example",
role: "Super administrator",
permissions: rolePermissions["Super administrator"],
lastLogin: iso(subHours(now, 2)),
avatarInitials: "ME",
twoFactorEnabled: true,
};
export const accounts: HostingAccount[] = [
{
id: "acct-main",
username: "coaxys",
primaryDomain: "example.com",
homeDirectory: "/home/coaxys",
sharedIp: "198.51.100.24",
dedicatedIp: "203.0.113.15",
theme: "light",
},
{
id: "acct-shop",
username: "storeops",
primaryDomain: "store.example.com",
homeDirectory: "/home/storeops",
sharedIp: "198.51.100.31",
theme: "system",
},
];
export const servers: Server[] = [
{
id: "srv-dal-01",
name: "Dallas Web 01",
hostname: "srv-dal-01.coaxys.net",
os: "AlmaLinux 9.6",
panelVersion: "CoaxysPanel 2026.6",
load: [0.38, 0.44, 0.41],
ipAddress: "198.51.100.24",
status: "healthy",
location: "Dallas, US",
},
{
id: "srv-nyc-02",
name: "New York Apps 02",
hostname: "srv-nyc-02.coaxys.net",
os: "Ubuntu 24.04 LTS",
panelVersion: "CoaxysPanel 2026.6",
load: [1.12, 0.91, 0.78],
ipAddress: "203.0.113.22",
status: "warning",
location: "New York, US",
},
];
export const websites: Website[] = [
{
id: "alpha-site",
name: "Alpha Marketing",
domain: "example.com",
runtime: "PHP",
status: "healthy",
ssl: "healthy",
repository: "git@example.com:alpha/marketing.git",
environment: "production",
cpuLimit: "2 vCPU",
memoryLimit: "2 GB",
lastDeployment: iso(subHours(now, 5)),
},
{
id: "docs-hub",
name: "Docs Hub",
domain: "docs.example.com",
runtime: "Node.js",
status: "healthy",
ssl: "healthy",
repository: "git@example.com:alpha/docs.git",
environment: "production",
cpuLimit: "1 vCPU",
memoryLimit: "1 GB",
lastDeployment: iso(subDays(now, 1)),
},
{
id: "preview-api",
name: "Preview API",
domain: "api.preview.example.com",
runtime: "Docker",
status: "warning",
ssl: "warning",
environment: "staging",
cpuLimit: "1 vCPU",
memoryLimit: "768 MB",
lastDeployment: iso(subHours(now, 9)),
},
];
export const domains: Domain[] = [
{
id: "example.com",
name: "example.com",
type: "primary",
documentRoot: "/home/coaxys/public_html",
sslStatus: "healthy",
dnssec: true,
propagation: 98,
},
{
id: "docs.example.com",
name: "docs.example.com",
type: "subdomain",
documentRoot: "/home/coaxys/docs",
sslStatus: "healthy",
dnssec: false,
propagation: 100,
},
{
id: "legacy-example.net",
name: "legacy-example.net",
type: "alias",
documentRoot: "/home/coaxys/public_html",
sslStatus: "warning",
dnssec: false,
propagation: 73,
},
];
export const dnsRecords: DnsRecord[] = [
{
id: "dns-1",
name: "example.com.",
ttl: 14400,
class: "IN",
type: "A",
record: "198.51.100.24",
},
{
id: "dns-2",
name: "www.example.com.",
ttl: 14400,
class: "IN",
type: "CNAME",
record: "example.com.",
},
{
id: "dns-3",
name: "example.com.",
ttl: 14400,
class: "IN",
type: "MX",
record: "mail.example.com.",
priority: 10,
},
{
id: "dns-4",
name: "example.com.",
ttl: 3600,
class: "IN",
type: "TXT",
record: "v=spf1 mx include:_spf.coaxys.net ~all",
},
{
id: "dns-5",
name: "_dmarc.example.com.",
ttl: 3600,
class: "IN",
type: "TXT",
record: "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com",
},
{
id: "dns-6",
name: "api.example.com.",
ttl: 300,
class: "IN",
type: "A",
record: "198.51.100.30",
warning: "Low TTL is useful for cutovers but increases DNS traffic.",
},
];
export const files: FileEntry[] = [
{
id: "file-1",
name: "public_html",
path: "/home/coaxys/public_html",
type: "directory",
size: 0,
modifiedAt: iso(subHours(now, 3)),
owner: "coaxys",
permissions: "0755",
mime: "inode/directory",
},
{
id: "file-2",
name: "index.php",
path: "/home/coaxys/public_html/index.php",
type: "file",
size: 4192,
modifiedAt: iso(subHours(now, 2)),
owner: "coaxys",
permissions: "0644",
mime: "application/x-httpd-php",
},
{
id: "file-3",
name: ".env",
path: "/home/coaxys/public_html/.env",
type: "file",
size: 824,
modifiedAt: iso(subDays(now, 2)),
owner: "coaxys",
permissions: "0600",
mime: "text/plain",
hidden: true,
},
{
id: "file-4",
name: "assets",
path: "/home/coaxys/public_html/assets",
type: "directory",
size: 0,
modifiedAt: iso(subDays(now, 4)),
owner: "coaxys",
permissions: "0755",
mime: "inode/directory",
},
{
id: "file-5",
name: "nginx-site.conf",
path: "/home/coaxys/config/nginx-site.conf",
type: "file",
size: 2130,
modifiedAt: iso(subHours(now, 8)),
owner: "coaxys",
permissions: "0640",
mime: "text/nginx",
},
];
export const databases: Database[] = [
{
id: "db-1",
name: "coaxys_wp",
engine: "MariaDB",
size: 827_000_000,
users: ["coaxys_wp"],
tables: 46,
connections: 8,
lastBackup: iso(subHours(now, 7)),
},
{
id: "db-2",
name: "coaxys_app",
engine: "PostgreSQL",
size: 1_420_000_000,
users: ["app_rw", "app_ro"],
tables: 82,
connections: 19,
lastBackup: iso(subDays(now, 1)),
},
];
export const mailboxes: Mailbox[] = [
{
id: "mail-1",
address: "admin@example.com",
domain: "example.com",
used: 1_200_000_000,
quota: 5_000_000_000,
lastLogin: iso(subHours(now, 1)),
forwarding: true,
spamScore: 1.8,
authStatus: "healthy",
},
{
id: "mail-2",
address: "support@example.com",
domain: "example.com",
used: 4_600_000_000,
quota: 5_000_000_000,
lastLogin: iso(subDays(now, 2)),
forwarding: false,
spamScore: 4.1,
authStatus: "warning",
},
];
export const resourceUsage: ResourceUsage[] = [
{ key: "disk", label: "Disk usage", used: 37, limit: 100, unit: "GB", status: "healthy" },
{
key: "bandwidth",
label: "Bandwidth",
used: 642,
limit: 1000,
unit: "GB",
status: "healthy",
},
{ key: "cpu", label: "CPU usage", used: 38, limit: 100, unit: "%", status: "healthy" },
{ key: "memory", label: "Memory usage", used: 71, limit: 100, unit: "%", status: "warning" },
{
key: "processes",
label: "Process count",
used: 42,
limit: 120,
unit: "",
status: "healthy",
},
{ key: "entry", label: "Entry processes", used: 9, limit: 25, unit: "", status: "healthy" },
{ key: "inodes", label: "Inodes", used: 231000, limit: 500000, unit: "", status: "healthy" },
{ key: "db", label: "Database storage", used: 2.2, limit: 20, unit: "GB", status: "healthy" },
{ key: "email", label: "Email storage", used: 5.8, limit: 15, unit: "GB", status: "warning" },
{
key: "backup",
label: "Backup storage",
used: 68,
limit: 200,
unit: "GB",
status: "healthy",
},
];
export const services: ServiceStatus[] = [
{
name: "Web server",
status: "healthy",
uptime: "41 days",
detail: "nginx + Apache proxy responding normally",
},
{
name: "PHP-FPM",
status: "healthy",
uptime: "14 days",
detail: "Pools healthy across 7 domains",
},
{
name: "Database",
status: "healthy",
uptime: "41 days",
detail: "MariaDB and PostgreSQL accepting connections",
},
{ name: "DNS", status: "healthy", uptime: "41 days", detail: "Authoritative zones loaded" },
{
name: "Email",
status: "warning",
uptime: "18 days",
detail: "Queue has 14 deferred messages",
},
{ name: "Redis", status: "healthy", uptime: "8 days", detail: "Object cache online" },
{ name: "Queue", status: "healthy", uptime: "3 days", detail: "Workers processing normally" },
{ name: "Firewall", status: "healthy", uptime: "41 days", detail: "Rules synchronized" },
{ name: "Backup service", status: "healthy", uptime: "41 days", detail: "Last run verified" },
{
name: "Monitoring service",
status: "healthy",
uptime: "41 days",
detail: "All probes reporting",
},
];
export const metrics: MetricPoint[] = Array.from({ length: 24 }, (_, index) => ({
timestamp: iso(subHours(now, 23 - index)),
cpu: 25 + ((index * 7) % 42),
memory: 48 + ((index * 5) % 28),
disk: 37 + index * 0.2,
bandwidth: 120 + ((index * 29) % 180),
requests: 900 + ((index * 173) % 1400),
}));
export const securityFindings: SecurityFinding[] = [
{
id: "sec-1",
severity: "high",
title: "Two mailboxes exceed recommended spam threshold",
target: "Email reputation",
status: "open",
recommendation: "Review recent delivery logs and tighten spam filtering.",
},
{
id: "sec-2",
severity: "medium",
title: "Legacy TLS ciphers enabled on one alias",
target: "legacy-example.net",
status: "acknowledged",
recommendation: "Disable TLS 1.0/1.1 compatibility profile.",
},
{
id: "sec-3",
severity: "low",
title: "Three API tokens have not been rotated in 90 days",
target: "API tokens",
status: "open",
recommendation: "Rotate tokens and enforce shorter expiry.",
},
];
export const backups: Backup[] = [
{
id: "bak-2026-06-12",
name: "Full account nightly",
scope: "full",
destination: "S3-compatible storage",
size: 43_200_000_000,
status: "healthy",
encrypted: true,
createdAt: iso(subHours(now, 6)),
},
{
id: "bak-db-2026-06-12",
name: "Database hourly",
scope: "database",
destination: "Local storage",
size: 2_400_000_000,
status: "healthy",
encrypted: true,
createdAt: iso(subHours(now, 1)),
},
{
id: "bak-mail-2026-06-11",
name: "Email archive",
scope: "email",
destination: "Backblaze B2",
size: 5_700_000_000,
status: "warning",
encrypted: true,
createdAt: iso(subDays(now, 1)),
},
];
export const automations: Automation[] = [
{
id: "deploy-main",
name: "Deploy main branch",
trigger: "Git push to main",
status: "healthy",
lastRun: iso(subHours(now, 4)),
successRate: 98,
},
{
id: "ssl-renewal",
name: "Certificate renewal",
trigger: "Certificate expires in 21 days",
status: "healthy",
lastRun: iso(subDays(now, 3)),
successRate: 100,
},
{
id: "backup-verify",
name: "Backup verification",
trigger: "After backup completes",
status: "warning",
lastRun: iso(subHours(now, 6)),
successRate: 92,
},
];
export const notifications: Notification[] = [
{
id: "note-1",
title: "Email queue has deferred messages",
category: "resource",
read: false,
createdAt: iso(subHours(now, 1)),
body: "14 messages are deferred. Delivery retry is scheduled.",
},
{
id: "note-2",
title: "Backup verified",
category: "backup",
read: true,
createdAt: iso(subHours(now, 5)),
body: "Full account nightly backup passed integrity checks.",
},
{
id: "note-3",
title: "Certificate expires in 24 days",
category: "ssl",
read: false,
createdAt: iso(subDays(now, 1)),
body: "legacy-example.net is queued for automatic renewal.",
},
];
export const auditEntries: AuditEntry[] = [
{
id: "aud-1",
actor: "Mara Ellis",
action: "created DNS record",
target: "api.example.com A",
ipAddress: "192.0.2.44",
createdAt: iso(subHours(now, 2)),
requestId: "req_8f172a",
},
{
id: "aud-2",
actor: "Mara Ellis",
action: "downloaded backup",
target: "bak-2026-06-12",
ipAddress: "192.0.2.44",
createdAt: iso(subHours(now, 3)),
requestId: "req_9b72cf",
},
{
id: "aud-3",
actor: "Support Operator",
action: "viewed mailbox",
target: "support@example.com",
ipAddress: "198.51.100.91",
createdAt: iso(subHours(now, 8)),
requestId: "req_f33821",
},
];
export const runtimes: RuntimeDefinition[] = [
{
id: "php",
name: "PHP",
versions: ["8.4", "8.3", "8.2"],
extensions: ["opcache", "intl", "imagick", "redis", "pdo_mysql"],
processManagers: ["PHP-FPM"],
environmentSchema: ["APP_ENV", "APP_KEY", "DATABASE_URL"],
},
{
id: "nodejs",
name: "Node.js",
versions: ["24", "22", "20"],
extensions: ["npm", "pnpm", "yarn"],
processManagers: ["PM2", "systemd user service"],
environmentSchema: ["NODE_ENV", "PORT", "DATABASE_URL"],
},
{
id: "python",
name: "Python",
versions: ["3.13", "3.12", "3.11"],
extensions: ["pip", "uv", "poetry"],
processManagers: ["gunicorn", "uvicorn"],
environmentSchema: ["PYTHONPATH", "APP_MODULE", "DATABASE_URL"],
},
{
id: "docker",
name: "Docker",
versions: ["27", "26"],
extensions: ["compose", "buildx"],
processManagers: ["container supervisor"],
environmentSchema: ["IMAGE", "PORTS", "VOLUMES"],
},
];