@wocker/ws 1.0.2 → 1.0.4

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