mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
Merge pull request #4104 from nktnet1/typo-fix
fix: typos, grammar, spelling, style & format
This commit is contained in:
@@ -292,7 +292,7 @@ networks:
|
|||||||
dokploy-network:
|
dokploy-network:
|
||||||
`;
|
`;
|
||||||
|
|
||||||
test("It shoudn't add suffix to dokploy-network", () => {
|
test("It shouldn't add suffix to dokploy-network", () => {
|
||||||
const composeData = parse(composeFile7) as ComposeSpecification;
|
const composeData = parse(composeFile7) as ComposeSpecification;
|
||||||
|
|
||||||
const suffix = generateRandomHash();
|
const suffix = generateRandomHash();
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ services:
|
|||||||
- dokploy-network
|
- dokploy-network
|
||||||
`;
|
`;
|
||||||
|
|
||||||
test("It shoudn't add suffix to dokploy-network in services", () => {
|
test("It shouldn't add suffix to dokploy-network in services", () => {
|
||||||
const composeData = parse(composeFile7) as ComposeSpecification;
|
const composeData = parse(composeFile7) as ComposeSpecification;
|
||||||
|
|
||||||
const suffix = generateRandomHash();
|
const suffix = generateRandomHash();
|
||||||
@@ -241,10 +241,10 @@ services:
|
|||||||
dokploy-network:
|
dokploy-network:
|
||||||
aliases:
|
aliases:
|
||||||
- apid
|
- apid
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
test("It shoudn't add suffix to dokploy-network in services multiples cases", () => {
|
test("It shouldn't add suffix to dokploy-network in services multiples cases", () => {
|
||||||
const composeData = parse(composeFile8) as ComposeSpecification;
|
const composeData = parse(composeFile8) as ComposeSpecification;
|
||||||
|
|
||||||
const suffix = generateRandomHash();
|
const suffix = generateRandomHash();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getEnviromentVariablesObject } from "@dokploy/server/index";
|
import { getEnvironmentVariablesObject } from "@dokploy/server/index";
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
const projectEnv = `
|
const projectEnv = `
|
||||||
@@ -15,7 +15,7 @@ DATABASE_NAME=dev_database
|
|||||||
SECRET_KEY=env-secret-123
|
SECRET_KEY=env-secret-123
|
||||||
`;
|
`;
|
||||||
|
|
||||||
describe("getEnviromentVariablesObject with environment variables (Stack compose)", () => {
|
describe("getEnvironmentVariablesObject with environment variables (Stack compose)", () => {
|
||||||
it("resolves environment variables correctly for Stack compose", () => {
|
it("resolves environment variables correctly for Stack compose", () => {
|
||||||
const serviceEnv = `
|
const serviceEnv = `
|
||||||
FOO=\${{environment.NODE_ENV}}
|
FOO=\${{environment.NODE_ENV}}
|
||||||
@@ -23,7 +23,7 @@ BAR=\${{environment.API_URL}}
|
|||||||
BAZ=test
|
BAZ=test
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = getEnviromentVariablesObject(
|
const result = getEnvironmentVariablesObject(
|
||||||
serviceEnv,
|
serviceEnv,
|
||||||
projectEnv,
|
projectEnv,
|
||||||
environmentEnv,
|
environmentEnv,
|
||||||
@@ -45,7 +45,7 @@ DATABASE_URL=\${{project.DATABASE_URL}}
|
|||||||
SERVICE_PORT=4000
|
SERVICE_PORT=4000
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = getEnviromentVariablesObject(
|
const result = getEnvironmentVariablesObject(
|
||||||
serviceEnv,
|
serviceEnv,
|
||||||
projectEnv,
|
projectEnv,
|
||||||
environmentEnv,
|
environmentEnv,
|
||||||
@@ -72,7 +72,7 @@ PASSWORD=secret123
|
|||||||
DATABASE_URL=postgresql://\${{environment.USERNAME}}:\${{environment.PASSWORD}}@\${{environment.HOST}}:\${{environment.PORT}}/mydb
|
DATABASE_URL=postgresql://\${{environment.USERNAME}}:\${{environment.PASSWORD}}@\${{environment.HOST}}:\${{environment.PORT}}/mydb
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = getEnviromentVariablesObject(serviceEnv, "", multiRefEnv);
|
const result = getEnvironmentVariablesObject(serviceEnv, "", multiRefEnv);
|
||||||
|
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
DATABASE_URL: "postgresql://postgres:secret123@localhost:5432/mydb",
|
DATABASE_URL: "postgresql://postgres:secret123@localhost:5432/mydb",
|
||||||
@@ -85,7 +85,7 @@ UNDEFINED_VAR=\${{environment.UNDEFINED_VAR}}
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
expect(() =>
|
expect(() =>
|
||||||
getEnviromentVariablesObject(serviceWithUndefined, "", environmentEnv),
|
getEnvironmentVariablesObject(serviceWithUndefined, "", environmentEnv),
|
||||||
).toThrow("Invalid environment variable: environment.UNDEFINED_VAR");
|
).toThrow("Invalid environment variable: environment.UNDEFINED_VAR");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ NODE_ENV=production
|
|||||||
API_URL=\${{environment.API_URL}}
|
API_URL=\${{environment.API_URL}}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = getEnviromentVariablesObject(
|
const result = getEnvironmentVariablesObject(
|
||||||
serviceOverrideEnv,
|
serviceOverrideEnv,
|
||||||
"",
|
"",
|
||||||
environmentEnv,
|
environmentEnv,
|
||||||
@@ -115,7 +115,7 @@ SERVICE_NAME=my-service
|
|||||||
COMPLEX_VAR=\${{SERVICE_NAME}}-\${{environment.NODE_ENV}}-\${{project.ENVIRONMENT}}
|
COMPLEX_VAR=\${{SERVICE_NAME}}-\${{environment.NODE_ENV}}-\${{project.ENVIRONMENT}}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = getEnviromentVariablesObject(
|
const result = getEnvironmentVariablesObject(
|
||||||
complexServiceEnv,
|
complexServiceEnv,
|
||||||
projectEnv,
|
projectEnv,
|
||||||
environmentEnv,
|
environmentEnv,
|
||||||
@@ -150,7 +150,7 @@ ENV_VAR=\${{environment.API_URL}}
|
|||||||
DB_NAME=\${{environment.DATABASE_NAME}}
|
DB_NAME=\${{environment.DATABASE_NAME}}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = getEnviromentVariablesObject(
|
const result = getEnvironmentVariablesObject(
|
||||||
serviceWithConflicts,
|
serviceWithConflicts,
|
||||||
conflictingProjectEnv,
|
conflictingProjectEnv,
|
||||||
conflictingEnvironmentEnv,
|
conflictingEnvironmentEnv,
|
||||||
@@ -170,7 +170,7 @@ SERVICE_VAR=test
|
|||||||
PROJECT_VAR=\${{project.ENVIRONMENT}}
|
PROJECT_VAR=\${{project.ENVIRONMENT}}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = getEnviromentVariablesObject(
|
const result = getEnvironmentVariablesObject(
|
||||||
serviceWithEmpty,
|
serviceWithEmpty,
|
||||||
projectEnv,
|
projectEnv,
|
||||||
"",
|
"",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { describe, it, expect } from "vitest";
|
|
||||||
import {
|
import {
|
||||||
enterpriseOnlyResources,
|
enterpriseOnlyResources,
|
||||||
statements,
|
statements,
|
||||||
} from "@dokploy/server/lib/access-control";
|
} from "@dokploy/server/lib/access-control";
|
||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
const FREE_TIER_RESOURCES = [
|
const FREE_TIER_RESOURCES = [
|
||||||
"organization",
|
"organization",
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ interface Props {
|
|||||||
type: "application" | "mariadb" | "mongo" | "mysql" | "postgres" | "redis";
|
type: "application" | "mariadb" | "mongo" | "mysql" | "postgres" | "redis";
|
||||||
}
|
}
|
||||||
|
|
||||||
const AddRedirectchema = z.object({
|
const AddRedirectSchema = z.object({
|
||||||
replicas: z.number().min(1, "Replicas must be at least 1"),
|
replicas: z.number().min(1, "Replicas must be at least 1"),
|
||||||
registryId: z.string().optional(),
|
registryId: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
type AddCommand = z.infer<typeof AddRedirectchema>;
|
type AddCommand = z.infer<typeof AddRedirectSchema>;
|
||||||
|
|
||||||
export const ShowClusterSettings = ({ id, type }: Props) => {
|
export const ShowClusterSettings = ({ id, type }: Props) => {
|
||||||
const queryMap = {
|
const queryMap = {
|
||||||
@@ -87,7 +87,7 @@ export const ShowClusterSettings = ({ id, type }: Props) => {
|
|||||||
: {}),
|
: {}),
|
||||||
replicas: data?.replicas || 1,
|
replicas: data?.replicas || 1,
|
||||||
},
|
},
|
||||||
resolver: zodResolver(AddRedirectchema),
|
resolver: zodResolver(AddRedirectSchema),
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ import { Separator } from "@/components/ui/separator";
|
|||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
|
|
||||||
const AddRedirectchema = z.object({
|
const AddRedirectSchema = z.object({
|
||||||
regex: z.string().min(1, "Regex required"),
|
regex: z.string().min(1, "Regex required"),
|
||||||
permanent: z.boolean().default(false),
|
permanent: z.boolean().default(false),
|
||||||
replacement: z.string().min(1, "Replacement required"),
|
replacement: z.string().min(1, "Replacement required"),
|
||||||
});
|
});
|
||||||
|
|
||||||
type AddRedirect = z.infer<typeof AddRedirectchema>;
|
type AddRedirect = z.infer<typeof AddRedirectSchema>;
|
||||||
|
|
||||||
// Default presets
|
// Default presets
|
||||||
const redirectPresets = [
|
const redirectPresets = [
|
||||||
@@ -110,7 +110,7 @@ export const HandleRedirect = ({
|
|||||||
regex: "",
|
regex: "",
|
||||||
replacement: "",
|
replacement: "",
|
||||||
},
|
},
|
||||||
resolver: zodResolver(AddRedirectchema),
|
resolver: zodResolver(AddRedirectSchema),
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -149,7 +149,7 @@ export const HandleRedirect = ({
|
|||||||
|
|
||||||
const onDialogToggle = (open: boolean) => {
|
const onDialogToggle = (open: boolean) => {
|
||||||
setIsOpen(open);
|
setIsOpen(open);
|
||||||
// commented for the moment because not reseting the form if accidentally closed the dialog can be considered as a feature instead of a bug
|
// commented for the moment because not resetting the form if accidentally closed the dialog can be considered as a feature instead of a bug
|
||||||
// setPresetSelected("");
|
// setPresetSelected("");
|
||||||
// form.reset();
|
// form.reset();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import copy from "copy-to-clipboard";
|
||||||
import {
|
import {
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
ChevronUp,
|
ChevronUp,
|
||||||
@@ -11,7 +12,6 @@ import {
|
|||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import React, { useEffect, useMemo, useState } from "react";
|
import React, { useEffect, useMemo, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import copy from "copy-to-clipboard";
|
|
||||||
import { AlertBlock } from "@/components/shared/alert-block";
|
import { AlertBlock } from "@/components/shared/alert-block";
|
||||||
import { DateTooltip } from "@/components/shared/date-tooltip";
|
import { DateTooltip } from "@/components/shared/date-tooltip";
|
||||||
import { DialogAction } from "@/components/shared/dialog-action";
|
import { DialogAction } from "@/components/shared/dialog-action";
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export const ShowDockerLogs = ({ appName, serverId }: Props) => {
|
|||||||
}, [option, services, containers]);
|
}, [option, services, containers]);
|
||||||
|
|
||||||
const isLoading = option === "native" ? containersLoading : servicesLoading;
|
const isLoading = option === "native" ? containersLoading : servicesLoading;
|
||||||
const containersLenght =
|
const containersLength =
|
||||||
option === "native" ? containers?.length : services?.length;
|
option === "native" ? containers?.length : services?.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -167,7 +167,7 @@ export const ShowDockerLogs = ({ appName, serverId }: Props) => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<SelectLabel>Containers ({containersLenght})</SelectLabel>
|
<SelectLabel>Containers ({containersLength})</SelectLabel>
|
||||||
</SelectGroup>
|
</SelectGroup>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
export * from "./show-patches";
|
|
||||||
export * from "./patch-editor";
|
export * from "./patch-editor";
|
||||||
|
export * from "./show-patches";
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ export const HandleVolumeBackups = ({
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
<FormDescription>
|
<FormDescription>
|
||||||
Choose the volume to backup, if you dont see the
|
Choose the volume to backup. If you do not see the
|
||||||
volume here, you can type the volume name manually
|
volume here, you can type the volume name manually
|
||||||
</FormDescription>
|
</FormDescription>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@@ -518,7 +518,7 @@ export const HandleVolumeBackups = ({
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
<FormDescription>
|
<FormDescription>
|
||||||
Choose the volume to backup, if you dont see the volume
|
Choose the volume to backup. If you do not see the volume
|
||||||
here, you can type the volume name manually
|
here, you can type the volume name manually
|
||||||
</FormDescription>
|
</FormDescription>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export const ShowDockerLogsStack = ({ appName, serverId }: Props) => {
|
|||||||
}, [option, services, containers]);
|
}, [option, services, containers]);
|
||||||
|
|
||||||
const isLoading = option === "native" ? containersLoading : servicesLoading;
|
const isLoading = option === "native" ? containersLoading : servicesLoading;
|
||||||
const containersLenght =
|
const containersLength =
|
||||||
option === "native" ? containers?.length : services?.length;
|
option === "native" ? containers?.length : services?.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -152,7 +152,7 @@ export const ShowDockerLogsStack = ({ appName, serverId }: Props) => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<SelectLabel>Containers ({containersLenght})</SelectLabel>
|
<SelectLabel>Containers ({containersLength})</SelectLabel>
|
||||||
</SelectGroup>
|
</SelectGroup>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ export const RestoreBackup = ({
|
|||||||
resolver: zodResolver(RestoreBackupSchema),
|
resolver: zodResolver(RestoreBackupSchema),
|
||||||
});
|
});
|
||||||
|
|
||||||
const destionationId = form.watch("destinationId");
|
const destinationId = form.watch("destinationId");
|
||||||
const currentDatabaseType = form.watch("databaseType");
|
const currentDatabaseType = form.watch("databaseType");
|
||||||
const metadata = form.watch("metadata");
|
const metadata = form.watch("metadata");
|
||||||
|
|
||||||
@@ -240,12 +240,12 @@ export const RestoreBackup = ({
|
|||||||
|
|
||||||
const { data: files = [], isPending } = api.backup.listBackupFiles.useQuery(
|
const { data: files = [], isPending } = api.backup.listBackupFiles.useQuery(
|
||||||
{
|
{
|
||||||
destinationId: destionationId,
|
destinationId: destinationId,
|
||||||
search: debouncedSearchTerm,
|
search: debouncedSearchTerm,
|
||||||
serverId: serverId ?? "",
|
serverId: serverId ?? "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled: isOpen && !!destionationId,
|
enabled: isOpen && !!destinationId,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type { inferRouterOutputs } from "@trpc/server";
|
import type { inferRouterOutputs } from "@trpc/server";
|
||||||
import Link from "next/link";
|
|
||||||
import { ArrowRight, ListTodo, Loader2, XCircle } from "lucide-react";
|
import { ArrowRight, ListTodo, Loader2, XCircle } from "lucide-react";
|
||||||
|
import Link from "next/link";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export function TerminalLine({ log, noTimestamp, searchTerm }: LogLineProps) {
|
|||||||
>
|
>
|
||||||
{" "}
|
{" "}
|
||||||
<div className="flex items-start gap-x-2">
|
<div className="flex items-start gap-x-2">
|
||||||
{/* Icon to expand the log item maybe implement a colapsible later */}
|
{/* Icon to expand the log item maybe implement a collapsible later */}
|
||||||
{/* <Square className="size-4 text-muted-foreground opacity-0 group-hover/logitem:opacity-100 transition-opacity" /> */}
|
{/* <Square className="size-4 text-muted-foreground opacity-0 group-hover/logitem:opacity-100 transition-opacity" /> */}
|
||||||
{tooltip(color, rawTimestamp)}
|
{tooltip(color, rawTimestamp)}
|
||||||
{!noTimestamp && (
|
{!noTimestamp && (
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
} from "@/components/ui/table";
|
} from "@/components/ui/table";
|
||||||
import { api, type RouterOutputs } from "@/utils/api";
|
import { api, type RouterOutputs } from "@/utils/api";
|
||||||
import { columns } from "./colums";
|
import { columns } from "./columns";
|
||||||
export type Container = NonNullable<
|
export type Container = NonNullable<
|
||||||
RouterOutputs["docker"]["getContainers"]
|
RouterOutputs["docker"]["getContainers"]
|
||||||
>[0];
|
>[0];
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
acummulativeData: DockerStatsJSON["block"];
|
accumulativeData: DockerStatsJSON["block"];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DockerBlockChart = ({ acummulativeData }: Props) => {
|
export const DockerBlockChart = ({ accumulativeData }: Props) => {
|
||||||
const transformedData = acummulativeData.map((item, index) => {
|
const transformedData = accumulativeData.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
time: item.time,
|
time: item.time,
|
||||||
name: `Point ${index + 1}`,
|
name: `Point ${index + 1}`,
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
acummulativeData: DockerStatsJSON["cpu"];
|
accumulativeData: DockerStatsJSON["cpu"];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DockerCpuChart = ({ acummulativeData }: Props) => {
|
export const DockerCpuChart = ({ accumulativeData }: Props) => {
|
||||||
const transformedData = acummulativeData.map((item, index) => {
|
const transformedData = accumulativeData.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
name: `Point ${index + 1}`,
|
name: `Point ${index + 1}`,
|
||||||
time: item.time,
|
time: item.time,
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import {
|
|||||||
import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
acummulativeData: DockerStatsJSON["disk"];
|
accumulativeData: DockerStatsJSON["disk"];
|
||||||
diskTotal: number;
|
diskTotal: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DockerDiskChart = ({ acummulativeData, diskTotal }: Props) => {
|
export const DockerDiskChart = ({ accumulativeData, diskTotal }: Props) => {
|
||||||
const transformedData = acummulativeData.map((item, index) => {
|
const transformedData = accumulativeData.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
time: item.time,
|
time: item.time,
|
||||||
name: `Point ${index + 1}`,
|
name: `Point ${index + 1}`,
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
|||||||
import { convertMemoryToBytes } from "./show-free-container-monitoring";
|
import { convertMemoryToBytes } from "./show-free-container-monitoring";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
acummulativeData: DockerStatsJSON["memory"];
|
accumulativeData: DockerStatsJSON["memory"];
|
||||||
memoryLimitGB: number;
|
memoryLimitGB: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DockerMemoryChart = ({
|
export const DockerMemoryChart = ({
|
||||||
acummulativeData,
|
accumulativeData,
|
||||||
memoryLimitGB,
|
memoryLimitGB,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const transformedData = acummulativeData.map((item, index) => {
|
const transformedData = accumulativeData.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
time: item.time,
|
time: item.time,
|
||||||
name: `Point ${index + 1}`,
|
name: `Point ${index + 1}`,
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
import type { DockerStatsJSON } from "./show-free-container-monitoring";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
acummulativeData: DockerStatsJSON["network"];
|
accumulativeData: DockerStatsJSON["network"];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DockerNetworkChart = ({ acummulativeData }: Props) => {
|
export const DockerNetworkChart = ({ accumulativeData }: Props) => {
|
||||||
const transformedData = acummulativeData.map((item, index) => {
|
const transformedData = accumulativeData.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
time: item.time,
|
time: item.time,
|
||||||
name: `Point ${index + 1}`,
|
name: `Point ${index + 1}`,
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const [acummulativeData, setAcummulativeData] = useState<DockerStatsJSON>({
|
const [accumulativeData, setAccumulativeData] = useState<DockerStatsJSON>({
|
||||||
cpu: [],
|
cpu: [],
|
||||||
memory: [],
|
memory: [],
|
||||||
block: [],
|
block: [],
|
||||||
@@ -136,7 +136,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentData(defaultData);
|
setCurrentData(defaultData);
|
||||||
|
|
||||||
setAcummulativeData({
|
setAccumulativeData({
|
||||||
cpu: [],
|
cpu: [],
|
||||||
memory: [],
|
memory: [],
|
||||||
block: [],
|
block: [],
|
||||||
@@ -155,7 +155,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
network: data.network[data.network.length - 1] ?? currentData.network,
|
network: data.network[data.network.length - 1] ?? currentData.network,
|
||||||
disk: data.disk[data.disk.length - 1] ?? currentData.disk,
|
disk: data.disk[data.disk.length - 1] ?? currentData.disk,
|
||||||
});
|
});
|
||||||
setAcummulativeData({
|
setAccumulativeData({
|
||||||
block: data?.block || [],
|
block: data?.block || [],
|
||||||
cpu: data?.cpu || [],
|
cpu: data?.cpu || [],
|
||||||
disk: data?.disk || [],
|
disk: data?.disk || [],
|
||||||
@@ -184,7 +184,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
setCurrentData(data);
|
setCurrentData(data);
|
||||||
|
|
||||||
const MAX_DATA_POINTS = 300;
|
const MAX_DATA_POINTS = 300;
|
||||||
setAcummulativeData((prevData) => ({
|
setAccumulativeData((prevData) => ({
|
||||||
cpu: [...prevData.cpu, data.cpu].slice(-MAX_DATA_POINTS),
|
cpu: [...prevData.cpu, data.cpu].slice(-MAX_DATA_POINTS),
|
||||||
memory: [...prevData.memory, data.memory].slice(-MAX_DATA_POINTS),
|
memory: [...prevData.memory, data.memory].slice(-MAX_DATA_POINTS),
|
||||||
block: [...prevData.block, data.block].slice(-MAX_DATA_POINTS),
|
block: [...prevData.block, data.block].slice(-MAX_DATA_POINTS),
|
||||||
@@ -228,7 +228,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
)}
|
)}
|
||||||
className="w-[100%]"
|
className="w-[100%]"
|
||||||
/>
|
/>
|
||||||
<DockerCpuChart acummulativeData={acummulativeData.cpu} />
|
<DockerCpuChart accumulativeData={accumulativeData.cpu} />
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -252,7 +252,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
className="w-[100%]"
|
className="w-[100%]"
|
||||||
/>
|
/>
|
||||||
<DockerMemoryChart
|
<DockerMemoryChart
|
||||||
acummulativeData={acummulativeData.memory}
|
accumulativeData={accumulativeData.memory}
|
||||||
memoryLimitGB={
|
memoryLimitGB={
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
convertMemoryToBytes(currentData.memory.value.total) /
|
convertMemoryToBytes(currentData.memory.value.total) /
|
||||||
@@ -277,7 +277,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
className="w-[100%]"
|
className="w-[100%]"
|
||||||
/>
|
/>
|
||||||
<DockerDiskChart
|
<DockerDiskChart
|
||||||
acummulativeData={acummulativeData.disk}
|
accumulativeData={accumulativeData.disk}
|
||||||
diskTotal={currentData.disk.value.diskTotal}
|
diskTotal={currentData.disk.value.diskTotal}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -294,7 +294,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
<span className="text-sm text-muted-foreground">
|
<span className="text-sm text-muted-foreground">
|
||||||
{`Read: ${currentData.block.value.readMb} / Write: ${currentData.block.value.writeMb} `}
|
{`Read: ${currentData.block.value.readMb} / Write: ${currentData.block.value.writeMb} `}
|
||||||
</span>
|
</span>
|
||||||
<DockerBlockChart acummulativeData={acummulativeData.block} />
|
<DockerBlockChart accumulativeData={accumulativeData.block} />
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -307,7 +307,7 @@ export const ContainerFreeMonitoring = ({
|
|||||||
<span className="text-sm text-muted-foreground">
|
<span className="text-sm text-muted-foreground">
|
||||||
{`In MB: ${currentData.network.value.inputMb} / Out MB: ${currentData.network.value.outputMb} `}
|
{`In MB: ${currentData.network.value.inputMb} / Out MB: ${currentData.network.value.outputMb} `}
|
||||||
</span>
|
</span>
|
||||||
<DockerNetworkChart acummulativeData={acummulativeData.network} />
|
<DockerNetworkChart accumulativeData={accumulativeData.network} />
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
ADDITIONAL_FLAG_ERROR,
|
||||||
|
ADDITIONAL_FLAG_REGEX,
|
||||||
|
} from "@dokploy/server/db/validations/destination";
|
||||||
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
|
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
|
||||||
import { PenBoxIcon, PlusIcon, Trash2 } from "lucide-react";
|
import { PenBoxIcon, PlusIcon, Trash2 } from "lucide-react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
@@ -35,10 +39,6 @@ import {
|
|||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
import {
|
|
||||||
ADDITIONAL_FLAG_ERROR,
|
|
||||||
ADDITIONAL_FLAG_REGEX,
|
|
||||||
} from "@dokploy/server/db/validations/destination";
|
|
||||||
import { S3_PROVIDERS } from "./constants";
|
import { S3_PROVIDERS } from "./constants";
|
||||||
|
|
||||||
const addDestination = z.object({
|
const addDestination = z.object({
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ export const AddGitlabProvider = () => {
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="For organization/group access use the slugish name of the group eg: my-org"
|
placeholder="For organization/group access use the slug name of the group eg: my-org"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
|
|||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="For organization/group access use the slugish name of the group eg: my-org"
|
placeholder="For organization/group access use the slug name of the group eg: my-org"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ export const SetupServer = ({ serverId, asButton = false }: Props) => {
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
1. Add the public SSH Key when you create a server in your
|
1. Add the public SSH Key when you create a server in your
|
||||||
preffered provider (Hostinger, Digital Ocean, Hetzner,
|
preferred provider (Hostinger, Digital Ocean, Hetzner,
|
||||||
etc){" "}
|
etc){" "}
|
||||||
</li>
|
</li>
|
||||||
<li>2. Add The SSH Key to Server Manually</li>
|
<li>2. Add The SSH Key to Server Manually</li>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import { ShowMonitoringModal } from "./show-monitoring-modal";
|
|||||||
import { ShowSchedulesModal } from "./show-schedules-modal";
|
import { ShowSchedulesModal } from "./show-schedules-modal";
|
||||||
import { ShowSwarmOverviewModal } from "./show-swarm-overview-modal";
|
import { ShowSwarmOverviewModal } from "./show-swarm-overview-modal";
|
||||||
import { ShowTraefikFileSystemModal } from "./show-traefik-file-system-modal";
|
import { ShowTraefikFileSystemModal } from "./show-traefik-file-system-modal";
|
||||||
import { WelcomeSuscription } from "./welcome-stripe/welcome-suscription";
|
import { WelcomeSubscription } from "./welcome-stripe/welcome-subscription";
|
||||||
|
|
||||||
export const ShowServers = () => {
|
export const ShowServers = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -63,7 +63,7 @@ export const ShowServers = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
{query?.success && isCloud && <WelcomeSuscription />}
|
{query?.success && isCloud && <WelcomeSubscription />}
|
||||||
<Card className="h-full p-2.5 rounded-xl max-w-5xl mx-auto">
|
<Card className="h-full p-2.5 rounded-xl max-w-5xl mx-auto">
|
||||||
<div className="rounded-xl bg-background shadow-md ">
|
<div className="rounded-xl bg-background shadow-md ">
|
||||||
<CardHeader className="">
|
<CardHeader className="">
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export const { useStepper, steps, Scoped } = defineStepper(
|
|||||||
{ id: "complete", title: "Complete", description: "Checkout complete" },
|
{ id: "complete", title: "Complete", description: "Checkout complete" },
|
||||||
);
|
);
|
||||||
|
|
||||||
export const WelcomeSuscription = () => {
|
export const WelcomeSubscription = () => {
|
||||||
const [showConfetti, setShowConfetti] = useState(false);
|
const [showConfetti, setShowConfetti] = useState(false);
|
||||||
const stepper = useStepper();
|
const stepper = useStepper();
|
||||||
const [isOpen, setIsOpen] = useState(true);
|
const [isOpen, setIsOpen] = useState(true);
|
||||||
@@ -153,7 +153,7 @@ export const ChangeRole = ({ memberId, currentRole, userEmail }: Props) => {
|
|||||||
)}
|
)}
|
||||||
<br />
|
<br />
|
||||||
<em className="text-muted-foreground text-xs">
|
<em className="text-muted-foreground text-xs">
|
||||||
Note: Owner role is intransferible.
|
Note: Owner role is nontransferable.
|
||||||
</em>
|
</em>
|
||||||
</FormDescription>
|
</FormDescription>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export const ShowUsers = () => {
|
|||||||
// Can change role based on hierarchy:
|
// Can change role based on hierarchy:
|
||||||
// - Owner: Can change anyone's role (except themselves and other owners)
|
// - Owner: Can change anyone's role (except themselves and other owners)
|
||||||
// - Admin: Can only change member/custom roles (not other admins or owners)
|
// - Admin: Can only change member/custom roles (not other admins or owners)
|
||||||
// - Owner role is intransferible
|
// - Owner role is nontransferable
|
||||||
const canChangeRole =
|
const canChangeRole =
|
||||||
member.role !== "owner" &&
|
member.role !== "owner" &&
|
||||||
member.user.id !== session?.user?.id &&
|
member.user.id !== session?.user?.id &&
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ const BreadcrumbEllipsis = ({
|
|||||||
<span className="sr-only">More</span>
|
<span className="sr-only">More</span>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
|
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ interface TreeDataItem {
|
|||||||
|
|
||||||
type TreeProps = React.HTMLAttributes<HTMLDivElement> & {
|
type TreeProps = React.HTMLAttributes<HTMLDivElement> & {
|
||||||
data: TreeDataItem[] | TreeDataItem;
|
data: TreeDataItem[] | TreeDataItem;
|
||||||
initialSlelectedItemId?: string;
|
initialSelectedItemId?: string;
|
||||||
onSelectChange?: (item: TreeDataItem | undefined) => void;
|
onSelectChange?: (item: TreeDataItem | undefined) => void;
|
||||||
expandAll?: boolean;
|
expandAll?: boolean;
|
||||||
folderIcon?: LucideIcon;
|
folderIcon?: LucideIcon;
|
||||||
@@ -30,7 +30,7 @@ const Tree = React.forwardRef<HTMLDivElement, TreeProps>(
|
|||||||
(
|
(
|
||||||
{
|
{
|
||||||
data,
|
data,
|
||||||
initialSlelectedItemId,
|
initialSelectedItemId,
|
||||||
onSelectChange,
|
onSelectChange,
|
||||||
expandAll,
|
expandAll,
|
||||||
folderIcon,
|
folderIcon,
|
||||||
@@ -42,7 +42,7 @@ const Tree = React.forwardRef<HTMLDivElement, TreeProps>(
|
|||||||
) => {
|
) => {
|
||||||
const [selectedItemId, setSelectedItemId] = React.useState<
|
const [selectedItemId, setSelectedItemId] = React.useState<
|
||||||
string | undefined
|
string | undefined
|
||||||
>(initialSlelectedItemId);
|
>(initialSelectedItemId);
|
||||||
|
|
||||||
const handleSelectChange = React.useCallback(
|
const handleSelectChange = React.useCallback(
|
||||||
(item: TreeDataItem | undefined) => {
|
(item: TreeDataItem | undefined) => {
|
||||||
@@ -55,7 +55,7 @@ const Tree = React.forwardRef<HTMLDivElement, TreeProps>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const expandedItemIds = React.useMemo(() => {
|
const expandedItemIds = React.useMemo(() => {
|
||||||
if (!initialSlelectedItemId) {
|
if (!initialSelectedItemId) {
|
||||||
return [] as string[];
|
return [] as string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,9 +81,9 @@ const Tree = React.forwardRef<HTMLDivElement, TreeProps>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
walkTreeItems(data, initialSlelectedItemId);
|
walkTreeItems(data, initialSelectedItemId);
|
||||||
return ids;
|
return ids;
|
||||||
}, [data, initialSlelectedItemId]);
|
}, [data, initialSelectedItemId]);
|
||||||
|
|
||||||
const { ref: refRoot } = useResizeObserver();
|
const { ref: refRoot } = useResizeObserver();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ssoClient } from "@better-auth/sso/client";
|
|
||||||
import { apiKeyClient } from "@better-auth/api-key/client";
|
import { apiKeyClient } from "@better-auth/api-key/client";
|
||||||
|
import { ssoClient } from "@better-auth/sso/client";
|
||||||
import {
|
import {
|
||||||
adminClient,
|
adminClient,
|
||||||
inferAdditionalFields,
|
inferAdditionalFields,
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ export default async function handler(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const commitedPaths = await extractCommitedPaths(
|
const committedPaths = await extractCommittedPaths(
|
||||||
req.body,
|
req.body,
|
||||||
application.bitbucket,
|
application.bitbucket,
|
||||||
application.bitbucketRepositorySlug ||
|
application.bitbucketRepositorySlug ||
|
||||||
@@ -206,7 +206,7 @@ export default async function handler(
|
|||||||
|
|
||||||
const shouldDeployPaths = shouldDeploy(
|
const shouldDeployPaths = shouldDeploy(
|
||||||
application.watchPaths,
|
application.watchPaths,
|
||||||
commitedPaths,
|
committedPaths,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!shouldDeployPaths) {
|
if (!shouldDeployPaths) {
|
||||||
@@ -538,7 +538,7 @@ export const getProviderByHeader = (headers: any) => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const extractCommitedPaths = async (
|
export const extractCommittedPaths = async (
|
||||||
body: any,
|
body: any,
|
||||||
bitbucket: Bitbucket | null,
|
bitbucket: Bitbucket | null,
|
||||||
repository: string,
|
repository: string,
|
||||||
@@ -548,7 +548,7 @@ export const extractCommitedPaths = async (
|
|||||||
const commitHashes = changes
|
const commitHashes = changes
|
||||||
.map((change: any) => change.new?.target?.hash)
|
.map((change: any) => change.new?.target?.hash)
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
const commitedPaths: string[] = [];
|
const committedPaths: string[] = [];
|
||||||
const username =
|
const username =
|
||||||
bitbucket?.bitbucketWorkspaceName || bitbucket?.bitbucketUsername || "";
|
bitbucket?.bitbucketWorkspaceName || bitbucket?.bitbucketUsername || "";
|
||||||
for (const commit of commitHashes) {
|
for (const commit of commitHashes) {
|
||||||
@@ -559,7 +559,7 @@ export const extractCommitedPaths = async (
|
|||||||
});
|
});
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
for (const value of data.values) {
|
for (const value of data.values) {
|
||||||
if (value?.new?.path) commitedPaths.push(value.new.path);
|
if (value?.new?.path) committedPaths.push(value.new.path);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
@@ -571,5 +571,5 @@ export const extractCommitedPaths = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return commitedPaths;
|
return committedPaths;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import { myQueue } from "@/server/queues/queueSetup";
|
|||||||
import { deploy } from "@/server/utils/deploy";
|
import { deploy } from "@/server/utils/deploy";
|
||||||
import {
|
import {
|
||||||
extractBranchName,
|
extractBranchName,
|
||||||
extractCommitedPaths,
|
|
||||||
extractCommitMessage,
|
extractCommitMessage,
|
||||||
|
extractCommittedPaths,
|
||||||
extractHash,
|
extractHash,
|
||||||
getProviderByHeader,
|
getProviderByHeader,
|
||||||
} from "../[refreshToken]";
|
} from "../[refreshToken]";
|
||||||
@@ -97,7 +97,7 @@ export default async function handler(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const commitedPaths = await extractCommitedPaths(
|
const committedPaths = await extractCommittedPaths(
|
||||||
req.body,
|
req.body,
|
||||||
composeResult.bitbucket,
|
composeResult.bitbucket,
|
||||||
composeResult.bitbucketRepositorySlug ||
|
composeResult.bitbucketRepositorySlug ||
|
||||||
@@ -107,7 +107,7 @@ export default async function handler(
|
|||||||
|
|
||||||
const shouldDeployPaths = shouldDeploy(
|
const shouldDeployPaths = shouldDeploy(
|
||||||
composeResult.watchPaths,
|
composeResult.watchPaths,
|
||||||
commitedPaths,
|
committedPaths,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!shouldDeployPaths) {
|
if (!shouldDeployPaths) {
|
||||||
|
|||||||
@@ -174,27 +174,27 @@ export default async function handler(
|
|||||||
case "invoice.payment_succeeded": {
|
case "invoice.payment_succeeded": {
|
||||||
const newInvoice = event.data.object as Stripe.Invoice;
|
const newInvoice = event.data.object as Stripe.Invoice;
|
||||||
|
|
||||||
const suscription = await stripe.subscriptions.retrieve(
|
const subscription = await stripe.subscriptions.retrieve(
|
||||||
newInvoice.subscription as string,
|
newInvoice.subscription as string,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (suscription.status !== "active") {
|
if (subscription.status !== "active") {
|
||||||
console.log(
|
console.log(
|
||||||
`Skipping invoice.payment_succeeded for subscription ${suscription.id} with status ${suscription.status}`,
|
`Skipping invoice.payment_succeeded for subscription ${subscription.id} with status ${subscription.status}`,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const serversQuantity = getSubscriptionServersQuantity(
|
const serversQuantity = getSubscriptionServersQuantity(
|
||||||
suscription?.items?.data ?? [],
|
subscription?.items?.data ?? [],
|
||||||
);
|
);
|
||||||
await db
|
await db
|
||||||
.update(user)
|
.update(user)
|
||||||
.set({ serversQuantity })
|
.set({ serversQuantity })
|
||||||
.where(eq(user.stripeCustomerId, suscription.customer as string));
|
.where(eq(user.stripeCustomerId, subscription.customer as string));
|
||||||
|
|
||||||
const admin = await findUserByStripeCustomerId(
|
const admin = await findUserByStripeCustomerId(
|
||||||
suscription.customer as string,
|
subscription.customer as string,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!admin) {
|
if (!admin) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { ShowImport } from "@/components/dashboard/application/advanced/import/s
|
|||||||
import { ShowVolumes } from "@/components/dashboard/application/advanced/volumes/show-volumes";
|
import { ShowVolumes } from "@/components/dashboard/application/advanced/volumes/show-volumes";
|
||||||
import { ShowDeployments } from "@/components/dashboard/application/deployments/show-deployments";
|
import { ShowDeployments } from "@/components/dashboard/application/deployments/show-deployments";
|
||||||
import { ShowDomains } from "@/components/dashboard/application/domains/show-domains";
|
import { ShowDomains } from "@/components/dashboard/application/domains/show-domains";
|
||||||
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-enviroment";
|
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-environment";
|
||||||
import { ShowPatches } from "@/components/dashboard/application/patches/show-patches";
|
import { ShowPatches } from "@/components/dashboard/application/patches/show-patches";
|
||||||
import { ShowSchedules } from "@/components/dashboard/application/schedules/show-schedules";
|
import { ShowSchedules } from "@/components/dashboard/application/schedules/show-schedules";
|
||||||
import { ShowVolumeBackups } from "@/components/dashboard/application/volume-backups/show-volume-backups";
|
import { ShowVolumeBackups } from "@/components/dashboard/application/volume-backups/show-volume-backups";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { type ReactElement, useState } from "react";
|
import { type ReactElement, useState } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-enviroment";
|
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-environment";
|
||||||
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
||||||
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
||||||
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { type ReactElement, useState } from "react";
|
import { type ReactElement, useState } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-enviroment";
|
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-environment";
|
||||||
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
||||||
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
||||||
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { type ReactElement, useState } from "react";
|
import { type ReactElement, useState } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-enviroment";
|
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-environment";
|
||||||
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
||||||
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
||||||
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { type ReactElement, useState } from "react";
|
import { type ReactElement, useState } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-enviroment";
|
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-environment";
|
||||||
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
||||||
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
||||||
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { type ReactElement, useState } from "react";
|
import { type ReactElement, useState } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-enviroment";
|
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-environment";
|
||||||
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
||||||
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
||||||
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
import { ShowBackups } from "@/components/dashboard/database/backups/show-backups";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { type ReactElement, useState } from "react";
|
import { type ReactElement, useState } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-enviroment";
|
import { ShowEnvironment } from "@/components/dashboard/application/environment/show-environment";
|
||||||
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
import { ShowDockerLogs } from "@/components/dashboard/application/logs/show";
|
||||||
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
import { DeleteService } from "@/components/dashboard/compose/delete-service";
|
||||||
import { ContainerFreeMonitoring } from "@/components/dashboard/monitoring/free/container/show-free-container-monitoring";
|
import { ContainerFreeMonitoring } from "@/components/dashboard/monitoring/free/container/show-free-container-monitoring";
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { createServerSideHelpers } from "@trpc/react-query/server";
|
|||||||
import type { GetServerSidePropsContext } from "next";
|
import type { GetServerSidePropsContext } from "next";
|
||||||
import type { ReactElement } from "react";
|
import type { ReactElement } from "react";
|
||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
import { DashboardLayout } from "@/components/layouts/dashboard-layout";
|
|
||||||
import { ManageCustomRoles } from "@/components/proprietary/roles/manage-custom-roles";
|
|
||||||
import { ShowInvitations } from "@/components/dashboard/settings/users/show-invitations";
|
import { ShowInvitations } from "@/components/dashboard/settings/users/show-invitations";
|
||||||
import { ShowUsers } from "@/components/dashboard/settings/users/show-users";
|
import { ShowUsers } from "@/components/dashboard/settings/users/show-users";
|
||||||
|
import { DashboardLayout } from "@/components/layouts/dashboard-layout";
|
||||||
|
import { ManageCustomRoles } from "@/components/proprietary/roles/manage-custom-roles";
|
||||||
import { appRouter } from "@/server/api/root";
|
import { appRouter } from "@/server/api/root";
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import {
|
|||||||
suggestVariants,
|
suggestVariants,
|
||||||
} from "@dokploy/server/services/ai";
|
} from "@dokploy/server/services/ai";
|
||||||
import { createComposeByTemplate } from "@dokploy/server/services/compose";
|
import { createComposeByTemplate } from "@dokploy/server/services/compose";
|
||||||
import { findProjectById } from "@dokploy/server/services/project";
|
|
||||||
import {
|
import {
|
||||||
addNewService,
|
addNewService,
|
||||||
checkServiceAccess,
|
checkServiceAccess,
|
||||||
} from "@dokploy/server/services/permission";
|
} from "@dokploy/server/services/permission";
|
||||||
|
import { findProjectById } from "@dokploy/server/services/project";
|
||||||
import {
|
import {
|
||||||
getProviderHeaders,
|
getProviderHeaders,
|
||||||
getProviderName,
|
getProviderName,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import {
|
|||||||
updateBackupById,
|
updateBackupById,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
import { findDestinationById } from "@dokploy/server/services/destination";
|
import { findDestinationById } from "@dokploy/server/services/destination";
|
||||||
|
import { checkServicePermissionAndAccess } from "@dokploy/server/services/permission";
|
||||||
import { runComposeBackup } from "@dokploy/server/utils/backups/compose";
|
import { runComposeBackup } from "@dokploy/server/utils/backups/compose";
|
||||||
import {
|
import {
|
||||||
getS3Credentials,
|
getS3Credentials,
|
||||||
@@ -53,7 +54,6 @@ import {
|
|||||||
protectedProcedure,
|
protectedProcedure,
|
||||||
withPermission,
|
withPermission,
|
||||||
} from "@/server/api/trpc";
|
} from "@/server/api/trpc";
|
||||||
import { checkServicePermissionAndAccess } from "@dokploy/server/services/permission";
|
|
||||||
import { audit } from "@/server/api/utils/audit";
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiCreateBackup,
|
apiCreateBackup,
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
import { db } from "@dokploy/server/db";
|
import { db } from "@dokploy/server/db";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import { createTRPCRouter, withPermission } from "@/server/api/trpc";
|
import { createTRPCRouter, withPermission } from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiCreateCertificate,
|
apiCreateCertificate,
|
||||||
apiFindCertificate,
|
apiFindCertificate,
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ import {
|
|||||||
updateCompose,
|
updateCompose,
|
||||||
updateDeploymentStatus,
|
updateDeploymentStatus,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
|
import { db } from "@dokploy/server/db";
|
||||||
import {
|
import {
|
||||||
addNewService,
|
addNewService,
|
||||||
checkServiceAccess,
|
checkServiceAccess,
|
||||||
checkServicePermissionAndAccess,
|
checkServicePermissionAndAccess,
|
||||||
findMemberByUserId,
|
findMemberByUserId,
|
||||||
} from "@dokploy/server/services/permission";
|
} from "@dokploy/server/services/permission";
|
||||||
import { db } from "@dokploy/server/db";
|
|
||||||
import {
|
import {
|
||||||
type CompleteTemplate,
|
type CompleteTemplate,
|
||||||
fetchTemplateFiles,
|
fetchTemplateFiles,
|
||||||
@@ -75,8 +75,8 @@ import {
|
|||||||
} from "@/server/queues/queueSetup";
|
} from "@/server/queues/queueSetup";
|
||||||
import { cancelDeployment, deploy } from "@/server/utils/deploy";
|
import { cancelDeployment, deploy } from "@/server/utils/deploy";
|
||||||
import { generatePassword } from "@/templates/utils";
|
import { generatePassword } from "@/templates/utils";
|
||||||
import { audit } from "../utils/audit";
|
|
||||||
import { createTRPCRouter, protectedProcedure, publicProcedure } from "../trpc";
|
import { createTRPCRouter, protectedProcedure, publicProcedure } from "../trpc";
|
||||||
|
import { audit } from "../utils/audit";
|
||||||
|
|
||||||
export const composeRouter = createTRPCRouter({
|
export const composeRouter = createTRPCRouter({
|
||||||
create: protectedProcedure
|
create: protectedProcedure
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
createDestintation,
|
createDestination,
|
||||||
execAsync,
|
execAsync,
|
||||||
execAsyncRemote,
|
execAsyncRemote,
|
||||||
findDestinationById,
|
findDestinationById,
|
||||||
@@ -25,7 +25,7 @@ export const destinationRouter = createTRPCRouter({
|
|||||||
.input(apiCreateDestination)
|
.input(apiCreateDestination)
|
||||||
.mutation(async ({ input, ctx }) => {
|
.mutation(async ({ input, ctx }) => {
|
||||||
try {
|
try {
|
||||||
const result = await createDestintation(
|
const result = await createDestination(
|
||||||
input,
|
input,
|
||||||
ctx.session.activeOrganizationId,
|
ctx.session.activeOrganizationId,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import { db } from "@dokploy/server/db";
|
|||||||
import { hasValidLicense } from "@dokploy/server/services/proprietary/license-key";
|
import { hasValidLicense } from "@dokploy/server/services/proprietary/license-key";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { desc, eq, inArray } from "drizzle-orm";
|
import { desc, eq, inArray } from "drizzle-orm";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import {
|
import {
|
||||||
createTRPCRouter,
|
createTRPCRouter,
|
||||||
protectedProcedure,
|
protectedProcedure,
|
||||||
withPermission,
|
withPermission,
|
||||||
} from "@/server/api/trpc";
|
} from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiRemoveGitProvider,
|
apiRemoveGitProvider,
|
||||||
apiToggleShareGitProvider,
|
apiToggleShareGitProvider,
|
||||||
|
|||||||
@@ -17,18 +17,18 @@ import {
|
|||||||
stopServiceRemote,
|
stopServiceRemote,
|
||||||
updateMongoById,
|
updateMongoById,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
|
import { db } from "@dokploy/server/db";
|
||||||
import {
|
import {
|
||||||
addNewService,
|
addNewService,
|
||||||
checkServiceAccess,
|
checkServiceAccess,
|
||||||
checkServicePermissionAndAccess,
|
checkServicePermissionAndAccess,
|
||||||
findMemberByUserId,
|
findMemberByUserId,
|
||||||
} from "@dokploy/server/services/permission";
|
} from "@dokploy/server/services/permission";
|
||||||
import { db } from "@dokploy/server/db";
|
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import { createTRPCRouter, protectedProcedure } from "@/server/api/trpc";
|
import { createTRPCRouter, protectedProcedure } from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiChangeMongoStatus,
|
apiChangeMongoStatus,
|
||||||
apiCreateMongo,
|
apiCreateMongo,
|
||||||
@@ -39,9 +39,10 @@ import {
|
|||||||
apiSaveEnvironmentVariablesMongo,
|
apiSaveEnvironmentVariablesMongo,
|
||||||
apiSaveExternalPortMongo,
|
apiSaveExternalPortMongo,
|
||||||
apiUpdateMongo,
|
apiUpdateMongo,
|
||||||
|
environments,
|
||||||
mongo as mongoTable,
|
mongo as mongoTable,
|
||||||
|
projects,
|
||||||
} from "@/server/db/schema";
|
} from "@/server/db/schema";
|
||||||
import { environments, projects } from "@/server/db/schema";
|
|
||||||
import { cancelJobs } from "@/server/utils/backup";
|
import { cancelJobs } from "@/server/utils/backup";
|
||||||
export const mongoRouter = createTRPCRouter({
|
export const mongoRouter = createTRPCRouter({
|
||||||
create: protectedProcedure
|
create: protectedProcedure
|
||||||
|
|||||||
@@ -17,18 +17,18 @@ import {
|
|||||||
stopServiceRemote,
|
stopServiceRemote,
|
||||||
updateMySqlById,
|
updateMySqlById,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
|
import { db } from "@dokploy/server/db";
|
||||||
import {
|
import {
|
||||||
addNewService,
|
addNewService,
|
||||||
checkServiceAccess,
|
checkServiceAccess,
|
||||||
checkServicePermissionAndAccess,
|
checkServicePermissionAndAccess,
|
||||||
findMemberByUserId,
|
findMemberByUserId,
|
||||||
} from "@dokploy/server/services/permission";
|
} from "@dokploy/server/services/permission";
|
||||||
import { db } from "@dokploy/server/db";
|
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import { createTRPCRouter, protectedProcedure } from "@/server/api/trpc";
|
import { createTRPCRouter, protectedProcedure } from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiChangeMySqlStatus,
|
apiChangeMySqlStatus,
|
||||||
apiCreateMySql,
|
apiCreateMySql,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { db } from "@dokploy/server/db";
|
import { db } from "@dokploy/server/db";
|
||||||
import { IS_CLOUD } from "@dokploy/server/index";
|
import { IS_CLOUD } from "@dokploy/server/index";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { and, desc, eq, exists } from "drizzle-orm";
|
import { and, desc, eq, exists } from "drizzle-orm";
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
invitation,
|
invitation,
|
||||||
member,
|
member,
|
||||||
@@ -409,11 +409,11 @@ export const organizationRouter = createTRPCRouter({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Owner role is intransferible - cannot change to or from owner
|
// Owner role is nontransferable - cannot change to or from owner
|
||||||
if (target.role === "owner" || input.role === "owner") {
|
if (target.role === "owner" || input.role === "owner") {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "FORBIDDEN",
|
code: "FORBIDDEN",
|
||||||
message: "The owner role is intransferible",
|
message: "The owner role is nontransferable",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,18 +18,18 @@ import {
|
|||||||
stopServiceRemote,
|
stopServiceRemote,
|
||||||
updatePostgresById,
|
updatePostgresById,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
|
import { db } from "@dokploy/server/db";
|
||||||
import {
|
import {
|
||||||
addNewService,
|
addNewService,
|
||||||
checkServiceAccess,
|
checkServiceAccess,
|
||||||
checkServicePermissionAndAccess,
|
checkServicePermissionAndAccess,
|
||||||
findMemberByUserId,
|
findMemberByUserId,
|
||||||
} from "@dokploy/server/services/permission";
|
} from "@dokploy/server/services/permission";
|
||||||
import { db } from "@dokploy/server/db";
|
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import { createTRPCRouter, protectedProcedure } from "@/server/api/trpc";
|
import { createTRPCRouter, protectedProcedure } from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiChangePostgresStatus,
|
apiChangePostgresStatus,
|
||||||
apiCreatePostgres,
|
apiCreatePostgres,
|
||||||
@@ -40,9 +40,10 @@ import {
|
|||||||
apiSaveEnvironmentVariablesPostgres,
|
apiSaveEnvironmentVariablesPostgres,
|
||||||
apiSaveExternalPortPostgres,
|
apiSaveExternalPortPostgres,
|
||||||
apiUpdatePostgres,
|
apiUpdatePostgres,
|
||||||
|
environments,
|
||||||
postgres as postgresTable,
|
postgres as postgresTable,
|
||||||
|
projects,
|
||||||
} from "@/server/db/schema";
|
} from "@/server/db/schema";
|
||||||
import { environments, projects } from "@/server/db/schema";
|
|
||||||
import { cancelJobs } from "@/server/utils/backup";
|
import { cancelJobs } from "@/server/utils/backup";
|
||||||
|
|
||||||
export const postgresRouter = createTRPCRouter({
|
export const postgresRouter = createTRPCRouter({
|
||||||
|
|||||||
@@ -16,18 +16,18 @@ import {
|
|||||||
stopServiceRemote,
|
stopServiceRemote,
|
||||||
updateRedisById,
|
updateRedisById,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
|
import { db } from "@dokploy/server/db";
|
||||||
import {
|
import {
|
||||||
addNewService,
|
addNewService,
|
||||||
checkServiceAccess,
|
checkServiceAccess,
|
||||||
checkServicePermissionAndAccess,
|
checkServicePermissionAndAccess,
|
||||||
findMemberByUserId,
|
findMemberByUserId,
|
||||||
} from "@dokploy/server/services/permission";
|
} from "@dokploy/server/services/permission";
|
||||||
import { db } from "@dokploy/server/db";
|
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import { createTRPCRouter, protectedProcedure } from "@/server/api/trpc";
|
import { createTRPCRouter, protectedProcedure } from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiChangeRedisStatus,
|
apiChangeRedisStatus,
|
||||||
apiCreateRedis,
|
apiCreateRedis,
|
||||||
@@ -38,9 +38,10 @@ import {
|
|||||||
apiSaveEnvironmentVariablesRedis,
|
apiSaveEnvironmentVariablesRedis,
|
||||||
apiSaveExternalPortRedis,
|
apiSaveExternalPortRedis,
|
||||||
apiUpdateRedis,
|
apiUpdateRedis,
|
||||||
|
environments,
|
||||||
|
projects,
|
||||||
redis as redisTable,
|
redis as redisTable,
|
||||||
} from "@/server/db/schema";
|
} from "@/server/db/schema";
|
||||||
import { environments, projects } from "@/server/db/schema";
|
|
||||||
export const redisRouter = createTRPCRouter({
|
export const redisRouter = createTRPCRouter({
|
||||||
create: protectedProcedure
|
create: protectedProcedure
|
||||||
.input(apiCreateRedis)
|
.input(apiCreateRedis)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
import { db } from "@dokploy/server/db";
|
import { db } from "@dokploy/server/db";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiCreateRegistry,
|
apiCreateRegistry,
|
||||||
apiFindOneRegistry,
|
apiFindOneRegistry,
|
||||||
@@ -19,7 +20,6 @@ import {
|
|||||||
apiUpdateRegistry,
|
apiUpdateRegistry,
|
||||||
registry,
|
registry,
|
||||||
} from "@/server/db/schema";
|
} from "@/server/db/schema";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import { createTRPCRouter, withPermission } from "../trpc";
|
import { createTRPCRouter, withPermission } from "../trpc";
|
||||||
export const registryRouter = createTRPCRouter({
|
export const registryRouter = createTRPCRouter({
|
||||||
create: withPermission("registry", "create")
|
create: withPermission("registry", "create")
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
updateScheduleSchema,
|
updateScheduleSchema,
|
||||||
} from "@dokploy/server/db/schema/schedule";
|
} from "@dokploy/server/db/schema/schedule";
|
||||||
import { runCommand } from "@dokploy/server/index";
|
import { runCommand } from "@dokploy/server/index";
|
||||||
|
import { checkServicePermissionAndAccess } from "@dokploy/server/services/permission";
|
||||||
import {
|
import {
|
||||||
createSchedule,
|
createSchedule,
|
||||||
deleteSchedule,
|
deleteSchedule,
|
||||||
@@ -18,7 +19,6 @@ import { asc, desc, eq } from "drizzle-orm";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import { removeJob, schedule } from "@/server/utils/backup";
|
import { removeJob, schedule } from "@/server/utils/backup";
|
||||||
import { checkServicePermissionAndAccess } from "@dokploy/server/services/permission";
|
|
||||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||||
export const scheduleRouter = createTRPCRouter({
|
export const scheduleRouter = createTRPCRouter({
|
||||||
create: protectedProcedure
|
create: protectedProcedure
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ import { observable } from "@trpc/server/observable";
|
|||||||
import { and, desc, eq, getTableColumns, isNotNull, sql } from "drizzle-orm";
|
import { and, desc, eq, getTableColumns, isNotNull, sql } from "drizzle-orm";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { updateServersBasedOnQuantity } from "@/pages/api/stripe/webhook";
|
import { updateServersBasedOnQuantity } from "@/pages/api/stripe/webhook";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import {
|
import {
|
||||||
createTRPCRouter,
|
createTRPCRouter,
|
||||||
protectedProcedure,
|
protectedProcedure,
|
||||||
withPermission,
|
withPermission,
|
||||||
} from "@/server/api/trpc";
|
} from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiCreateServer,
|
apiCreateServer,
|
||||||
apiFindOneServer,
|
apiFindOneServer,
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
import { db } from "@dokploy/server/db";
|
import { db } from "@dokploy/server/db";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { desc, eq } from "drizzle-orm";
|
import { desc, eq } from "drizzle-orm";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
|
||||||
import { createTRPCRouter, withPermission } from "@/server/api/trpc";
|
import { createTRPCRouter, withPermission } from "@/server/api/trpc";
|
||||||
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiCreateSshKey,
|
apiCreateSshKey,
|
||||||
apiFindOneSshKey,
|
apiFindOneSshKey,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => {
|
|||||||
* 2. INITIALIZATION
|
* 2. INITIALIZATION
|
||||||
*
|
*
|
||||||
* This is where the tRPC API is initialized, connecting the context and transformer. We also parse
|
* This is where the tRPC API is initialized, connecting the context and transformer. We also parse
|
||||||
* ZodErrors so that you get typesafety on the frontend if your procedure fails due to validation
|
* ZodErrors so that you get type safety on the frontend if your procedure fails due to validation
|
||||||
* errors on the backend.
|
* errors on the backend.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createAuditLog } from "@dokploy/server/services/proprietary/audit-log";
|
|
||||||
import type { AuditAction, AuditResourceType } from "@dokploy/server/db/schema";
|
import type { AuditAction, AuditResourceType } from "@dokploy/server/db/schema";
|
||||||
|
import { createAuditLog } from "@dokploy/server/services/proprietary/audit-log";
|
||||||
|
|
||||||
interface AuditCtx {
|
interface AuditCtx {
|
||||||
user: { id: string; email: string; role: string };
|
user: { id: string; email: string; role: string };
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { relations } from "drizzle-orm";
|
import { relations } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
|
boolean,
|
||||||
|
index,
|
||||||
|
integer,
|
||||||
pgTable,
|
pgTable,
|
||||||
text,
|
text,
|
||||||
timestamp,
|
timestamp,
|
||||||
boolean,
|
|
||||||
integer,
|
|
||||||
index,
|
|
||||||
uniqueIndex,
|
uniqueIndex,
|
||||||
} from "drizzle-orm/pg-core";
|
} from "drizzle-orm/pg-core";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export * from "./account";
|
export * from "./account";
|
||||||
export * from "./ai";
|
export * from "./ai";
|
||||||
export * from "./audit-log";
|
|
||||||
export * from "./application";
|
export * from "./application";
|
||||||
|
export * from "./audit-log";
|
||||||
export * from "./backups";
|
export * from "./backups";
|
||||||
export * from "./bitbucket";
|
export * from "./bitbucket";
|
||||||
export * from "./certificate";
|
export * from "./certificate";
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { relations } from "drizzle-orm";
|
import { relations } from "drizzle-orm";
|
||||||
import { boolean, integer, pgTable, text } from "drizzle-orm/pg-core";
|
import { boolean, integer, pgTable, text } from "drizzle-orm/pg-core";
|
||||||
import { serviceType } from "./mount";
|
|
||||||
import { createInsertSchema } from "drizzle-zod";
|
import { createInsertSchema } from "drizzle-zod";
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
@@ -11,6 +10,7 @@ import { destinations } from "./destination";
|
|||||||
import { libsql } from "./libsql";
|
import { libsql } from "./libsql";
|
||||||
import { mariadb } from "./mariadb";
|
import { mariadb } from "./mariadb";
|
||||||
import { mongo } from "./mongo";
|
import { mongo } from "./mongo";
|
||||||
|
import { serviceType } from "./mount";
|
||||||
import { mysql } from "./mysql";
|
import { mysql } from "./mysql";
|
||||||
import { postgres } from "./postgres";
|
import { postgres } from "./postgres";
|
||||||
import { redis } from "./redis";
|
import { redis } from "./redis";
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export * from "./utils/providers/raw";
|
|||||||
export * from "./utils/schedules/index";
|
export * from "./utils/schedules/index";
|
||||||
export * from "./utils/schedules/utils";
|
export * from "./utils/schedules/utils";
|
||||||
export * from "./utils/servers/remote-docker";
|
export * from "./utils/servers/remote-docker";
|
||||||
export * from "./utils/startup/cancell-deployments";
|
export * from "./utils/startup/cancel-deployments";
|
||||||
export * from "./utils/tracking/hubspot";
|
export * from "./utils/tracking/hubspot";
|
||||||
export * from "./utils/traefik/application";
|
export * from "./utils/traefik/application";
|
||||||
export * from "./utils/traefik/domain";
|
export * from "./utils/traefik/domain";
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
} from "@dokploy/server/utils/process/execAsync";
|
} from "@dokploy/server/utils/process/execAsync";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { desc, eq, and, inArray, or, sql } from "drizzle-orm";
|
import { and, desc, eq, inArray, or, sql } from "drizzle-orm";
|
||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
import {
|
import {
|
||||||
type Application,
|
type Application,
|
||||||
@@ -177,7 +177,7 @@ export const createDeployment = async (
|
|||||||
status: "error",
|
status: "error",
|
||||||
logPath: "",
|
logPath: "",
|
||||||
description: deployment.description || "",
|
description: deployment.description || "",
|
||||||
errorMessage: `An error have occured: ${error instanceof Error ? error.message : error}`,
|
errorMessage: `An error have occurred: ${error instanceof Error ? error.message : error}`,
|
||||||
startedAt: new Date().toISOString(),
|
startedAt: new Date().toISOString(),
|
||||||
finishedAt: new Date().toISOString(),
|
finishedAt: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
@@ -257,7 +257,7 @@ export const createDeploymentPreview = async (
|
|||||||
status: "error",
|
status: "error",
|
||||||
logPath: "",
|
logPath: "",
|
||||||
description: deployment.description || "",
|
description: deployment.description || "",
|
||||||
errorMessage: `An error have occured: ${error instanceof Error ? error.message : error}`,
|
errorMessage: `An error have occurred: ${error instanceof Error ? error.message : error}`,
|
||||||
startedAt: new Date().toISOString(),
|
startedAt: new Date().toISOString(),
|
||||||
finishedAt: new Date().toISOString(),
|
finishedAt: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
@@ -334,7 +334,7 @@ echo "Initializing deployment\n" >> ${logFilePath};
|
|||||||
status: "error",
|
status: "error",
|
||||||
logPath: "",
|
logPath: "",
|
||||||
description: deployment.description || "",
|
description: deployment.description || "",
|
||||||
errorMessage: `An error have occured: ${error instanceof Error ? error.message : error}`,
|
errorMessage: `An error have occurred: ${error instanceof Error ? error.message : error}`,
|
||||||
startedAt: new Date().toISOString(),
|
startedAt: new Date().toISOString(),
|
||||||
finishedAt: new Date().toISOString(),
|
finishedAt: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
@@ -418,7 +418,7 @@ echo "Initializing backup\n" >> ${logFilePath};
|
|||||||
status: "error",
|
status: "error",
|
||||||
logPath: "",
|
logPath: "",
|
||||||
description: deployment.description || "",
|
description: deployment.description || "",
|
||||||
errorMessage: `An error have occured: ${error instanceof Error ? error.message : error}`,
|
errorMessage: `An error have occurred: ${error instanceof Error ? error.message : error}`,
|
||||||
startedAt: new Date().toISOString(),
|
startedAt: new Date().toISOString(),
|
||||||
finishedAt: new Date().toISOString(),
|
finishedAt: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
@@ -493,7 +493,7 @@ export const createDeploymentSchedule = async (
|
|||||||
status: "error",
|
status: "error",
|
||||||
logPath: "",
|
logPath: "",
|
||||||
description: deployment.description || "",
|
description: deployment.description || "",
|
||||||
errorMessage: `An error have occured: ${error instanceof Error ? error.message : error}`,
|
errorMessage: `An error have occurred: ${error instanceof Error ? error.message : error}`,
|
||||||
startedAt: new Date().toISOString(),
|
startedAt: new Date().toISOString(),
|
||||||
finishedAt: new Date().toISOString(),
|
finishedAt: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
@@ -578,7 +578,7 @@ export const createDeploymentVolumeBackup = async (
|
|||||||
status: "error",
|
status: "error",
|
||||||
logPath: "",
|
logPath: "",
|
||||||
description: deployment.description || "",
|
description: deployment.description || "",
|
||||||
errorMessage: `An error have occured: ${error instanceof Error ? error.message : error}`,
|
errorMessage: `An error have occurred: ${error instanceof Error ? error.message : error}`,
|
||||||
startedAt: new Date().toISOString(),
|
startedAt: new Date().toISOString(),
|
||||||
finishedAt: new Date().toISOString(),
|
finishedAt: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type { z } from "zod";
|
|||||||
|
|
||||||
export type Destination = typeof destinations.$inferSelect;
|
export type Destination = typeof destinations.$inferSelect;
|
||||||
|
|
||||||
export const createDestintation = async (
|
export const createDestination = async (
|
||||||
input: z.infer<typeof apiCreateDestination>,
|
input: z.infer<typeof apiCreateDestination>,
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { db } from "@dokploy/server/db";
|
import { db } from "@dokploy/server/db";
|
||||||
import { auditLog } from "@dokploy/server/db/schema";
|
|
||||||
import type { AuditAction, AuditResourceType } from "@dokploy/server/db/schema";
|
import type { AuditAction, AuditResourceType } from "@dokploy/server/db/schema";
|
||||||
|
import { auditLog } from "@dokploy/server/db/schema";
|
||||||
import { hasValidLicense } from "@dokploy/server/services/proprietary/license-key";
|
import { hasValidLicense } from "@dokploy/server/services/proprietary/license-key";
|
||||||
import { and, desc, eq, gte, ilike, lte } from "drizzle-orm";
|
import { and, desc, eq, gte, ilike, lte } from "drizzle-orm";
|
||||||
|
|
||||||
|
|||||||
@@ -383,12 +383,12 @@ export const readPorts = async (
|
|||||||
const seenPorts = new Set<string>();
|
const seenPorts = new Set<string>();
|
||||||
for (const key in parsedResult) {
|
for (const key in parsedResult) {
|
||||||
if (Object.hasOwn(parsedResult, key)) {
|
if (Object.hasOwn(parsedResult, key)) {
|
||||||
const containerPortMapppings = parsedResult[key];
|
const containerPortMappings = parsedResult[key];
|
||||||
const protocol = key.split("/")[1];
|
const protocol = key.split("/")[1];
|
||||||
const targetPort = Number.parseInt(key.split("/")[0] ?? "0", 10);
|
const targetPort = Number.parseInt(key.split("/")[0] ?? "0", 10);
|
||||||
|
|
||||||
// Take only the first mapping to avoid duplicates (IPv4 and IPv6)
|
// Take only the first mapping to avoid duplicates (IPv4 and IPv6)
|
||||||
const firstMapping = containerPortMapppings[0];
|
const firstMapping = containerPortMappings[0];
|
||||||
if (firstMapping) {
|
if (firstMapping) {
|
||||||
const publishedPort = Number.parseInt(firstMapping.HostPort, 10);
|
const publishedPort = Number.parseInt(firstMapping.HostPort, 10);
|
||||||
const portKey = `${targetPort}-${publishedPort}-${protocol}`;
|
const portKey = `${targetPort}-${publishedPort}-${protocol}`;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export const canPerformAccessService = async (
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const canPeformDeleteService = async (
|
export const canPerformDeleteService = async (
|
||||||
userId: string,
|
userId: string,
|
||||||
serviceId: string,
|
serviceId: string,
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
@@ -215,7 +215,7 @@ export const checkServiceAccess = async (
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "delete":
|
case "delete":
|
||||||
hasPermission = await canPeformDeleteService(
|
hasPermission = await canPerformDeleteService(
|
||||||
userId,
|
userId,
|
||||||
serviceId,
|
serviceId,
|
||||||
organizationId,
|
organizationId,
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { docker } from "../constants";
|
|||||||
export const initializeSwarm = async () => {
|
export const initializeSwarm = async () => {
|
||||||
const swarmInitialized = await dockerSwarmInitialized();
|
const swarmInitialized = await dockerSwarmInitialized();
|
||||||
if (swarmInitialized) {
|
if (swarmInitialized) {
|
||||||
console.log("Swarm is already initilized");
|
console.log("Swarm is already initialized");
|
||||||
} else {
|
} else {
|
||||||
await docker.swarmInit({
|
await docker.swarmInit({
|
||||||
AdvertiseAddr: "127.0.0.1",
|
AdvertiseAddr: "127.0.0.1",
|
||||||
ListenAddr: "0.0.0.0",
|
ListenAddr: "0.0.0.0",
|
||||||
});
|
});
|
||||||
console.log("Swarm was initilized");
|
console.log("Swarm was initialized");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -26,14 +26,14 @@ export const dockerSwarmInitialized = async () => {
|
|||||||
export const initializeNetwork = async () => {
|
export const initializeNetwork = async () => {
|
||||||
const networkInitialized = await dockerNetworkInitialized();
|
const networkInitialized = await dockerNetworkInitialized();
|
||||||
if (networkInitialized) {
|
if (networkInitialized) {
|
||||||
console.log("Network is already initilized");
|
console.log("Network is already initialized");
|
||||||
} else {
|
} else {
|
||||||
docker.createNetwork({
|
docker.createNetwork({
|
||||||
Attachable: true,
|
Attachable: true,
|
||||||
Name: "dokploy-network",
|
Name: "dokploy-network",
|
||||||
Driver: "overlay",
|
Driver: "overlay",
|
||||||
});
|
});
|
||||||
console.log("Network was initilized");
|
console.log("Network was initialized");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { quote } from "shell-quote";
|
|||||||
import { writeDomainsToCompose } from "../docker/domain";
|
import { writeDomainsToCompose } from "../docker/domain";
|
||||||
import {
|
import {
|
||||||
encodeBase64,
|
encodeBase64,
|
||||||
getEnviromentVariablesObject,
|
getEnvironmentVariablesObject,
|
||||||
prepareEnvironmentVariables,
|
prepareEnvironmentVariables,
|
||||||
} from "../docker/utils";
|
} from "../docker/utils";
|
||||||
|
|
||||||
@@ -46,17 +46,17 @@ Compose Type: ${composeType} ✅`;
|
|||||||
set -e
|
set -e
|
||||||
{
|
{
|
||||||
echo "${logBox}";
|
echo "${logBox}";
|
||||||
|
|
||||||
${newCompose}
|
${newCompose}
|
||||||
|
|
||||||
${envCommand}
|
${envCommand}
|
||||||
|
|
||||||
cd "${projectPath}";
|
cd "${projectPath}";
|
||||||
|
|
||||||
${compose.isolatedDeployment ? `docker network inspect ${compose.appName} >/dev/null 2>&1 || docker network create ${compose.composeType === "stack" ? "--driver overlay" : ""} --attachable ${compose.appName}` : ""}
|
${compose.isolatedDeployment ? `docker network inspect ${compose.appName} >/dev/null 2>&1 || docker network create ${compose.composeType === "stack" ? "--driver overlay" : ""} --attachable ${compose.appName}` : ""}
|
||||||
env -i PATH="$PATH" ${exportEnvCommand} docker ${command.split(" ").join(" ")} 2>&1 || { echo "Error: ❌ Docker command failed"; exit 1; }
|
env -i PATH="$PATH" ${exportEnvCommand} docker ${command.split(" ").join(" ")} 2>&1 || { echo "Error: ❌ Docker command failed"; exit 1; }
|
||||||
${compose.isolatedDeployment ? `docker network connect ${compose.appName} $(docker ps --filter "name=dokploy-traefik" -q) >/dev/null 2>&1` : ""}
|
${compose.isolatedDeployment ? `docker network connect ${compose.appName} $(docker ps --filter "name=dokploy-traefik" -q) >/dev/null 2>&1` : ""}
|
||||||
|
|
||||||
echo "Docker Compose Deployed: ✅";
|
echo "Docker Compose Deployed: ✅";
|
||||||
} || {
|
} || {
|
||||||
echo "Error: ❌ Script execution failed";
|
echo "Error: ❌ Script execution failed";
|
||||||
@@ -131,7 +131,7 @@ echo "${encodedContent}" | base64 -d > "${envFilePath}";
|
|||||||
const getExportEnvCommand = (compose: ComposeNested) => {
|
const getExportEnvCommand = (compose: ComposeNested) => {
|
||||||
if (compose.composeType !== "stack") return "";
|
if (compose.composeType !== "stack") return "";
|
||||||
|
|
||||||
const envVars = getEnviromentVariablesObject(
|
const envVars = getEnvironmentVariablesObject(
|
||||||
compose.env,
|
compose.env,
|
||||||
compose.environment.project.env,
|
compose.environment.project.env,
|
||||||
compose.environment.env,
|
compose.environment.env,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
getEnviromentVariablesObject,
|
getEnvironmentVariablesObject,
|
||||||
prepareEnvironmentVariablesForShell,
|
prepareEnvironmentVariablesForShell,
|
||||||
} from "@dokploy/server/utils/docker/utils";
|
} from "@dokploy/server/utils/docker/utils";
|
||||||
import { quote } from "shell-quote";
|
import { quote } from "shell-quote";
|
||||||
@@ -52,7 +52,7 @@ export const getDockerCommand = (application: ApplicationNested) => {
|
|||||||
commandArgs.push("--build-arg", arg);
|
commandArgs.push("--build-arg", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const secrets = getEnviromentVariablesObject(
|
const secrets = getEnvironmentVariablesObject(
|
||||||
buildSecrets,
|
buildSecrets,
|
||||||
application.environment.project.env,
|
application.environment.project.env,
|
||||||
application.environment.env,
|
application.environment.env,
|
||||||
@@ -86,12 +86,12 @@ export const getDockerCommand = (application: ApplicationNested) => {
|
|||||||
|
|
||||||
command += `
|
command += `
|
||||||
echo "Building ${appName}" ;
|
echo "Building ${appName}" ;
|
||||||
cd ${dockerContextPath} || {
|
cd ${dockerContextPath} || {
|
||||||
echo "❌ The path ${dockerContextPath} does not exist" ;
|
echo "❌ The path ${dockerContextPath} does not exist" ;
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
${joinedSecrets} docker ${commandArgs.join(" ")} || {
|
${joinedSecrets} docker ${commandArgs.join(" ")} || {
|
||||||
echo "❌ Docker build failed" ;
|
echo "❌ Docker build failed" ;
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ export const parseEnvironmentKeyValuePair = (
|
|||||||
return [key, valueParts.join("=")];
|
return [key, valueParts.join("=")];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getEnviromentVariablesObject = (
|
export const getEnvironmentVariablesObject = (
|
||||||
input: string | null,
|
input: string | null,
|
||||||
projectEnv?: string | null,
|
projectEnv?: string | null,
|
||||||
environmentEnv?: string | null,
|
environmentEnv?: string | null,
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { findGithubById, type Github } from "@dokploy/server/services/github";
|
|||||||
import type { InferResultType } from "@dokploy/server/types/with";
|
import type { InferResultType } from "@dokploy/server/types/with";
|
||||||
import { createAppAuth } from "@octokit/auth-app";
|
import { createAppAuth } from "@octokit/auth-app";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import type { z } from "zod";
|
|
||||||
import { Octokit } from "octokit";
|
import { Octokit } from "octokit";
|
||||||
|
import type { z } from "zod";
|
||||||
|
|
||||||
export const authGithub = (githubProvider: Github): Octokit => {
|
export const authGithub = (githubProvider: Github): Octokit => {
|
||||||
if (!haveGithubRequirements(githubProvider)) {
|
if (!haveGithubRequirements(githubProvider)) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { paths } from "@dokploy/server/constants";
|
import { paths } from "@dokploy/server/constants";
|
||||||
import type { apiGitlabTestConnection } from "@dokploy/server/db/schema";
|
import type { apiGitlabTestConnection } from "@dokploy/server/db/schema";
|
||||||
import type { z } from "zod";
|
|
||||||
import {
|
import {
|
||||||
findGitlabById,
|
findGitlabById,
|
||||||
type Gitlab,
|
type Gitlab,
|
||||||
@@ -9,6 +8,7 @@ import {
|
|||||||
} from "@dokploy/server/services/gitlab";
|
} from "@dokploy/server/services/gitlab";
|
||||||
import type { InferResultType } from "@dokploy/server/types/with";
|
import type { InferResultType } from "@dokploy/server/types/with";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
|
import type { z } from "zod";
|
||||||
|
|
||||||
export const refreshGitlabToken = async (gitlabProviderId: string) => {
|
export const refreshGitlabToken = async (gitlabProviderId: string) => {
|
||||||
const gitlabProvider = await findGitlabById(gitlabProviderId);
|
const gitlabProvider = await findGitlabById(gitlabProviderId);
|
||||||
|
|||||||
Reference in New Issue
Block a user