/** * The Proxmox simulator, as the rig runs it. * * Everything here is the join between two halves that are deliberately kept * apart: `@celilo/terraform-fake` knows the Proxmox API and nothing about this * rig, and `proxmox-provisioner` knows this rig and nothing about Proxmox. This * file is the only place that holds both, and it is also the only place that * holds the host Docker socket (D2) — which is why it is an image in the rig * rather than anything the published package ships. */ // In the image this specifier resolves to the BUNDLED copy from this checkout // (Dockerfile.proxmox-sim places it at node_modules/@celilo/terraform-fake), // never to whatever npm last published — a PR that changes the fake must be // tested against the fake it changed. import { createProxmoxFake } from '@celilo/terraform-fake'; import { createDockerProvisioner } from '../../src/proxmox-provisioner'; const port = Number(process.env.PROXMOX_SIM_PORT ?? 8006); /** * The compose project name, which prefixes the networks and volumes the * provisioner attaches containers to. * * Required rather than defaulted: a wrong guess here does not fail, it starts * containers on a network no test is looking at, and the deploy failure that * follows points at DNS or the firewall instead. */ const project = process.env.CELILO_E2E_PROJECT; if (!project) { throw new Error('CELILO_E2E_PROJECT is required — it names the compose project to attach to'); } const fake = createProxmoxFake({ tls: { key: await Bun.file('/certs/proxmox-sim.key').text(), cert: await Bun.file('/certs/proxmox-sim.crt').text(), }, // One node, named to match what a test sets as `target_node`. nodes: [ { name: process.env.PROXMOX_SIM_NODE ?? 'pve1', cores: 8, memoryBytes: 16 * 1024 ** 3, diskBytes: 500 * 1024 ** 3, }, ], provisioner: createDockerProvisioner({ project }), }); await fake.listen(port); console.log(`[proxmox-sim] listening on https://0.0.0.0:${port}/api2/json (project ${project})`);