Phase2
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 10s
CI / Go — node-agent tests (push) Failing after 8s
CI / Go — edge-gateway build (push) Successful in 13s

This commit is contained in:
smueller
2026-06-26 12:01:25 +02:00
parent 58961000eb
commit c4077d4673
93 changed files with 4099 additions and 165 deletions

View File

@@ -0,0 +1,62 @@
import { PrismaClient } from '@prisma/client';
import { hashToken } from '@hexahost/auth';
/** Stable dev node ID — must match NODE_ID in .env for local agent */
export const DEV_NODE_ID = '00000000-0000-4000-8000-000000000001';
/** Shown once in seed output; hash stored in DB */
export const DEV_NODE_ENROLLMENT_TOKEN =
'local-dev-enrollment-token-change-me-32chars';
async function main(): Promise<void> {
const prisma = new PrismaClient();
try {
const freePlan = await prisma.plan.upsert({
where: { slug: 'free' },
create: {
name: 'Free',
slug: 'free',
description: 'Free tier with limited resources',
isFree: true,
isActive: true,
maxRamMb: 2048,
maxCpuCores: 1,
maxStorageMb: 5120,
},
update: {
isActive: true,
},
});
const devNode = await prisma.gameNode.upsert({
where: { id: DEV_NODE_ID },
create: {
id: DEV_NODE_ID,
name: 'local-dev',
hostname: 'localhost',
status: 'OFFLINE',
maxServers: 10,
enrollmentTokenHash: hashToken(DEV_NODE_ENROLLMENT_TOKEN),
},
update: {
name: 'local-dev',
hostname: 'localhost',
enrollmentTokenHash: hashToken(DEV_NODE_ENROLLMENT_TOKEN),
},
});
console.log('Seed complete:');
console.log(` Plan Free: ${freePlan.id}`);
console.log(` Dev node: ${devNode.id} (${devNode.name})`);
console.log(` Enrollment token (set NODE_TOKEN): ${DEV_NODE_ENROLLMENT_TOKEN}`);
} finally {
await prisma.$disconnect();
}
}
void main().catch((error: unknown) => {
console.error(error instanceof Error ? error.message : error);
process.exit(1);
});