feat(cloud): add deploy on remote worker

This commit is contained in:
Mauricio Siu
2024-10-03 23:46:26 -06:00
parent 767d3e1944
commit 388ded9aa5
10 changed files with 229 additions and 479 deletions

View File

@@ -55,6 +55,7 @@ import { TRPCError } from "@trpc/server";
import { eq } from "drizzle-orm";
import { nanoid } from "nanoid";
import { z } from "zod";
import { deploy } from "@/server/utils/deploy";
export const applicationRouter = createTRPCRouter({
create: protectedProcedure
@@ -234,6 +235,12 @@ export const applicationRouter = createTRPCRouter({
applicationType: "application",
server: !!application.serverId,
};
if (IS_CLOUD && application.serverId) {
jobData.serverId = application.serverId;
await deploy(jobData);
return true;
}
await myQueue.add(
"deployments",
{ ...jobData },
@@ -457,6 +464,12 @@ export const applicationRouter = createTRPCRouter({
applicationType: "application",
server: !!application.serverId,
};
if (IS_CLOUD && application.serverId) {
jobData.serverId = application.serverId;
await deploy(jobData);
return true;
}
await myQueue.add(
"deployments",
{ ...jobData },