refactor(multi-server): replace executeCommand with execAsyncRemote

This commit is contained in:
Mauricio Siu
2024-09-16 00:40:11 -06:00
parent 19295ba746
commit d8d0b60cb3
76 changed files with 622 additions and 19123 deletions

View File

@@ -1,24 +1,8 @@
import { type ConnectionOptions, type Job, Queue, Worker } from "bullmq";
import { findServerById, type Server } from "../api/services/server";
import type { DeploymentJob } from "./deployments-queue";
import {
deployApplication,
rebuildApplication,
updateApplicationStatus,
} from "../api/services/application";
import {
updateCompose,
deployCompose,
rebuildCompose,
} from "../api/services/compose";
import { type ConnectionOptions, Queue } from "bullmq";
export const redisConfig: ConnectionOptions = {
// host: "31.220.108.27",
// password: "xYBugfHkULig1iLN",
host: process.env.NODE_ENV === "production" ? "dokploy-redis" : "127.0.0.1",
// port: 1233,
};
// TODO: maybe add a options to clean the queue to the times
const myQueue = new Queue("deployments", {
connection: redisConfig,
});
@@ -38,13 +22,3 @@ myQueue.on("error", (error) => {
});
export { myQueue };
const workersMap = new Map<string, Worker>();
const queuesMap = new Map<string, Queue>();
function createRedisConnection(server: Server) {
return {
host: server.ipAddress,
port: "6379",
} as ConnectionOptions;
}