Skip to content

Commit 954a8d1

Browse files
authored
Merge pull request #209 from meAmitPatil/superserve-dax-template
dax: build and use a sized Superserve template
2 parents c28bc2c + 62ab497 commit 954a8d1

4 files changed

Lines changed: 48 additions & 1 deletion

File tree

.github/workflows/sandbox-dax-benchmarks.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ jobs:
8787
env:
8888
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
8989
run: npx tsx scripts/build-e2b-template.ts
90+
- name: Build Superserve template with 8 vCPU / 16 GiB
91+
if: matrix.provider == 'superserve'
92+
env:
93+
SUPERSERVE_API_KEY: ${{ secrets.SUPERSERVE_API_KEY }}
94+
run: npx tsx scripts/build-superserve-template.ts
9095
- name: Find Northflank plan for 8 vCPU / 16 GiB
9196
if: matrix.provider == 'northflank'
9297
env:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
"@computesdk/tilion": "^0.1.0",
129129
"@computesdk/upstash": "^0.3.9",
130130
"@computesdk/vercel": "^1.7.31",
131+
"@superserve/sdk": "^0.8.1",
131132
"@google-cloud/storage": "^7.21.0",
132133
"@storagesdk/adapters": "^0.7.1",
133134
"@storagesdk/core": "^0.4.2",
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'dotenv/config';
2+
import { Template } from '@superserve/sdk';
3+
4+
const NAME = 'node22-8cpu-16gb';
5+
6+
async function main() {
7+
const apiKey = process.env.SUPERSERVE_API_KEY;
8+
if (!apiKey) {
9+
throw new Error('SUPERSERVE_API_KEY environment variable is not set');
10+
}
11+
12+
try {
13+
const template = await Template.create({
14+
apiKey,
15+
name: NAME,
16+
from: 'node:22',
17+
vcpu: 8,
18+
memoryMib: 16384,
19+
diskMib: 10240,
20+
});
21+
await template.waitUntilReady();
22+
console.log(`Superserve template ${NAME} built successfully`);
23+
} catch (error) {
24+
const message = error instanceof Error ? error.message : String(error);
25+
if (
26+
message.toLowerCase().includes('already exists') ||
27+
message.toLowerCase().includes('already taken') ||
28+
message.toLowerCase().includes('duplicate') ||
29+
message.includes('409')
30+
) {
31+
console.log('Template already exists, skipping');
32+
return;
33+
}
34+
throw error;
35+
}
36+
}
37+
38+
main().catch((error) => {
39+
console.error('Failed to build Superserve template:', error);
40+
process.exit(1);
41+
});

src/sandbox/dax.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const DAX_RESOURCE_OPTIONS: Record<string, Record<string, any>> = {
3030
daytona: { resources: { cpu: 8, memory: 16 } }, // memory in GiB; requires image-based creation (see providers.ts)
3131
northflank: { deploymentPlan: process.env.NORTHFLANK_DEPLOYMENT_PLAN || 'nf-compute-50' }, // resolved by scripts/find-northflank-plan.ts
3232
declaw: { templateId: 'node-large' }, // node-large template: 8 vCPU / 16 GiB RAM / 8 GiB disk
33-
superserve: { vcpu: 8, memoryMib: 16384 }, // vcpu = cores, memoryMib = MiB; overrides template defaults
33+
superserve: { templateId: 'node22-8cpu-16gb' }, // 8 vCPU / 16 GiB template built in the pre-step
3434
createos: { shape: 's-8vcpu-16gb', ephemeralDiskMb: 61440 }, // 8 vCPU, 16 GiB RAM, 60 GiB disk
3535
opencomputer: { cpuCount: 8, memoryMB: 16384, timeout: 600_000 },
3636
};

0 commit comments

Comments
 (0)