Skip to content

Commit

Permalink
chore: Remove cluster creation bootstrap script
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith committed Dec 14, 2024
1 parent 5c86134 commit 3975021
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 78 deletions.
6 changes: 3 additions & 3 deletions app/components/services-quickstart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export function ServicesQuickstart({ clusterId }: { clusterId: string }) {
inf auth login`;

const languageSpecificCommands = {
node: `inf bootstrap node --dir=inferable-app-${clusterId} --no-cluster=true`,
golang: `inf bootstrap go --dir=inferable-app-${clusterId} --no-cluster=true`,
dotnet: `inf bootstrap dotnet --dir=inferable-app-${clusterId} --no-cluster=true`,
node: `inf bootstrap node --dir=inferable-app-${clusterId}`,
golang: `inf bootstrap go --dir=inferable-app-${clusterId}`,
dotnet: `inf bootstrap dotnet --dir=inferable-app-${clusterId}`,
};

return `${baseCommands} && \\
Expand Down
75 changes: 0 additions & 75 deletions cli/src/commands/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const execAsync = promisify(exec);
interface BootstrapArgs {
dir?: string;
type?: string;
"no-cluster"?: boolean;
}

const projectMap: Record<
Expand Down Expand Up @@ -60,11 +59,6 @@ export const Bootstrap: CommandModule<{}, BootstrapArgs> = {
describe: "Directory to create the application in",
type: "string",
demandOption: false,
})
.option("no-cluster", {
describe: "Do not provision a new cluster",
type: "boolean",
demandOption: false,
}),
handler: async ({
dir: providedDir,
Expand All @@ -83,18 +77,6 @@ export const Bootstrap: CommandModule<{}, BootstrapArgs> = {
},
]);

const { cluster } =
noCluster === undefined
? await inquirer.prompt([
{
type: "confirm",
name: "cluster",
message: "Would you like to provision a new cluster?",
default: true,
},
])
: { cluster: !noCluster };

const { dir } =
providedDir === undefined
? await inquirer.prompt([
Expand All @@ -113,63 +95,6 @@ export const Bootstrap: CommandModule<{}, BootstrapArgs> = {
console.log(`Downloading ${proxyRepo.url}...`);
await downloadProject(proxyRepo.url, proxyRepo.ref, dir);

if (cluster) {
if (!getToken()) {
console.log(
"To prevent abuse to our systems, we request that users verify their email address. Press Enter to continue...",
);

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

try {
await new Promise<void>((resolve) => {
rl.question("", () => {
resolve();
});
});
} finally {
rl.close();
}

await startTokenFlow();
}

console.log("Creating Cluster... ");

const newCluster = await createCluster({
description: `CLI Created Cluster at ${new Date().toISOString()}`,
});

if (!newCluster) {
console.log("Failed to create cluster");
process.exit(1);
}

console.log("Cluster created with ID:", newCluster?.id);

console.log("Creating API key...");

const newApiKey = await createApiKey(
newCluster?.id,
`CLI Created API Key`,
);

if (!newApiKey) {
console.log("Failed to create API key");
process.exit(1);
}

const envFile = path.resolve(dir, ".env");

await appendFile(envFile, `INFERABLE_API_SECRET=${newApiKey.key}\n`);
await appendFile(envFile, `INFERABLE_CLUSTER_ID=${newCluster.id}\n`);

console.log("API Key created with ID:", newApiKey?.id);
}

switch (type) {
case "proxy":
case "node":
Expand Down

0 comments on commit 3975021

Please sign in to comment.