podkeeper 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/genericService.js +2 -2
- package/lib/minio.js +13 -2
- package/lib/mysql.js +5 -2
- package/lib/postgres.js +3 -3
- package/package.json +5 -3
- package/types/genericService.d.ts +4 -1
- package/types/minio.d.ts +3 -1
- package/types/mysql.d.ts +2 -1
- package/types/postgres.d.ts +2 -1
package/lib/genericService.js
CHANGED
|
@@ -34,7 +34,7 @@ class GenericService {
|
|
|
34
34
|
const entrypoint = ["/deadmanswitch"];
|
|
35
35
|
const command = [metadata.Config.Entrypoint, options.command ?? metadata.Config.Cmd].flat();
|
|
36
36
|
const deadmanswitchName = imageArch === "arm64" ? "deadmanswitch_linux_aarch64" : "deadmanswitch_linux_x86_64";
|
|
37
|
-
const usedPorts = new Set(options.ports);
|
|
37
|
+
const usedPorts = new Set(options.ports.map((port) => port.container));
|
|
38
38
|
let switchPort = 54321;
|
|
39
39
|
while (usedPorts.has(switchPort))
|
|
40
40
|
++switchPort;
|
|
@@ -45,7 +45,7 @@ class GenericService {
|
|
|
45
45
|
{ containerPath: "/deadmanswitch", hostPath: path.join(__dirname, "..", "deadmanswitch", "bin", deadmanswitchName) }
|
|
46
46
|
],
|
|
47
47
|
ports: [
|
|
48
|
-
...options.ports
|
|
48
|
+
...options.ports,
|
|
49
49
|
{ container: switchPort, host: 0 }
|
|
50
50
|
],
|
|
51
51
|
entrypoint,
|
package/lib/minio.js
CHANGED
|
@@ -6,10 +6,21 @@ class Minio {
|
|
|
6
6
|
this._accessKeyId = _accessKeyId;
|
|
7
7
|
this._secretAccessKey = _secretAccessKey;
|
|
8
8
|
}
|
|
9
|
-
static async start({
|
|
9
|
+
static async start({
|
|
10
|
+
accessKeyId = "root",
|
|
11
|
+
secretAccessKey = "password",
|
|
12
|
+
hostApiPort = 0,
|
|
13
|
+
hostWebuiPort = 0
|
|
14
|
+
} = {}) {
|
|
10
15
|
const service = await GenericService.start({
|
|
11
16
|
imageName: "quay.io/minio/minio:latest",
|
|
12
|
-
ports: [
|
|
17
|
+
ports: [{
|
|
18
|
+
container: 9e3,
|
|
19
|
+
host: hostApiPort
|
|
20
|
+
}, {
|
|
21
|
+
container: 9090,
|
|
22
|
+
host: hostWebuiPort
|
|
23
|
+
}],
|
|
13
24
|
healthcheck: {
|
|
14
25
|
test: ["CMD", `mc`, `ready`, `local`],
|
|
15
26
|
intervalMs: ms("100ms"),
|
package/lib/mysql.js
CHANGED
|
@@ -8,10 +8,13 @@ class MySQL {
|
|
|
8
8
|
this._rootPassword = _rootPassword;
|
|
9
9
|
this._db = _db;
|
|
10
10
|
}
|
|
11
|
-
static async start({ db = "mydatabase", rootPassword = "rootpassword" } = {}) {
|
|
11
|
+
static async start({ db = "mydatabase", rootPassword = "rootpassword", hostPort = 0 } = {}) {
|
|
12
12
|
const service = await GenericService.start({
|
|
13
13
|
imageName: "mysql:latest",
|
|
14
|
-
ports: [
|
|
14
|
+
ports: [{
|
|
15
|
+
container: MYSQL_PORT,
|
|
16
|
+
host: hostPort
|
|
17
|
+
}],
|
|
15
18
|
healthcheck: {
|
|
16
19
|
test: ["CMD-SHELL", `mysqladmin ping --host 127.0.0.1 -u root --password=${rootPassword}`],
|
|
17
20
|
intervalMs: ms("100ms"),
|
package/lib/postgres.js
CHANGED
|
@@ -9,12 +9,12 @@ class Postgres {
|
|
|
9
9
|
this._password = _password;
|
|
10
10
|
this._db = _db;
|
|
11
11
|
}
|
|
12
|
-
static async start({ user = "user", password = "password", db = "postgres" } = {}) {
|
|
12
|
+
static async start({ user = "user", password = "password", db = "postgres", hostPort = 0 } = {}) {
|
|
13
13
|
const service = await GenericService.start({
|
|
14
14
|
imageName: "postgres:latest",
|
|
15
|
-
ports: [POSTGRES_PORT],
|
|
15
|
+
ports: [{ container: POSTGRES_PORT, host: hostPort }],
|
|
16
16
|
healthcheck: {
|
|
17
|
-
test: ["CMD-SHELL", "pg_isready"],
|
|
17
|
+
test: ["CMD-SHELL", "pg_isready", `--username=${user}`, `--host=localhost`, `--port=${POSTGRES_PORT}`, `--dbname=${db}`],
|
|
18
18
|
intervalMs: ms("1s"),
|
|
19
19
|
retries: 10,
|
|
20
20
|
startPeriodMs: 0,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podkeeper",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"main": "index.js",
|
|
14
14
|
"scripts": {
|
|
15
|
-
"test": "
|
|
15
|
+
"test": "npx playwright test"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
@@ -23,12 +23,14 @@
|
|
|
23
23
|
"author": "",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@degulabs/build": "^0.0.1",
|
|
27
26
|
"@playwright/test": "^1.48.2",
|
|
28
27
|
"@types/ms": "^0.7.34",
|
|
29
28
|
"@types/node": "^22.8.5",
|
|
29
|
+
"@types/pg": "^8.11.10",
|
|
30
30
|
"@types/ws": "^8.5.12",
|
|
31
31
|
"esbuild": "^0.24.0",
|
|
32
|
+
"kubik": "^0.6.0",
|
|
33
|
+
"pg": "^8.13.1",
|
|
32
34
|
"typescript": "^5.6.3"
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
package/types/minio.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ export declare class Minio {
|
|
|
3
3
|
private _service;
|
|
4
4
|
private _accessKeyId;
|
|
5
5
|
private _secretAccessKey;
|
|
6
|
-
static start({ accessKeyId, secretAccessKey }?: {
|
|
6
|
+
static start({ accessKeyId, secretAccessKey, hostApiPort, hostWebuiPort, }?: {
|
|
7
7
|
accessKeyId?: string | undefined;
|
|
8
8
|
secretAccessKey?: string | undefined;
|
|
9
|
+
hostApiPort?: number | undefined;
|
|
10
|
+
hostWebuiPort?: number | undefined;
|
|
9
11
|
}): Promise<Minio>;
|
|
10
12
|
constructor(_service: GenericService, _accessKeyId: string, _secretAccessKey: string);
|
|
11
13
|
accessKeyId(): string;
|
package/types/mysql.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ export declare class MySQL {
|
|
|
3
3
|
private _service;
|
|
4
4
|
private _rootPassword;
|
|
5
5
|
private _db;
|
|
6
|
-
static start({ db, rootPassword }?: {
|
|
6
|
+
static start({ db, rootPassword, hostPort }?: {
|
|
7
7
|
db?: string | undefined;
|
|
8
8
|
rootPassword?: string | undefined;
|
|
9
|
+
hostPort?: number | undefined;
|
|
9
10
|
}): Promise<MySQL>;
|
|
10
11
|
constructor(_service: GenericService, _rootPassword: string, _db: string);
|
|
11
12
|
databaseUrl(): string;
|
package/types/postgres.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ export declare class Postgres {
|
|
|
4
4
|
private _user;
|
|
5
5
|
private _password;
|
|
6
6
|
private _db;
|
|
7
|
-
static start({ user, password, db }?: {
|
|
7
|
+
static start({ user, password, db, hostPort }?: {
|
|
8
8
|
user?: string | undefined;
|
|
9
9
|
password?: string | undefined;
|
|
10
10
|
db?: string | undefined;
|
|
11
|
+
hostPort?: number | undefined;
|
|
11
12
|
}): Promise<Postgres>;
|
|
12
13
|
constructor(_service: GenericService, _user: string, _password: string, _db: string);
|
|
13
14
|
databaseUrl(): string;
|