mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-13 23:45:17 +00:00
chore: remove leftover Redis infrastructure code
Dokploy stopped using Redis in v0.29.9 when the deployment queue moved to an in-memory implementation, and install.sh no longer creates the dokploy-redis service. Remove the remaining references so fresh installs don't report Redis as unhealthy: - checkRedisHealth from infrastructure health check - cleanRedis/reloadRedis endpoints and their UI actions - initializeRedis dev setup and redis-connection config - unused bullmq dependency
This commit is contained in:
@@ -19,8 +19,6 @@ export const ShowDokployActions = () => {
|
|||||||
const { mutateAsync: reloadServer, isPending } =
|
const { mutateAsync: reloadServer, isPending } =
|
||||||
api.settings.reloadServer.useMutation();
|
api.settings.reloadServer.useMutation();
|
||||||
|
|
||||||
const { mutateAsync: cleanRedis } = api.settings.cleanRedis.useMutation();
|
|
||||||
const { mutateAsync: reloadRedis } = api.settings.reloadRedis.useMutation();
|
|
||||||
const { mutateAsync: cleanAllDeploymentQueue } =
|
const { mutateAsync: cleanAllDeploymentQueue } =
|
||||||
api.settings.cleanAllDeploymentQueue.useMutation();
|
api.settings.cleanAllDeploymentQueue.useMutation();
|
||||||
|
|
||||||
@@ -70,21 +68,6 @@ export const ShowDokployActions = () => {
|
|||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</UpdateServerIp>
|
</UpdateServerIp>
|
||||||
|
|
||||||
<DropdownMenuItem
|
|
||||||
className="cursor-pointer"
|
|
||||||
onClick={async () => {
|
|
||||||
await cleanRedis()
|
|
||||||
.then(async () => {
|
|
||||||
toast.success("Redis cleaned");
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
toast.error("Error cleaning Redis");
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Clean Redis
|
|
||||||
</DropdownMenuItem>
|
|
||||||
|
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
className="cursor-pointer"
|
className="cursor-pointer"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
@@ -99,21 +82,6 @@ export const ShowDokployActions = () => {
|
|||||||
>
|
>
|
||||||
Clean all deployment queue
|
Clean all deployment queue
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
|
||||||
<DropdownMenuItem
|
|
||||||
className="cursor-pointer"
|
|
||||||
onClick={async () => {
|
|
||||||
await reloadRedis()
|
|
||||||
.then(async () => {
|
|
||||||
toast.success("Redis reloaded");
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
toast.error("Error reloading Redis");
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Reload Redis
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuGroup>
|
</DropdownMenuGroup>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ type ServiceStatus = {
|
|||||||
|
|
||||||
type HealthResult = {
|
type HealthResult = {
|
||||||
postgres: ServiceStatus;
|
postgres: ServiceStatus;
|
||||||
redis: ServiceStatus;
|
|
||||||
traefik: ServiceStatus;
|
traefik: ServiceStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -89,7 +88,6 @@ export const UpdateWebServer = ({
|
|||||||
const allHealthy =
|
const allHealthy =
|
||||||
healthResult &&
|
healthResult &&
|
||||||
healthResult.postgres.status === "healthy" &&
|
healthResult.postgres.status === "healthy" &&
|
||||||
healthResult.redis.status === "healthy" &&
|
|
||||||
healthResult.traefik.status === "healthy";
|
healthResult.traefik.status === "healthy";
|
||||||
|
|
||||||
const checkIsUpdateFinished = async () => {
|
const checkIsUpdateFinished = async () => {
|
||||||
@@ -179,7 +177,7 @@ export const UpdateWebServer = ({
|
|||||||
{modalState === "checking" && (
|
{modalState === "checking" && (
|
||||||
<span className="flex items-center gap-2">
|
<span className="flex items-center gap-2">
|
||||||
<Loader2 className="animate-spin h-4 w-4" />
|
<Loader2 className="animate-spin h-4 w-4" />
|
||||||
Checking PostgreSQL, Redis and Traefik...
|
Checking PostgreSQL and Traefik...
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -190,10 +188,6 @@ export const UpdateWebServer = ({
|
|||||||
name="PostgreSQL"
|
name="PostgreSQL"
|
||||||
service={healthResult.postgres}
|
service={healthResult.postgres}
|
||||||
/>
|
/>
|
||||||
<ServiceStatusItem
|
|
||||||
name="Redis"
|
|
||||||
service={healthResult.redis}
|
|
||||||
/>
|
|
||||||
<ServiceStatusItem
|
<ServiceStatusItem
|
||||||
name="Traefik"
|
name="Traefik"
|
||||||
service={healthResult.traefik}
|
service={healthResult.traefik}
|
||||||
|
|||||||
@@ -86,7 +86,6 @@
|
|||||||
"better-auth": "1.6.23",
|
"better-auth": "1.6.23",
|
||||||
"bl": "6.0.11",
|
"bl": "6.0.11",
|
||||||
"boxen": "^7.1.1",
|
"boxen": "^7.1.1",
|
||||||
"bullmq": "5.67.3",
|
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cmdk": "^0.2.1",
|
"cmdk": "^0.2.1",
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {
|
|||||||
checkGPUStatus,
|
checkGPUStatus,
|
||||||
checkPortInUse,
|
checkPortInUse,
|
||||||
checkPostgresHealth,
|
checkPostgresHealth,
|
||||||
checkRedisHealth,
|
|
||||||
checkTraefikHealth,
|
checkTraefikHealth,
|
||||||
cleanupAll,
|
cleanupAll,
|
||||||
cleanupAllBackground,
|
cleanupAllBackground,
|
||||||
@@ -13,7 +12,6 @@ import {
|
|||||||
cleanupSystem,
|
cleanupSystem,
|
||||||
cleanupVolumes,
|
cleanupVolumes,
|
||||||
DEFAULT_UPDATE_DATA,
|
DEFAULT_UPDATE_DATA,
|
||||||
execAsync,
|
|
||||||
findServerById,
|
findServerById,
|
||||||
getDockerDiskUsage,
|
getDockerDiskUsage,
|
||||||
getDokployImageTag,
|
getDokployImageTag,
|
||||||
@@ -103,41 +101,6 @@ export const settingsRouter = createTRPCRouter({
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
cleanRedis: adminProcedure.mutation(async ({ ctx }) => {
|
|
||||||
if (IS_CLOUD) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { stdout: containerId } = await execAsync(
|
|
||||||
`docker ps --filter "name=dokploy-redis" --filter "status=running" -q | head -n 1`,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!containerId) {
|
|
||||||
throw new Error("Redis container not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
const redisContainerId = containerId.trim();
|
|
||||||
|
|
||||||
await execAsync(`docker exec -i ${redisContainerId} redis-cli flushall`);
|
|
||||||
await audit(ctx, {
|
|
||||||
action: "update",
|
|
||||||
resourceType: "settings",
|
|
||||||
resourceName: "clean-redis",
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}),
|
|
||||||
reloadRedis: adminProcedure.mutation(async ({ ctx }) => {
|
|
||||||
if (IS_CLOUD) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
await reloadDockerResource("dokploy-redis");
|
|
||||||
await audit(ctx, {
|
|
||||||
action: "reload",
|
|
||||||
resourceType: "settings",
|
|
||||||
resourceName: "dokploy-redis",
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}),
|
|
||||||
cleanAllDeploymentQueue: adminProcedure.mutation(async ({ ctx }) => {
|
cleanAllDeploymentQueue: adminProcedure.mutation(async ({ ctx }) => {
|
||||||
if (IS_CLOUD) {
|
if (IS_CLOUD) {
|
||||||
return true;
|
return true;
|
||||||
@@ -959,18 +922,16 @@ export const settingsRouter = createTRPCRouter({
|
|||||||
if (IS_CLOUD) {
|
if (IS_CLOUD) {
|
||||||
return {
|
return {
|
||||||
postgres: { status: "healthy" as const },
|
postgres: { status: "healthy" as const },
|
||||||
redis: { status: "healthy" as const },
|
|
||||||
traefik: { status: "healthy" as const },
|
traefik: { status: "healthy" as const },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const [postgres, redis, traefik] = await Promise.all([
|
const [postgres, traefik] = await Promise.all([
|
||||||
checkPostgresHealth(),
|
checkPostgresHealth(),
|
||||||
checkRedisHealth(),
|
|
||||||
checkTraefikHealth(),
|
checkTraefikHealth(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return { postgres, redis, traefik };
|
return { postgres, traefik };
|
||||||
}),
|
}),
|
||||||
setupGPU: adminProcedure
|
setupGPU: adminProcedure
|
||||||
.input(
|
.input(
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import type { ConnectionOptions } from "bullmq";
|
|
||||||
|
|
||||||
export const redisConfig: ConnectionOptions = {
|
|
||||||
host:
|
|
||||||
process.env.NODE_ENV === "production"
|
|
||||||
? process.env.REDIS_HOST || "dokploy-redis"
|
|
||||||
: "127.0.0.1",
|
|
||||||
};
|
|
||||||
@@ -6,7 +6,6 @@ const execAsync = promisify(exec);
|
|||||||
|
|
||||||
import { setupDirectories } from "@dokploy/server/setup/config-paths";
|
import { setupDirectories } from "@dokploy/server/setup/config-paths";
|
||||||
import { initializePostgres } from "@dokploy/server/setup/postgres-setup";
|
import { initializePostgres } from "@dokploy/server/setup/postgres-setup";
|
||||||
import { initializeRedis } from "@dokploy/server/setup/redis-setup";
|
|
||||||
import {
|
import {
|
||||||
initializeNetwork,
|
initializeNetwork,
|
||||||
initializeSwarm,
|
initializeSwarm,
|
||||||
@@ -29,7 +28,6 @@ import {
|
|||||||
createDefaultServerTraefikConfig();
|
createDefaultServerTraefikConfig();
|
||||||
await execAsync(`docker pull traefik:v${TRAEFIK_VERSION}`);
|
await execAsync(`docker pull traefik:v${TRAEFIK_VERSION}`);
|
||||||
await initializeStandaloneTraefik();
|
await initializeStandaloneTraefik();
|
||||||
await initializeRedis();
|
|
||||||
await initializePostgres();
|
await initializePostgres();
|
||||||
console.log("Dokploy setup completed");
|
console.log("Dokploy setup completed");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ export * from "./setup/config-paths";
|
|||||||
export * from "./setup/forward-auth-setup";
|
export * from "./setup/forward-auth-setup";
|
||||||
export * from "./setup/monitoring-setup";
|
export * from "./setup/monitoring-setup";
|
||||||
export * from "./setup/postgres-setup";
|
export * from "./setup/postgres-setup";
|
||||||
export * from "./setup/redis-setup";
|
|
||||||
export * from "./setup/server-audit";
|
export * from "./setup/server-audit";
|
||||||
export * from "./setup/server-setup";
|
export * from "./setup/server-setup";
|
||||||
export * from "./setup/server-validate";
|
export * from "./setup/server-validate";
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
import type { CreateServiceOptions } from "dockerode";
|
|
||||||
import { docker } from "../constants";
|
|
||||||
import { pullImage } from "../utils/docker/utils";
|
|
||||||
|
|
||||||
export const initializeRedis = async () => {
|
|
||||||
const imageName = "redis:8";
|
|
||||||
const containerName = "dokploy-redis";
|
|
||||||
|
|
||||||
const settings: CreateServiceOptions = {
|
|
||||||
Name: containerName,
|
|
||||||
TaskTemplate: {
|
|
||||||
ContainerSpec: {
|
|
||||||
Image: imageName,
|
|
||||||
Mounts: [
|
|
||||||
{
|
|
||||||
Type: "volume",
|
|
||||||
Source: "dokploy-redis",
|
|
||||||
Target: "/data",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
Networks: [{ Target: "dokploy-network" }],
|
|
||||||
Placement: {
|
|
||||||
Constraints: ["node.role==manager"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Mode: {
|
|
||||||
Replicated: {
|
|
||||||
Replicas: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...(process.env.NODE_ENV === "development" && {
|
|
||||||
EndpointSpec: {
|
|
||||||
Ports: [
|
|
||||||
{
|
|
||||||
TargetPort: 6379,
|
|
||||||
PublishedPort: 6379,
|
|
||||||
Protocol: "tcp",
|
|
||||||
PublishMode: "host",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
await pullImage(imageName);
|
|
||||||
|
|
||||||
const service = docker.getService(containerName);
|
|
||||||
const inspect = await service.inspect();
|
|
||||||
await service.update({
|
|
||||||
version: Number.parseInt(inspect.Version.Index),
|
|
||||||
...settings,
|
|
||||||
});
|
|
||||||
console.log("Redis Started ✅");
|
|
||||||
} catch (_) {
|
|
||||||
try {
|
|
||||||
await docker.createService(settings);
|
|
||||||
} catch (error: any) {
|
|
||||||
if (error?.statusCode !== 409) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
console.log("Redis service already exists, continuing...");
|
|
||||||
}
|
|
||||||
console.log("Redis Not Found: Starting ✅");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -892,50 +892,6 @@ export const checkPostgresHealth = async (): Promise<ServiceHealthStatus> => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkRedisHealth = async (): Promise<ServiceHealthStatus> => {
|
|
||||||
const serviceCheck = await checkSwarmServiceRunning("dokploy-redis");
|
|
||||||
if (serviceCheck.status === "unhealthy") {
|
|
||||||
return serviceCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify Redis actually responds to PING
|
|
||||||
const containerId = await getSwarmServiceContainerId("dokploy-redis");
|
|
||||||
if (!containerId) {
|
|
||||||
return { status: "unhealthy", message: "Could not find running container" };
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const exec = await docker.getContainer(containerId).exec({
|
|
||||||
Cmd: ["redis-cli", "ping"],
|
|
||||||
AttachStdout: true,
|
|
||||||
AttachStderr: true,
|
|
||||||
});
|
|
||||||
const stream = await exec.start({});
|
|
||||||
|
|
||||||
const output = await new Promise<string>((resolve) => {
|
|
||||||
let data = "";
|
|
||||||
stream.on("data", (chunk: Buffer) => {
|
|
||||||
data += chunk.toString();
|
|
||||||
});
|
|
||||||
stream.on("end", () => resolve(data));
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!output.includes("PONG")) {
|
|
||||||
return {
|
|
||||||
status: "unhealthy",
|
|
||||||
message: `Redis did not respond with PONG: ${output.trim()}`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return { status: "healthy" };
|
|
||||||
} catch (error) {
|
|
||||||
return {
|
|
||||||
status: "unhealthy",
|
|
||||||
message: error instanceof Error ? error.message : "Failed to check Redis",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const checkTraefikHealth = async (): Promise<ServiceHealthStatus> => {
|
export const checkTraefikHealth = async (): Promise<ServiceHealthStatus> => {
|
||||||
// Traefik can run as a standalone container or a swarm service
|
// Traefik can run as a standalone container or a swarm service
|
||||||
try {
|
try {
|
||||||
|
|||||||
Generated
-3
@@ -232,9 +232,6 @@ importers:
|
|||||||
boxen:
|
boxen:
|
||||||
specifier: ^7.1.1
|
specifier: ^7.1.1
|
||||||
version: 7.1.1
|
version: 7.1.1
|
||||||
bullmq:
|
|
||||||
specifier: 5.67.3
|
|
||||||
version: 5.67.3
|
|
||||||
class-variance-authority:
|
class-variance-authority:
|
||||||
specifier: ^0.7.1
|
specifier: ^0.7.1
|
||||||
version: 0.7.1
|
version: 0.7.1
|
||||||
|
|||||||
Reference in New Issue
Block a user