Updates
This commit is contained in:
@@ -98,5 +98,7 @@ export default function grabDirNames(param?: Param): {
|
||||
dsqlDbDockerComposeFileAlt: string;
|
||||
dsqlDbDockerComposeFileName: string;
|
||||
dsqlDbDockerComposeFileNameAlt: string;
|
||||
tempBackupExportName: string;
|
||||
opsJSONFileName: string;
|
||||
};
|
||||
export {};
|
||||
|
||||
@@ -153,6 +153,8 @@ function grabDirNames(param) {
|
||||
const distroEnterpriseExportTarName = `${distroEnterpriseName}.tar.xz`;
|
||||
const communityDistroTempDir = path_1.default.resolve(appDir, "build", "community", ".tmp");
|
||||
const communityDistroDir = path_1.default.resolve(communityDistroTempDir, distroDirName);
|
||||
const tempBackupExportName = "tmp-export-backup.tar.xz";
|
||||
const opsJSONFileName = "ops.json";
|
||||
return {
|
||||
appDir,
|
||||
privateDataDir,
|
||||
@@ -246,5 +248,7 @@ function grabDirNames(param) {
|
||||
dsqlDbDockerComposeFileAlt,
|
||||
dsqlDbDockerComposeFileName,
|
||||
dsqlDbDockerComposeFileNameAlt,
|
||||
tempBackupExportName,
|
||||
opsJSONFileName,
|
||||
};
|
||||
}
|
||||
|
||||
+5
-1
@@ -1,4 +1,7 @@
|
||||
export default function grabDockerStackServicesNames(): {
|
||||
type Params = {
|
||||
deploymentName?: string | null;
|
||||
};
|
||||
export default function grabDockerStackServicesNames(params?: Params): {
|
||||
deploymentName: string;
|
||||
maxScaleServiceName: string;
|
||||
dbServiceName: string;
|
||||
@@ -14,3 +17,4 @@ export default function grabDockerStackServicesNames(): {
|
||||
websocketServiceName: string;
|
||||
cronServiceName: string;
|
||||
};
|
||||
export {};
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = grabDockerStackServicesNames;
|
||||
function grabDockerStackServicesNames() {
|
||||
const deploymentName = process.env.DSQL_DEPLOYMENT_NAME || "dsql";
|
||||
function grabDockerStackServicesNames(params) {
|
||||
const deploymentName = (params === null || params === void 0 ? void 0 : params.deploymentName) || process.env.DSQL_DEPLOYMENT_NAME || "dsql";
|
||||
const maxScaleServiceName = `${deploymentName}-dsql-maxscale`;
|
||||
const dbServiceName = `${deploymentName}-dsql-db`;
|
||||
const dbCronServiceName = `${deploymentName}-dsql-db-cron`;
|
||||
|
||||
@@ -7,4 +7,5 @@ export default function grabIPAddresses(): {
|
||||
globalIPPrefix: string;
|
||||
webSocketIP: string;
|
||||
dbCronIP: string;
|
||||
reverseProxyIP: string;
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ function grabIPAddresses() {
|
||||
const mainDBIP = `${globalIPPrefix}.${db}`;
|
||||
const webSocketIP = `${globalIPPrefix}.${websocket}`;
|
||||
const dbCronIP = `${globalIPPrefix}.${db_cron}`;
|
||||
const reverseProxyIP = `${globalIPPrefix}.${reverse_proxy}`;
|
||||
const localHostIP = `${globalIPPrefix}.1`;
|
||||
return {
|
||||
webAppIP,
|
||||
@@ -24,5 +25,6 @@ function grabIPAddresses() {
|
||||
globalIPPrefix,
|
||||
webSocketIP,
|
||||
dbCronIP,
|
||||
reverseProxyIP,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export default function genRndStr(length?: number, symbols?: boolean): string;
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = genRndStr;
|
||||
function genRndStr(length, symbols) {
|
||||
let characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
if (symbols)
|
||||
characters += "-_[]()@";
|
||||
let result = "";
|
||||
const finalLength = length || 12;
|
||||
for (let i = 0; i < finalLength; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
result += characters.charAt(randomIndex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export default function getMachineIPAddress(): string | null;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = getMachineIPAddress;
|
||||
const os_1 = require("os");
|
||||
function getMachineIPAddress() {
|
||||
try {
|
||||
const interfaces = (0, os_1.networkInterfaces)();
|
||||
for (const ifaceName in interfaces) {
|
||||
const iface = interfaces[ifaceName];
|
||||
if (Array.isArray(iface)) {
|
||||
for (const address of iface) {
|
||||
if (address.family === "IPv4" && !address.internal) {
|
||||
return address.address;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`Error accessing network interfaces: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ function grabUserMainSqlUserName({ HOST, user, username, }) {
|
||||
const { webAppIP, maxScaleIP } = (0, grab_ip_addresses_1.default)();
|
||||
const finalUsername = username || sqlUsername;
|
||||
const finalHost = HOST || maxScaleIP || "127.0.0.1";
|
||||
const fullName = `${finalUsername}@${webAppIP}`;
|
||||
const fullName = `${finalUsername}@${finalHost}`;
|
||||
return {
|
||||
username: finalUsername,
|
||||
host: finalHost,
|
||||
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
import mariadb, { ConnectionConfig } from "mariadb";
|
||||
type Params = {
|
||||
useLocal?: boolean;
|
||||
dbConfig?: ConnectionConfig;
|
||||
ssl?: boolean;
|
||||
connectionLimit?: number;
|
||||
};
|
||||
export default function setupDSQLDb({ dbConfig, ssl }: Params): Promise<{
|
||||
conn: mariadb.Connection;
|
||||
}>;
|
||||
export {};
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = setupDSQLDb;
|
||||
const grabDbSSL_1 = __importDefault(require("./backend/grabDbSSL"));
|
||||
const mariadb_1 = __importDefault(require("mariadb"));
|
||||
function setupDSQLDb(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ dbConfig, ssl }) {
|
||||
const conn = yield mariadb_1.default.createConnection(Object.assign(Object.assign({ host: process.env.DSQL_DB_HOST, user: process.env.DSQL_DB_USERNAME, password: process.env.DSQL_DB_PASSWORD, database: process.env.DSQL_DB_NAME, charset: "utf8mb4" }, dbConfig), { ssl: ssl ? (0, grabDbSSL_1.default)() : undefined, supportBigNumbers: true, bigNumberStrings: false, dateStrings: true, bigIntAsNumber: true, metaAsArray: true }));
|
||||
// const conn = mariadb.createPool({
|
||||
// host: process.env.DSQL_DB_HOST,
|
||||
// user: process.env.DSQL_DB_USERNAME,
|
||||
// password: process.env.DSQL_DB_PASSWORD,
|
||||
// database: process.env.DSQL_DB_NAME,
|
||||
// charset: "utf8mb4",
|
||||
// ...dbConfig,
|
||||
// ssl: ssl ? grabDbSSL() : undefined,
|
||||
// connectionLimit,
|
||||
// supportBigNumbers: true,
|
||||
// bigNumberStrings: false,
|
||||
// dateStrings: true,
|
||||
// });
|
||||
// let readOnlyConnection;
|
||||
// if (addReadOnlyConn) {
|
||||
// readOnlyConnection = mariadb.createPool({
|
||||
// host: process.env.DSQL_DB_HOST,
|
||||
// user: process.env.DSQL_DB_READ_ONLY_USERNAME,
|
||||
// password: process.env.DSQL_DB_READ_ONLY_PASSWORD,
|
||||
// database: process.env.DSQL_DB_NAME,
|
||||
// charset: "utf8mb4",
|
||||
// ...readOnlyDbConfig,
|
||||
// ssl: ssl ? grabDbSSL() : undefined,
|
||||
// connectionLimit,
|
||||
// });
|
||||
// global.DSQL_READ_ONLY_DB_CONN = readOnlyConnection;
|
||||
// }
|
||||
return {
|
||||
conn,
|
||||
// readOnlyConnection,
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user