From 2e79c7230fa54b2fc915fe6553f774f3c8904c7f Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 21 Jul 2024 18:02:42 -0600 Subject: [PATCH 1/4] refactor(volumes): rework volumes and paths --- .../advanced/volumes/add-volumes.tsx | 73 +- .../compose/advanced/show-volumes.tsx | 22 +- .../dashboard/mysql/volumes/show-volumes.tsx | 14 +- drizzle/0024_dapper_supernaut.sql | 1 + drizzle/meta/0024_snapshot.json | 2932 +++++++++++++++++ drizzle/meta/_journal.json | 7 + server/api/services/compose.ts | 2 +- server/api/services/mount.ts | 118 +- server/db/schema/mount.ts | 10 + server/utils/builders/compose.ts | 12 +- server/utils/builders/drop.ts | 3 +- server/utils/builders/nixpacks.ts | 1 + server/utils/docker/utils.ts | 64 +- server/utils/filesystem/directory.ts | 13 +- server/utils/providers/git.ts | 2 +- server/utils/providers/github.ts | 2 +- server/utils/providers/raw.ts | 2 +- 17 files changed, 3151 insertions(+), 127 deletions(-) create mode 100644 drizzle/0024_dapper_supernaut.sql create mode 100644 drizzle/meta/0024_snapshot.json diff --git a/components/dashboard/application/advanced/volumes/add-volumes.tsx b/components/dashboard/application/advanced/volumes/add-volumes.tsx index 6b882b7c..a7a39b83 100644 --- a/components/dashboard/application/advanced/volumes/add-volumes.tsx +++ b/components/dashboard/application/advanced/volumes/add-volumes.tsx @@ -63,6 +63,7 @@ const mySchema = z.discriminatedUnion("type", [ z .object({ type: z.literal("file"), + filePath: z.string().min(1, "File path required"), content: z.string().optional(), }) .merge(mountSchema), @@ -81,7 +82,7 @@ export const AddVolumes = ({ defaultValues: { type: serviceType === "compose" ? "file" : "bind", hostPath: "", - mountPath: "", + mountPath: serviceType === "compose" ? "/" : "", }, resolver: zodResolver(mySchema), }); @@ -125,6 +126,7 @@ export const AddVolumes = ({ serviceId, content: data.content, mountPath: data.mountPath, + filePath: data.filePath, type: data.type, serviceType, }) @@ -288,41 +290,62 @@ export const AddVolumes = ({ )} {type === "file" && ( + <> + ( + + Content + + +