feat: Lightsail + svg animation
This commit is contained in:
@@ -45,6 +45,7 @@ import { getAccountId } from "@/lib/accountStore";
|
||||
type CloudPathParams = Record<string, string>;
|
||||
|
||||
const DATABASE_MUTATION_TIMEOUT_MS = 5 * 60_000;
|
||||
const LIGHTSAIL_CREATION_TIMEOUT_MS = 3 * 60_000;
|
||||
const SQL_DATA_TIMEOUT_MS = 45_000;
|
||||
/** Floci completes Insights queries instantly by default, but bounded server-side polling can take longer. */
|
||||
const LOGS_QUERY_TIMEOUT_MS = 20_000;
|
||||
@@ -164,10 +165,12 @@ export async function createCloudResource(
|
||||
values: Record<string, unknown>,
|
||||
signal?: AbortSignal,
|
||||
): Promise<CloudResource> {
|
||||
const timeout =
|
||||
(cloud === "azure" || cloud === "aws") && service === "database"
|
||||
? DATABASE_MUTATION_TIMEOUT_MS
|
||||
: undefined;
|
||||
const timeout =
|
||||
(cloud === "azure" || cloud === "aws") && service === "database"
|
||||
? DATABASE_MUTATION_TIMEOUT_MS
|
||||
: cloud === "aws" && service === "lightsail"
|
||||
? LIGHTSAIL_CREATION_TIMEOUT_MS
|
||||
: undefined;
|
||||
const res = await apiClient.call<CloudResource, Record<string, unknown>>(
|
||||
apiEndpointKeys.clouds.resources.create,
|
||||
requestOptions(cloud, service, { signal, body: values, timeout }),
|
||||
@@ -1104,6 +1107,36 @@ export async function uploadStorageObject(
|
||||
);
|
||||
}
|
||||
|
||||
export type LightsailStaticDeployment = {status: 'deployed'; files: number}
|
||||
export type LightsailNodeDeployment = {status: 'deployed'; files: number; port: number; releaseId: string}
|
||||
|
||||
export async function deployLightsailStaticFiles(instanceId: string, files: File[]): Promise<LightsailStaticDeployment> {
|
||||
const form = new FormData()
|
||||
for (const file of files) {
|
||||
const path = file.webkitRelativePath || file.name
|
||||
form.append('files', file, path)
|
||||
}
|
||||
const res = await apiClient.call<LightsailStaticDeployment>(
|
||||
apiEndpointKeys.clouds.resources.deployLightsailStaticFiles,
|
||||
requestOptions('aws', 'lightsail', {rawBody: form}),
|
||||
{id: instanceId},
|
||||
)
|
||||
return res.data
|
||||
}
|
||||
|
||||
export async function deployLightsailNodeApplication(instanceId: string, files: File[], startCommand: string, port: number): Promise<LightsailNodeDeployment> {
|
||||
const form = new FormData()
|
||||
for (const file of files) form.append('files', file, file.webkitRelativePath || file.name)
|
||||
if (startCommand.trim()) form.append('startCommand', startCommand.trim())
|
||||
form.append('port', String(port))
|
||||
const res = await apiClient.call<LightsailNodeDeployment>(
|
||||
apiEndpointKeys.clouds.resources.deployLightsailNodeApplication,
|
||||
requestOptions('aws', 'lightsail', {rawBody: form, timeout: 370_000}),
|
||||
{id: instanceId},
|
||||
)
|
||||
return res.data
|
||||
}
|
||||
|
||||
export function storageObjectDownloadUrl(
|
||||
cloud: CloudProvider,
|
||||
resourceId: string,
|
||||
|
||||
Reference in New Issue
Block a user