Inject dockerode, instantiate instance
This commit is contained in:
1 parent
61406be2a3
commit
2548742f31
2 files changed
+7
-4
No files matched your search
+3
-2
@@ -28,6 +28,7 @@ import NetworkService from "./service/networkService.js";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import ping from "ping";
|
import ping from "ping";
|
||||||
import http from "http";
|
import http from "http";
|
||||||
|
import Docker from "dockerode";
|
||||||
|
|
||||||
// Email service and dependencies
|
// Email service and dependencies
|
||||||
import EmailService from "./service/emailService.js";
|
import EmailService from "./service/emailService.js";
|
||||||
@@ -45,7 +46,7 @@ import NotificationService from "./service/notificationService.js";
|
|||||||
|
|
||||||
import db from "./db/mongo/MongoDB.js";
|
import db from "./db/mongo/MongoDB.js";
|
||||||
const SERVICE_NAME = "Server";
|
const SERVICE_NAME = "Server";
|
||||||
const SHUTDOWN_TIMEOUT = 0;
|
const SHUTDOWN_TIMEOUT = 1000;
|
||||||
|
|
||||||
let isShuttingDown = false;
|
let isShuttingDown = false;
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
@@ -130,7 +131,7 @@ const startApp = async () => {
|
|||||||
nodemailer,
|
nodemailer,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
const networkService = new NetworkService(axios, ping, logger, http);
|
const networkService = new NetworkService(axios, ping, logger, http, Docker);
|
||||||
const statusService = new StatusService(db, logger);
|
const statusService = new StatusService(db, logger);
|
||||||
const notificationService = new NotificationService(emailService, db, logger);
|
const notificationService = new NotificationService(emailService, db, logger);
|
||||||
const jobQueue = await JobQueue.createJobQueue(
|
const jobQueue = await JobQueue.createJobQueue(
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { errorMessages, successMessages } from "../utils/messages.js";
|
|||||||
* @param {Object} http - The HTTP utility for network operations.
|
* @param {Object} http - The HTTP utility for network operations.
|
||||||
*/
|
*/
|
||||||
class NetworkService {
|
class NetworkService {
|
||||||
constructor(axios, ping, logger, http) {
|
constructor(axios, ping, logger, http, Docker) {
|
||||||
this.TYPE_PING = "ping";
|
this.TYPE_PING = "ping";
|
||||||
this.TYPE_HTTP = "http";
|
this.TYPE_HTTP = "http";
|
||||||
this.TYPE_PAGESPEED = "pagespeed";
|
this.TYPE_PAGESPEED = "pagespeed";
|
||||||
@@ -21,6 +21,7 @@ class NetworkService {
|
|||||||
this.ping = ping;
|
this.ping = ping;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.http = http;
|
this.http = http;
|
||||||
|
this.Docker = Docker;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,7 +165,8 @@ class NetworkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async requestDocker(job) {
|
async requestDocker(job) {
|
||||||
console.log(job);
|
var docker = new Docker({ socketPath: "/var/run/docker.sock" });
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user