@wocker/ws 1.0.2 → 1.0.3
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/README.md +1 -1
- package/lib/App.d.ts +4 -3
- package/lib/App.js +98 -77
- package/lib/controllers/ImageController.d.ts +2 -2
- package/lib/controllers/ImageController.js +27 -27
- package/lib/controllers/PluginController.d.ts +2 -2
- package/lib/controllers/PluginController.js +78 -56
- package/lib/controllers/PresetController.d.ts +3 -1
- package/lib/controllers/PresetController.js +155 -136
- package/lib/controllers/ProjectController.d.ts +5 -5
- package/lib/controllers/ProjectController.js +653 -603
- package/lib/controllers/ProxyController.d.ts +4 -1
- package/lib/controllers/ProxyController.js +269 -245
- package/lib/controllers/index.js +19 -58
- package/lib/env.js +33 -15
- package/lib/index.d.ts +2 -0
- package/lib/index.js +30 -16
- package/lib/makes/Controller.js +4 -8
- package/lib/makes/DI.d.ts +7 -0
- package/lib/makes/DI.js +27 -0
- package/lib/makes/Docker.js +298 -382
- package/lib/makes/FS.js +328 -304
- package/lib/makes/LineConvertStream.js +37 -40
- package/lib/makes/Logger.d.ts +9 -1
- package/lib/makes/Logger.js +22 -11
- package/lib/makes/Model.js +8 -12
- package/lib/makes/MySQL.js +6 -27
- package/lib/makes/Plugin.d.ts +1 -1
- package/lib/makes/Plugin.js +55 -37
- package/lib/makes/Preset.d.ts +46 -0
- package/lib/makes/Preset.js +33 -0
- package/lib/makes/Project.d.ts +45 -0
- package/lib/makes/Project.js +127 -0
- package/lib/makes/Repository.js +18 -21
- package/lib/makes/index.d.ts +3 -0
- package/lib/makes/index.js +23 -69
- package/lib/plugins/ElasticSearchPlugin.d.ts +3 -1
- package/lib/plugins/ElasticSearchPlugin.js +66 -66
- package/lib/plugins/LocaltunnelPlugin.d.ts +2 -2
- package/lib/plugins/LocaltunnelPlugin.js +256 -257
- package/lib/plugins/MaildevPlugin.d.ts +2 -2
- package/lib/plugins/MaildevPlugin.js +45 -44
- package/lib/plugins/MongodbPlugin.d.ts +2 -2
- package/lib/plugins/MongodbPlugin.js +303 -248
- package/lib/plugins/NgrokPlugin.d.ts +2 -2
- package/lib/plugins/NgrokPlugin.js +221 -231
- package/lib/plugins/PageKitePlugin.d.ts +2 -2
- package/lib/plugins/PageKitePlugin.js +150 -149
- package/lib/plugins/PostgresPlugin.d.ts +1 -1
- package/lib/plugins/PostgresPlugin.js +115 -89
- package/lib/plugins/ProxmoxPlugin.d.ts +1 -1
- package/lib/plugins/ProxmoxPlugin.js +50 -38
- package/lib/plugins/RedisPlugin.d.ts +3 -1
- package/lib/plugins/RedisPlugin.js +73 -72
- package/lib/plugins/index.js +25 -103
- package/lib/services/AppConfigService.d.ts +3 -3
- package/lib/services/AppConfigService.js +162 -157
- package/lib/services/AppEventsService.js +26 -24
- package/lib/services/DockerService.d.ts +37 -2
- package/lib/services/DockerService.js +185 -205
- package/lib/services/LogService.d.ts +3 -2
- package/lib/services/LogService.js +33 -34
- package/lib/services/PluginService.d.ts +2 -1
- package/lib/services/PluginService.js +11 -14
- package/lib/services/PresetService.d.ts +8 -3
- package/lib/services/PresetService.js +60 -59
- package/lib/services/ProjectService.d.ts +11 -4
- package/lib/services/ProjectService.js +140 -129
- package/lib/services/index.js +21 -80
- package/lib/types/Config.d.ts +4 -3
- package/lib/types/Config.js +1 -4
- package/lib/types/EnvConfig.js +1 -4
- package/lib/types/index.js +16 -25
- package/lib/utils/buildOptions.js +5 -8
- package/lib/utils/demuxOutput.js +16 -20
- package/lib/utils/escapeRegExp.js +4 -7
- package/lib/utils/exec.js +38 -39
- package/lib/utils/fetch.js +46 -30
- package/lib/utils/followProgress.js +66 -77
- package/lib/utils/format-size-units.js +16 -16
- package/lib/utils/get-config.d.ts +1 -1
- package/lib/utils/get-config.js +13 -16
- package/lib/utils/get-cursor-position.js +22 -29
- package/lib/utils/image-build.js +35 -23
- package/lib/utils/index.js +32 -191
- package/lib/utils/injectVariables.js +10 -13
- package/lib/utils/parse-table.js +20 -23
- package/lib/utils/set-config.d.ts +1 -1
- package/lib/utils/set-config.js +12 -15
- package/lib/utils/spawn.js +17 -20
- package/lib/utils/tty.js +2 -6
- package/lib/utils/volumeFormat.js +5 -12
- package/lib/utils/volumeParse.js +10 -13
- package/package.json +13 -39
- package/presets/bun/Dockerfile +11 -0
- package/presets/bun/config.json +3 -0
- package/presets/node/Dockerfile +4 -2
- package/presets/php-apache/Dockerfile +3 -2
- package/.github/workflows/publish.yml +0 -31
- package/plugins/mariadb/admin/conf/config.user.inc.php +0 -9
|
@@ -1,160 +1,161 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.PageKitePlugin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class PageKitePlugin extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
install(cli) {
|
|
19
|
-
super.install(cli);
|
|
20
|
-
this.appEventsService.on("project:start", project => this.onProjectStart(project));
|
|
21
|
-
this.appEventsService.on("project:stop", project => this.onProjectStop(project));
|
|
22
|
-
cli.command("pagekite:init").action(options => this.init(options));
|
|
23
|
-
cli.command("pagekite:start").option("name", {
|
|
24
|
-
type: "string",
|
|
25
|
-
alias: "n",
|
|
26
|
-
description: "Project name"
|
|
27
|
-
}).option("restart", {
|
|
28
|
-
type: "boolean",
|
|
29
|
-
alias: "r",
|
|
30
|
-
description: "Restart"
|
|
31
|
-
}).action(options => this.start(options));
|
|
32
|
-
cli.command("pagekite:stop").option("name", {
|
|
33
|
-
type: "string",
|
|
34
|
-
alias: "n",
|
|
35
|
-
description: "Project name"
|
|
36
|
-
}).action(options => this.stop(options));
|
|
37
|
-
cli.command("pagekite:build").option("rebuild", {
|
|
38
|
-
type: "boolean",
|
|
39
|
-
alias: "r",
|
|
40
|
-
description: "Rebuild"
|
|
41
|
-
}).action(options => this.build(options));
|
|
42
|
-
}
|
|
43
|
-
async onProjectStart(project) {
|
|
44
|
-
if (!project || project.getEnv("PAGEKITE_ENABLE", "false") !== "true") {
|
|
45
|
-
return;
|
|
4
|
+
const utils_1 = require("@wocker/utils");
|
|
5
|
+
const makes_1 = require("../makes");
|
|
6
|
+
const utils_2 = require("../utils");
|
|
7
|
+
const services_1 = require("../services");
|
|
8
|
+
class PageKitePlugin extends makes_1.Plugin {
|
|
9
|
+
constructor(di) {
|
|
10
|
+
super("pagekite");
|
|
11
|
+
this.appConfigService = di.resolveService(services_1.AppConfigService);
|
|
12
|
+
this.appEventsService = di.resolveService(services_1.AppEventsService);
|
|
13
|
+
this.projectService = di.resolveService(services_1.ProjectService);
|
|
46
14
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
stdout: true,
|
|
80
|
-
stderr: true,
|
|
81
|
-
hijack: true,
|
|
82
|
-
logs: true
|
|
83
|
-
});
|
|
84
|
-
stream.on("data", data => {
|
|
85
|
-
if (/Kites are flying and all is well\./.test(data.toString())) {
|
|
86
|
-
stream.end();
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
await _makes.Docker.attachStream(stream);
|
|
90
|
-
}
|
|
91
|
-
async onProjectStop(project) {
|
|
92
|
-
if (!project || project.getEnv("PAGEKITE_ENABLE", "false") !== "true") {
|
|
93
|
-
return;
|
|
15
|
+
install(cli) {
|
|
16
|
+
super.install(cli);
|
|
17
|
+
this.appEventsService.on("project:start", (project) => this.onProjectStart(project));
|
|
18
|
+
this.appEventsService.on("project:stop", (project) => this.onProjectStop(project));
|
|
19
|
+
cli.command("pagekite:init")
|
|
20
|
+
.action((options) => this.init(options));
|
|
21
|
+
cli.command("pagekite:start")
|
|
22
|
+
.option("name", {
|
|
23
|
+
type: "string",
|
|
24
|
+
alias: "n",
|
|
25
|
+
description: "Project name"
|
|
26
|
+
})
|
|
27
|
+
.option("restart", {
|
|
28
|
+
type: "boolean",
|
|
29
|
+
alias: "r",
|
|
30
|
+
description: "Restart"
|
|
31
|
+
})
|
|
32
|
+
.action((options) => this.start(options));
|
|
33
|
+
cli.command("pagekite:stop")
|
|
34
|
+
.option("name", {
|
|
35
|
+
type: "string",
|
|
36
|
+
alias: "n",
|
|
37
|
+
description: "Project name"
|
|
38
|
+
})
|
|
39
|
+
.action((options) => this.stop(options));
|
|
40
|
+
cli.command("pagekite:build")
|
|
41
|
+
.option("rebuild", {
|
|
42
|
+
type: "boolean",
|
|
43
|
+
alias: "r",
|
|
44
|
+
description: "Rebuild"
|
|
45
|
+
})
|
|
46
|
+
.action((options) => this.build(options));
|
|
94
47
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
48
|
+
async onProjectStart(project) {
|
|
49
|
+
if (!project || project.getEnv("PAGEKITE_ENABLE", "false") !== "true") {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
console.info("Pagekite starting...");
|
|
53
|
+
await this.build();
|
|
54
|
+
let container = await makes_1.Docker.getContainer(`pagekite-${project.name}`);
|
|
55
|
+
if (container) {
|
|
56
|
+
const { State: { Running } } = await container.inspect();
|
|
57
|
+
if (Running) {
|
|
58
|
+
console.info("Pagekite is already running");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
await makes_1.Docker.removeContainer(`pagekite-${project.name}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const subdomain = project.getEnv("PAGEKITE_SUBDOMAIN");
|
|
66
|
+
container = await makes_1.Docker.createContainer({
|
|
67
|
+
name: `pagekite-${project.name}`,
|
|
68
|
+
image: "ws-pagekite",
|
|
69
|
+
tty: true,
|
|
70
|
+
restart: "always",
|
|
71
|
+
cmd: [
|
|
72
|
+
"python",
|
|
73
|
+
"pagekite.py",
|
|
74
|
+
`${project.name}.workspace:80`,
|
|
75
|
+
`${subdomain}.pagekite.me`
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
await container.start();
|
|
79
|
+
await container.resize({
|
|
80
|
+
w: process.stdout.columns,
|
|
81
|
+
h: process.stdout.rows
|
|
82
|
+
});
|
|
83
|
+
const stream = await container.attach({
|
|
84
|
+
stream: true,
|
|
85
|
+
stdin: true,
|
|
86
|
+
stdout: true,
|
|
87
|
+
stderr: true,
|
|
88
|
+
hijack: true,
|
|
89
|
+
logs: true
|
|
90
|
+
});
|
|
91
|
+
stream.on("data", (data) => {
|
|
92
|
+
if (/Kites are flying and all is well\./.test(data.toString())) {
|
|
93
|
+
stream.end();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
await makes_1.Docker.attachStream(stream);
|
|
115
97
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} = options;
|
|
123
|
-
if (name) {
|
|
124
|
-
await this.projectService.cdProject(name);
|
|
98
|
+
async onProjectStop(project) {
|
|
99
|
+
if (!project || project.getEnv("PAGEKITE_ENABLE", "false") !== "true") {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
console.info("Pagekite stopping...");
|
|
103
|
+
await makes_1.Docker.removeContainer(`pagekite-${project.name}`);
|
|
125
104
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
105
|
+
async init(options) {
|
|
106
|
+
const project = await this.projectService.get();
|
|
107
|
+
const enabled = await (0, utils_1.promptConfirm)({
|
|
108
|
+
message: "Enable pagekite",
|
|
109
|
+
default: project.getEnv("PAGEKITE_ENABLE", "true") === "true"
|
|
110
|
+
});
|
|
111
|
+
if (enabled) {
|
|
112
|
+
project.setEnv("PAGEKITE_ENABLE", "true");
|
|
113
|
+
const subdomain = await (0, utils_1.promptText)({
|
|
114
|
+
message: "Subdomain",
|
|
115
|
+
prefix: "https://",
|
|
116
|
+
suffix: ".pagekite.me",
|
|
117
|
+
default: project.getEnv("PAGEKITE_SUBDOMAIN", project.name)
|
|
118
|
+
});
|
|
119
|
+
project.setEnv("PAGEKITE_SUBDOMAIN", subdomain);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
project.setEnv("PAGEKITE_ENABLE", "false");
|
|
123
|
+
}
|
|
124
|
+
await project.save();
|
|
129
125
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
async start(options) {
|
|
127
|
+
const { name, restart } = options;
|
|
128
|
+
if (name) {
|
|
129
|
+
await this.projectService.cdProject(name);
|
|
130
|
+
}
|
|
131
|
+
const project = await this.projectService.get();
|
|
132
|
+
if (restart) {
|
|
133
|
+
await makes_1.Docker.removeContainer(`pagekite-${project.name}`);
|
|
134
|
+
}
|
|
135
|
+
await this.onProjectStart(project);
|
|
138
136
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const exists = await _makes.Docker.imageExists("ws-pagekite");
|
|
147
|
-
if (rebuild) {
|
|
148
|
-
await _makes.Docker.removeContainer("ws-pagekite");
|
|
137
|
+
async stop(options) {
|
|
138
|
+
const { name } = options;
|
|
139
|
+
if (name) {
|
|
140
|
+
await this.projectService.cdProject(name);
|
|
141
|
+
}
|
|
142
|
+
const project = await this.projectService.get();
|
|
143
|
+
await this.onProjectStop(project);
|
|
149
144
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
145
|
+
async build(options = {}) {
|
|
146
|
+
const { rebuild } = options;
|
|
147
|
+
const exists = await makes_1.Docker.imageExists("ws-pagekite");
|
|
148
|
+
if (rebuild) {
|
|
149
|
+
await makes_1.Docker.removeContainer("ws-pagekite");
|
|
150
|
+
}
|
|
151
|
+
if (!exists || rebuild) {
|
|
152
|
+
const stream = await makes_1.Docker.imageBuild2({
|
|
153
|
+
tag: "ws-pagekite",
|
|
154
|
+
context: this.pluginPath(),
|
|
155
|
+
src: "./Dockerfile"
|
|
156
|
+
});
|
|
157
|
+
await (0, utils_2.followProgress)(stream);
|
|
158
|
+
}
|
|
157
159
|
}
|
|
158
|
-
}
|
|
159
160
|
}
|
|
160
|
-
exports.PageKitePlugin = PageKitePlugin;
|
|
161
|
+
exports.PageKitePlugin = PageKitePlugin;
|
|
@@ -1,95 +1,121 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
5
17
|
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.PostgresPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
await
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
27
|
+
const Path = __importStar(require("path"));
|
|
28
|
+
const env_1 = require("../env");
|
|
29
|
+
const makes_1 = require("../makes");
|
|
30
|
+
class PostgresPlugin extends makes_1.Plugin {
|
|
31
|
+
constructor() {
|
|
32
|
+
super("postgres");
|
|
33
|
+
this.container = "postgres.workspace";
|
|
34
|
+
this.adminContainer = "dbadmin-postgres.workspace";
|
|
35
|
+
this.dataDir = Path.join(env_1.DATA_DIR, "db/postgres");
|
|
36
|
+
}
|
|
37
|
+
install(cli) {
|
|
38
|
+
super.install(cli);
|
|
39
|
+
cli.command("postgres:start")
|
|
40
|
+
.action(() => this.start());
|
|
41
|
+
cli.command("postgres:stop")
|
|
42
|
+
.action(() => this.stop());
|
|
43
|
+
cli.command("postgres:restart")
|
|
44
|
+
.action(() => this.restart());
|
|
45
|
+
}
|
|
46
|
+
async start() {
|
|
47
|
+
await this.startDB();
|
|
48
|
+
await this.startAdmin();
|
|
49
|
+
}
|
|
50
|
+
async startDB() {
|
|
51
|
+
console.log("Postgres starting...");
|
|
52
|
+
await makes_1.Docker.pullImage("postgres:latest");
|
|
53
|
+
const container = await makes_1.Docker.createContainer({
|
|
54
|
+
name: this.container,
|
|
55
|
+
restart: "always",
|
|
56
|
+
image: "postgres:latest",
|
|
57
|
+
volumes: [
|
|
58
|
+
`${this.dataPath()}:/var/lib/postgresql/data`
|
|
59
|
+
],
|
|
60
|
+
ports: ["5432:5432"],
|
|
61
|
+
env: {
|
|
62
|
+
POSTGRES_USER: "root",
|
|
63
|
+
POSTGRES_PASSWORD: "toor"
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
await container.start();
|
|
67
|
+
}
|
|
68
|
+
async startAdmin() {
|
|
69
|
+
console.log("Postgres Admin starting...");
|
|
70
|
+
await makes_1.Docker.pullImage("dpage/pgadmin4:latest");
|
|
71
|
+
const container = await makes_1.Docker.createContainer({
|
|
72
|
+
name: this.adminContainer,
|
|
73
|
+
restart: "always",
|
|
74
|
+
links: [
|
|
75
|
+
`${this.container}:postgres`
|
|
76
|
+
],
|
|
77
|
+
env: {
|
|
78
|
+
PGADMIN_DEFAULT_EMAIL: "postgres@workspace.com.ua",
|
|
79
|
+
PGADMIN_DEFAULT_PASSWORD: "toor",
|
|
80
|
+
VIRTUAL_HOST: this.adminContainer
|
|
81
|
+
},
|
|
82
|
+
image: "dpage/pgadmin4:latest"
|
|
83
|
+
});
|
|
84
|
+
await container.start();
|
|
85
|
+
}
|
|
86
|
+
async stop() {
|
|
87
|
+
await this.stopDB();
|
|
88
|
+
await this.stopAdmin();
|
|
89
|
+
}
|
|
90
|
+
async stopDB() {
|
|
91
|
+
console.log("Postgres stopping...");
|
|
92
|
+
const container = await makes_1.Docker.getContainer(this.container);
|
|
93
|
+
if (container) {
|
|
94
|
+
try {
|
|
95
|
+
await container.stop();
|
|
96
|
+
await container.remove();
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
makes_1.Logger.error(err.message);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async stopAdmin() {
|
|
104
|
+
console.log("Stopping postgres admin...");
|
|
105
|
+
const container = await makes_1.Docker.getContainer(this.adminContainer);
|
|
106
|
+
if (container) {
|
|
107
|
+
try {
|
|
108
|
+
await container.stop();
|
|
109
|
+
await container.remove();
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
makes_1.Logger.error(err.message);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
76
115
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const container = await _makes.Docker.getContainer(this.adminContainer);
|
|
81
|
-
if (container) {
|
|
82
|
-
try {
|
|
83
|
-
await container.stop();
|
|
84
|
-
await container.remove();
|
|
85
|
-
} catch (err) {
|
|
86
|
-
_core.Logger.error(err.message);
|
|
87
|
-
}
|
|
116
|
+
async restart() {
|
|
117
|
+
await this.stop();
|
|
118
|
+
await this.start();
|
|
88
119
|
}
|
|
89
|
-
}
|
|
90
|
-
async restart() {
|
|
91
|
-
await this.stop();
|
|
92
|
-
await this.start();
|
|
93
|
-
}
|
|
94
120
|
}
|
|
95
|
-
exports.PostgresPlugin = PostgresPlugin;
|
|
121
|
+
exports.PostgresPlugin = PostgresPlugin;
|
|
@@ -1,37 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
5
17
|
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.ProxmoxPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
install(cli) {
|
|
18
|
-
super.install(cli);
|
|
19
|
-
}
|
|
20
|
-
async up() {
|
|
21
|
-
const container = await _makes.Docker.getContainer("proxmox.workspace");
|
|
22
|
-
if (container) {
|
|
23
|
-
await this.down();
|
|
27
|
+
const Path = __importStar(require("path"));
|
|
28
|
+
const makes_1 = require("../makes");
|
|
29
|
+
const utils_1 = require("../utils");
|
|
30
|
+
class ProxmoxPlugin extends makes_1.Plugin {
|
|
31
|
+
constructor() {
|
|
32
|
+
super("proxmox");
|
|
33
|
+
this.configDir = Path.join(__dirname, "../../services/proxmox");
|
|
34
|
+
}
|
|
35
|
+
install(cli) {
|
|
36
|
+
super.install(cli);
|
|
24
37
|
}
|
|
25
|
-
|
|
38
|
+
async up() {
|
|
39
|
+
const container = await makes_1.Docker.getContainer("proxmox.workspace");
|
|
40
|
+
if (container) {
|
|
41
|
+
await this.down();
|
|
42
|
+
}
|
|
43
|
+
await (0, utils_1.exec)(`
|
|
26
44
|
docker build \
|
|
27
45
|
--tag "ws-proxmox" \
|
|
28
46
|
--file "${this.pluginPath("./Dockerfile")}" \
|
|
29
47
|
${this.pluginPath()}
|
|
30
48
|
`);
|
|
31
|
-
|
|
32
|
-
// --add-host=""
|
|
33
|
-
|
|
34
|
-
await (0, _utils.exec)(`
|
|
49
|
+
await (0, utils_1.exec)(`
|
|
35
50
|
docker run -d \
|
|
36
51
|
--name proxmox.workspace \
|
|
37
52
|
--network workspace \
|
|
@@ -39,17 +54,14 @@ class ProxmoxPlugin extends _makes.Plugin {
|
|
|
39
54
|
-p 8006:8006 \
|
|
40
55
|
ws-proxmox
|
|
41
56
|
`);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
//
|
|
52
|
-
});
|
|
53
|
-
}
|
|
57
|
+
}
|
|
58
|
+
async down() {
|
|
59
|
+
await (0, utils_1.exec)("docker stop proxmox.workspace").catch(() => {
|
|
60
|
+
});
|
|
61
|
+
await (0, utils_1.exec)("docker rm proxmox.workspace").catch(() => {
|
|
62
|
+
});
|
|
63
|
+
await (0, utils_1.exec)("docker image rm ws-proxmox").catch(() => {
|
|
64
|
+
});
|
|
65
|
+
}
|
|
54
66
|
}
|
|
55
|
-
exports.ProxmoxPlugin = ProxmoxPlugin;
|
|
67
|
+
exports.ProxmoxPlugin = ProxmoxPlugin;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FSManager } from "@wocker/core";
|
|
2
2
|
import { Cli } from "@kearisp/cli";
|
|
3
|
+
import { DI, Plugin } from "../makes";
|
|
4
|
+
import { AppConfigService, DockerService } from "../services";
|
|
3
5
|
declare class RedisPlugin extends Plugin {
|
|
4
6
|
protected container: string;
|
|
5
7
|
protected commander: string;
|