mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-16 00:45:18 +00:00
Merge pull request #2309 from Dokploy/1778-railpack-frontend-version-is-hardcoded
1778 railpack frontend version is hardcoded
This commit is contained in:
@@ -25,6 +25,7 @@ if (typeof window === "undefined") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseApp: ApplicationNested = {
|
const baseApp: ApplicationNested = {
|
||||||
|
railpackVersion: "0.2.2",
|
||||||
applicationId: "",
|
applicationId: "",
|
||||||
herokuVersion: "",
|
herokuVersion: "",
|
||||||
giteaBranch: "",
|
giteaBranch: "",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { createRouterConfig } from "@dokploy/server";
|
|||||||
import { expect, test } from "vitest";
|
import { expect, test } from "vitest";
|
||||||
|
|
||||||
const baseApp: ApplicationNested = {
|
const baseApp: ApplicationNested = {
|
||||||
|
railpackVersion: "0.2.2",
|
||||||
rollbackActive: false,
|
rollbackActive: false,
|
||||||
applicationId: "",
|
applicationId: "",
|
||||||
herokuVersion: "",
|
herokuVersion: "",
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import { Cog } from "lucide-react";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
import { z } from "zod";
|
||||||
import { AlertBlock } from "@/components/shared/alert-block";
|
import { AlertBlock } from "@/components/shared/alert-block";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
@@ -15,12 +21,6 @@ import {
|
|||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
|
||||||
import { Cog } from "lucide-react";
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { useForm } from "react-hook-form";
|
|
||||||
import { toast } from "sonner";
|
|
||||||
import { z } from "zod";
|
|
||||||
|
|
||||||
export enum BuildType {
|
export enum BuildType {
|
||||||
dockerfile = "dockerfile",
|
dockerfile = "dockerfile",
|
||||||
@@ -65,6 +65,7 @@ const mySchema = z.discriminatedUnion("buildType", [
|
|||||||
}),
|
}),
|
||||||
z.object({
|
z.object({
|
||||||
buildType: z.literal(BuildType.railpack),
|
buildType: z.literal(BuildType.railpack),
|
||||||
|
railpackVersion: z.string().nullable().default("0.2.2"),
|
||||||
}),
|
}),
|
||||||
z.object({
|
z.object({
|
||||||
buildType: z.literal(BuildType.static),
|
buildType: z.literal(BuildType.static),
|
||||||
@@ -86,6 +87,7 @@ interface ApplicationData {
|
|||||||
herokuVersion?: string | null;
|
herokuVersion?: string | null;
|
||||||
publishDirectory?: string | null;
|
publishDirectory?: string | null;
|
||||||
isStaticSpa?: boolean | null;
|
isStaticSpa?: boolean | null;
|
||||||
|
railpackVersion?: string | null | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isValidBuildType(value: string): value is BuildType {
|
function isValidBuildType(value: string): value is BuildType {
|
||||||
@@ -123,6 +125,7 @@ const resetData = (data: ApplicationData): AddTemplate => {
|
|||||||
case BuildType.railpack:
|
case BuildType.railpack:
|
||||||
return {
|
return {
|
||||||
buildType: BuildType.railpack,
|
buildType: BuildType.railpack,
|
||||||
|
railpackVersion: data.railpackVersion || null,
|
||||||
};
|
};
|
||||||
default: {
|
default: {
|
||||||
const buildType = data.buildType as BuildType;
|
const buildType = data.buildType as BuildType;
|
||||||
@@ -181,6 +184,10 @@ export const ShowBuildChooseForm = ({ applicationId }: Props) => {
|
|||||||
: null,
|
: null,
|
||||||
isStaticSpa:
|
isStaticSpa:
|
||||||
data.buildType === BuildType.static ? data.isStaticSpa : null,
|
data.buildType === BuildType.static ? data.isStaticSpa : null,
|
||||||
|
railpackVersion:
|
||||||
|
data.buildType === BuildType.railpack
|
||||||
|
? data.railpackVersion || "0.2.2"
|
||||||
|
: null,
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
toast.success("Build type saved");
|
toast.success("Build type saved");
|
||||||
@@ -395,6 +402,25 @@ export const ShowBuildChooseForm = ({ applicationId }: Props) => {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{buildType === BuildType.railpack && (
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="railpackVersion"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Railpack Version</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="Railpack Version"
|
||||||
|
{...field}
|
||||||
|
value={field.value ?? ""}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<div className="flex w-full justify-end">
|
<div className="flex w-full justify-end">
|
||||||
<Button isLoading={isLoading} type="submit">
|
<Button isLoading={isLoading} type="submit">
|
||||||
Save
|
Save
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "application" ADD COLUMN "railpackVersion" text DEFAULT '0.2.2';
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -729,6 +729,13 @@
|
|||||||
"when": 1752465764072,
|
"when": 1752465764072,
|
||||||
"tag": "0103_cultured_pestilence",
|
"tag": "0103_cultured_pestilence",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 104,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1754207407121,
|
||||||
|
"tag": "0104_omniscient_randall",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,31 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
createTRPCRouter,
|
|
||||||
protectedProcedure,
|
|
||||||
uploadProcedure,
|
|
||||||
} from "@/server/api/trpc";
|
|
||||||
import { db } from "@/server/db";
|
|
||||||
import {
|
|
||||||
apiCreateApplication,
|
|
||||||
apiFindMonitoringStats,
|
|
||||||
apiFindOneApplication,
|
|
||||||
apiReloadApplication,
|
|
||||||
apiSaveBitbucketProvider,
|
|
||||||
apiSaveBuildType,
|
|
||||||
apiSaveDockerProvider,
|
|
||||||
apiSaveEnvironmentVariables,
|
|
||||||
apiSaveGitProvider,
|
|
||||||
apiSaveGiteaProvider,
|
|
||||||
apiSaveGithubProvider,
|
|
||||||
apiSaveGitlabProvider,
|
|
||||||
apiUpdateApplication,
|
|
||||||
applications,
|
|
||||||
} from "@/server/db/schema";
|
|
||||||
import type { DeploymentJob } from "@/server/queues/queue-types";
|
|
||||||
import { cleanQueuesByApplication, myQueue } from "@/server/queues/queueSetup";
|
|
||||||
import { deploy } from "@/server/utils/deploy";
|
|
||||||
import { uploadFileSchema } from "@/utils/schema";
|
|
||||||
import {
|
|
||||||
IS_CLOUD,
|
|
||||||
addNewService,
|
addNewService,
|
||||||
checkServiceAccess,
|
checkServiceAccess,
|
||||||
createApplication,
|
createApplication,
|
||||||
@@ -34,6 +7,7 @@ import {
|
|||||||
findGitProviderById,
|
findGitProviderById,
|
||||||
findProjectById,
|
findProjectById,
|
||||||
getApplicationStats,
|
getApplicationStats,
|
||||||
|
IS_CLOUD,
|
||||||
mechanizeDockerContainer,
|
mechanizeDockerContainer,
|
||||||
readConfig,
|
readConfig,
|
||||||
readRemoteConfig,
|
readRemoteConfig,
|
||||||
@@ -57,6 +31,32 @@ import { TRPCError } from "@trpc/server";
|
|||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import {
|
||||||
|
createTRPCRouter,
|
||||||
|
protectedProcedure,
|
||||||
|
uploadProcedure,
|
||||||
|
} from "@/server/api/trpc";
|
||||||
|
import { db } from "@/server/db";
|
||||||
|
import {
|
||||||
|
apiCreateApplication,
|
||||||
|
apiFindMonitoringStats,
|
||||||
|
apiFindOneApplication,
|
||||||
|
apiReloadApplication,
|
||||||
|
apiSaveBitbucketProvider,
|
||||||
|
apiSaveBuildType,
|
||||||
|
apiSaveDockerProvider,
|
||||||
|
apiSaveEnvironmentVariables,
|
||||||
|
apiSaveGiteaProvider,
|
||||||
|
apiSaveGithubProvider,
|
||||||
|
apiSaveGitlabProvider,
|
||||||
|
apiSaveGitProvider,
|
||||||
|
apiUpdateApplication,
|
||||||
|
applications,
|
||||||
|
} from "@/server/db/schema";
|
||||||
|
import type { DeploymentJob } from "@/server/queues/queue-types";
|
||||||
|
import { cleanQueuesByApplication, myQueue } from "@/server/queues/queueSetup";
|
||||||
|
import { deploy } from "@/server/utils/deploy";
|
||||||
|
import { uploadFileSchema } from "@/utils/schema";
|
||||||
|
|
||||||
export const applicationRouter = createTRPCRouter({
|
export const applicationRouter = createTRPCRouter({
|
||||||
create: protectedProcedure
|
create: protectedProcedure
|
||||||
@@ -364,6 +364,7 @@ export const applicationRouter = createTRPCRouter({
|
|||||||
dockerBuildStage: input.dockerBuildStage,
|
dockerBuildStage: input.dockerBuildStage,
|
||||||
herokuVersion: input.herokuVersion,
|
herokuVersion: input.herokuVersion,
|
||||||
isStaticSpa: input.isStaticSpa,
|
isStaticSpa: input.isStaticSpa,
|
||||||
|
railpackVersion: input.railpackVersion,
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ export const applications = pgTable("application", {
|
|||||||
.notNull()
|
.notNull()
|
||||||
.default("idle"),
|
.default("idle"),
|
||||||
buildType: buildType("buildType").notNull().default("nixpacks"),
|
buildType: buildType("buildType").notNull().default("nixpacks"),
|
||||||
|
railpackVersion: text("railpackVersion").default("0.2.2"),
|
||||||
herokuVersion: text("herokuVersion").default("24"),
|
herokuVersion: text("herokuVersion").default("24"),
|
||||||
publishDirectory: text("publishDirectory"),
|
publishDirectory: text("publishDirectory"),
|
||||||
isStaticSpa: boolean("isStaticSpa"),
|
isStaticSpa: boolean("isStaticSpa"),
|
||||||
@@ -412,6 +413,7 @@ const createSchema = createInsertSchema(applications, {
|
|||||||
"static",
|
"static",
|
||||||
"railpack",
|
"railpack",
|
||||||
]),
|
]),
|
||||||
|
railpackVersion: z.string().optional(),
|
||||||
herokuVersion: z.string().optional(),
|
herokuVersion: z.string().optional(),
|
||||||
publishDirectory: z.string().optional(),
|
publishDirectory: z.string().optional(),
|
||||||
isStaticSpa: z.boolean().optional(),
|
isStaticSpa: z.boolean().optional(),
|
||||||
@@ -466,6 +468,7 @@ export const apiSaveBuildType = createSchema
|
|||||||
dockerContextPath: true,
|
dockerContextPath: true,
|
||||||
dockerBuildStage: true,
|
dockerBuildStage: true,
|
||||||
herokuVersion: true,
|
herokuVersion: true,
|
||||||
|
railpackVersion: true,
|
||||||
})
|
})
|
||||||
.required()
|
.required()
|
||||||
.merge(createSchema.pick({ publishDirectory: true, isStaticSpa: true }));
|
.merge(createSchema.pick({ publishDirectory: true, isStaticSpa: true }));
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export const buildRailpack = async (
|
|||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
"--build-arg",
|
"--build-arg",
|
||||||
"BUILDKIT_SYNTAX=ghcr.io/railwayapp/railpack-frontend:v0.2.2",
|
`BUILDKIT_SYNTAX=ghcr.io/railwayapp/railpack-frontend:v${application.railpackVersion}`,
|
||||||
"-f",
|
"-f",
|
||||||
`${buildAppDirectory}/railpack-plan.json`,
|
`${buildAppDirectory}/railpack-plan.json`,
|
||||||
"--output",
|
"--output",
|
||||||
@@ -110,6 +110,8 @@ export const buildRailpack = async (
|
|||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
} finally {
|
||||||
|
await execAsync("docker buildx rm builder-containerd");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -155,7 +157,7 @@ export const getRailpackCommand = (
|
|||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
"--build-arg",
|
"--build-arg",
|
||||||
"BUILDKIT_SYNTAX=ghcr.io/railwayapp/railpack-frontend:v0.0.64",
|
`BUILDKIT_SYNTAX=ghcr.io/railwayapp/railpack-frontend:v${application.railpackVersion}`,
|
||||||
"-f",
|
"-f",
|
||||||
`${buildAppDirectory}/railpack-plan.json`,
|
`${buildAppDirectory}/railpack-plan.json`,
|
||||||
"--output",
|
"--output",
|
||||||
@@ -194,6 +196,7 @@ docker ${buildArgs.join(" ")} >> ${logPath} 2>> ${logPath} || {
|
|||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
echo "✅ Railpack build completed." >> ${logPath};
|
echo "✅ Railpack build completed." >> ${logPath};
|
||||||
|
docker buildx rm builder-containerd
|
||||||
`;
|
`;
|
||||||
|
|
||||||
return bashCommand;
|
return bashCommand;
|
||||||
|
|||||||
Reference in New Issue
Block a user