@hed-hog/cli 0.0.54 → 0.0.59
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/dist/package.json +1 -1
- package/dist/src/commands/dev.command/apply.subcommand.d.ts +3 -1
- package/dist/src/commands/dev.command/apply.subcommand.js +16 -2
- package/dist/src/commands/dev.command/apply.subcommand.js.map +1 -1
- package/dist/src/commands/dev.command/assets-to-library.subcommand.d.ts +3 -1
- package/dist/src/commands/dev.command/assets-to-library.subcommand.js +29 -3
- package/dist/src/commands/dev.command/assets-to-library.subcommand.js.map +1 -1
- package/dist/src/commands/dev.command/sync-publish.subcommand.js +11 -1
- package/dist/src/commands/dev.command/sync-publish.subcommand.js.map +1 -1
- package/dist/src/modules/database/database.service.d.ts +1 -0
- package/dist/src/modules/database/database.service.js +30 -10
- package/dist/src/modules/database/database.service.js.map +1 -1
- package/dist/src/modules/developer/developer.service.d.ts +5 -0
- package/dist/src/modules/developer/developer.service.js +186 -21
- package/dist/src/modules/developer/developer.service.js.map +1 -1
- package/dist/src/modules/hedhog/hedhog.service.d.ts +1 -0
- package/dist/src/modules/hedhog/hedhog.service.js +48 -0
- package/dist/src/modules/hedhog/hedhog.service.js.map +1 -1
- package/dist/src/templates/deployment/DEPLOYMENT.md.ejs +9 -1
- package/dist/src/templates/deployment/k8s.configmap.yaml.ejs +11 -0
- package/dist/src/templates/deployment/k8s.deployment.yaml.ejs +33 -10
- package/dist/src/templates/deployment/k8s.postgres.readme.ms.ejs +172 -0
- package/dist/src/templates/deployment/k8s.postgres.service.yaml.ejs +34 -0
- package/dist/src/templates/deployment/k8s.postgres.statefulset.yaml.ejs +100 -0
- package/dist/src/templates/deployment/workflow.deploy.yml.ejs +190 -25
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
import { DeveloperService } from '../../modules/developer/developer.service';
|
|
2
3
|
import { HedHogService } from '../../modules/hedhog/hedhog.service';
|
|
3
4
|
export declare class ApplyCommand extends CommandRunner {
|
|
4
5
|
private readonly hedhog;
|
|
5
|
-
|
|
6
|
+
private readonly developer;
|
|
7
|
+
constructor(hedhog: HedHogService, developer: DeveloperService);
|
|
6
8
|
run(_: any, { path, silent }: {
|
|
7
9
|
path: any;
|
|
8
10
|
silent: any;
|
|
@@ -10,15 +10,28 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ApplyCommand = void 0;
|
|
13
|
+
const fs_1 = require("fs");
|
|
13
14
|
const nest_commander_1 = require("nest-commander");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
const developer_service_1 = require("../../modules/developer/developer.service");
|
|
14
17
|
const hedhog_service_1 = require("../../modules/hedhog/hedhog.service");
|
|
15
18
|
let ApplyCommand = class ApplyCommand extends nest_commander_1.CommandRunner {
|
|
16
19
|
hedhog;
|
|
17
|
-
|
|
20
|
+
developer;
|
|
21
|
+
constructor(hedhog, developer) {
|
|
18
22
|
super();
|
|
19
23
|
this.hedhog = hedhog;
|
|
24
|
+
this.developer = developer;
|
|
20
25
|
}
|
|
21
26
|
async run(_, { path, silent }) {
|
|
27
|
+
const cwd = path ?? process.cwd();
|
|
28
|
+
const librariesPath = (0, path_1.join)(cwd, 'libraries');
|
|
29
|
+
const names = (0, fs_1.readdirSync)(librariesPath, { withFileTypes: true })
|
|
30
|
+
.filter((entry) => entry.isDirectory())
|
|
31
|
+
.map((entry) => entry.name);
|
|
32
|
+
for (const name of names) {
|
|
33
|
+
await this.developer.copyAssetsToLibrary(name, cwd, false);
|
|
34
|
+
}
|
|
22
35
|
this.hedhog.apply(path, silent);
|
|
23
36
|
}
|
|
24
37
|
};
|
|
@@ -29,6 +42,7 @@ exports.ApplyCommand = ApplyCommand = __decorate([
|
|
|
29
42
|
aliases: ['a'],
|
|
30
43
|
description: 'Apply library without downloading and installing dependencies',
|
|
31
44
|
}),
|
|
32
|
-
__metadata("design:paramtypes", [hedhog_service_1.HedHogService
|
|
45
|
+
__metadata("design:paramtypes", [hedhog_service_1.HedHogService,
|
|
46
|
+
developer_service_1.DeveloperService])
|
|
33
47
|
], ApplyCommand);
|
|
34
48
|
//# sourceMappingURL=apply.subcommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.subcommand.js","sourceRoot":"","sources":["../../../../src/commands/dev.command/apply.subcommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAA2D;AAC3D,wEAAoE;AAO7D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,8BAAa;
|
|
1
|
+
{"version":3,"file":"apply.subcommand.js","sourceRoot":"","sources":["../../../../src/commands/dev.command/apply.subcommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAiC;AACjC,mDAA2D;AAC3D,+BAA4B;AAC5B,iFAA6E;AAC7E,wEAAoE;AAO7D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,8BAAa;IAE1B;IACA;IAFnB,YACmB,MAAqB,EACrB,SAA2B;QAE5C,KAAK,EAAE,CAAC;QAHS,WAAM,GAAN,MAAM,CAAe;QACrB,cAAS,GAAT,SAAS,CAAkB;IAG9C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QAC3B,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAC7C,MAAM,KAAK,GAAG,IAAA,gBAAW,EAAC,aAAa,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aAC9D,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;aACtC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7D,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;CACF,CAAA;AArBY,oCAAY;uBAAZ,YAAY;IALxB,IAAA,2BAAU,EAAC;QACV,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,WAAW,EAAE,+DAA+D;KAC7E,CAAC;qCAG2B,8BAAa;QACV,oCAAgB;GAHnC,YAAY,CAqBxB"}
|
|
@@ -4,8 +4,10 @@ export declare class AssetsToLibraryCommand extends CommandRunner {
|
|
|
4
4
|
private readonly developer;
|
|
5
5
|
private verbose;
|
|
6
6
|
constructor(developer: DeveloperService);
|
|
7
|
-
run(args: string[], { verbose }: {
|
|
7
|
+
run(args: string[], { verbose, all }: {
|
|
8
8
|
verbose: any;
|
|
9
|
+
all: any;
|
|
9
10
|
}): Promise<void>;
|
|
11
|
+
parseAllOption(): boolean;
|
|
10
12
|
parseVerboseOption(): boolean;
|
|
11
13
|
}
|
|
@@ -10,7 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AssetsToLibraryCommand = void 0;
|
|
13
|
+
const fs_1 = require("fs");
|
|
13
14
|
const nest_commander_1 = require("nest-commander");
|
|
15
|
+
const path_1 = require("path");
|
|
14
16
|
const developer_service_1 = require("../../modules/developer/developer.service");
|
|
15
17
|
let AssetsToLibraryCommand = class AssetsToLibraryCommand extends nest_commander_1.CommandRunner {
|
|
16
18
|
developer;
|
|
@@ -19,17 +21,41 @@ let AssetsToLibraryCommand = class AssetsToLibraryCommand extends nest_commander
|
|
|
19
21
|
super();
|
|
20
22
|
this.developer = developer;
|
|
21
23
|
}
|
|
22
|
-
async run(args, { verbose }) {
|
|
24
|
+
async run(args, { verbose, all }) {
|
|
23
25
|
this.verbose = verbose;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
const cwd = process.cwd();
|
|
27
|
+
let names;
|
|
28
|
+
if (all || args.length === 0) {
|
|
29
|
+
const librariesPath = (0, path_1.join)(cwd, 'libraries');
|
|
30
|
+
names = (0, fs_1.readdirSync)(librariesPath, { withFileTypes: true })
|
|
31
|
+
.filter((entry) => entry.isDirectory())
|
|
32
|
+
.map((entry) => entry.name);
|
|
26
33
|
}
|
|
34
|
+
else {
|
|
35
|
+
names = args;
|
|
36
|
+
}
|
|
37
|
+
for (const name of names) {
|
|
38
|
+
await this.developer.copyAssetsToLibrary(name, cwd, this.verbose);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
parseAllOption() {
|
|
42
|
+
return true;
|
|
27
43
|
}
|
|
28
44
|
parseVerboseOption() {
|
|
29
45
|
return true;
|
|
30
46
|
}
|
|
31
47
|
};
|
|
32
48
|
exports.AssetsToLibraryCommand = AssetsToLibraryCommand;
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, nest_commander_1.Option)({
|
|
51
|
+
flags: '-a, --all',
|
|
52
|
+
description: 'Process all libraries found in the libraries directory',
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", []),
|
|
57
|
+
__metadata("design:returntype", Boolean)
|
|
58
|
+
], AssetsToLibraryCommand.prototype, "parseAllOption", null);
|
|
33
59
|
__decorate([
|
|
34
60
|
(0, nest_commander_1.Option)({
|
|
35
61
|
flags: '-v, --verbose',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets-to-library.subcommand.js","sourceRoot":"","sources":["../../../../src/commands/dev.command/assets-to-library.subcommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAmE;AACnE,iFAA2E;AAQpE,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,8BAAa;IAG1B;IAFrB,OAAO,GAAY,KAAK,CAAC;IAEjC,YAA6B,SAA2B;QACtD,KAAK,EAAE,CAAC;QADmB,cAAS,GAAT,SAAS,CAAkB;IAExD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAc,EAAE,EAAE,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"assets-to-library.subcommand.js","sourceRoot":"","sources":["../../../../src/commands/dev.command/assets-to-library.subcommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAiC;AACjC,mDAAmE;AACnE,+BAA4B;AAC5B,iFAA2E;AAQpE,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,8BAAa;IAG1B;IAFrB,OAAO,GAAY,KAAK,CAAC;IAEjC,YAA6B,SAA2B;QACtD,KAAK,EAAE,CAAC;QADmB,cAAS,GAAT,SAAS,CAAkB;IAExD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAc,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,IAAI,KAAe,CAAC;QAEpB,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YAC7C,KAAK,GAAG,IAAA,gBAAW,EAAC,aAAa,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;iBACxD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;iBACtC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IAOD,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAOD,kBAAkB;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA5CY,wDAAsB;AAgCjC;IALC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,wDAAwD;QACrE,QAAQ,EAAE,KAAK;KAChB,CAAC;;;;4DAGD;AAOD;IALC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,KAAK;KAChB,CAAC;;;;gEAGD;iCA3CU,sBAAsB;IANlC,IAAA,2BAAU,EAAC;QACV,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,CAAC,KAAK,CAAC;QAChB,WAAW,EAAE,4BAA4B;QACzC,SAAS,EAAE,WAAW;KACvB,CAAC;qCAIwC,oCAAgB;GAH7C,sBAAsB,CA4ClC"}
|
|
@@ -10,7 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SyncPublishCommand = void 0;
|
|
13
|
+
const fs_1 = require("fs");
|
|
13
14
|
const nest_commander_1 = require("nest-commander");
|
|
15
|
+
const path_1 = require("path");
|
|
14
16
|
const developer_service_1 = require("../../modules/developer/developer.service");
|
|
15
17
|
let SyncPublishCommand = class SyncPublishCommand extends nest_commander_1.CommandRunner {
|
|
16
18
|
developer;
|
|
@@ -19,7 +21,15 @@ let SyncPublishCommand = class SyncPublishCommand extends nest_commander_1.Comma
|
|
|
19
21
|
this.developer = developer;
|
|
20
22
|
}
|
|
21
23
|
async run([], { verbose }) {
|
|
22
|
-
|
|
24
|
+
const cwd = process.cwd();
|
|
25
|
+
const librariesPath = (0, path_1.join)(cwd, 'libraries');
|
|
26
|
+
const names = (0, fs_1.readdirSync)(librariesPath, { withFileTypes: true })
|
|
27
|
+
.filter((entry) => entry.isDirectory())
|
|
28
|
+
.map((entry) => entry.name);
|
|
29
|
+
for (const name of names) {
|
|
30
|
+
await this.developer.copyAssetsToLibrary(name, cwd, verbose);
|
|
31
|
+
}
|
|
32
|
+
return this.developer.syncPublish(cwd, verbose);
|
|
23
33
|
}
|
|
24
34
|
parseVerboseOption() {
|
|
25
35
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-publish.subcommand.js","sourceRoot":"","sources":["../../../../src/commands/dev.command/sync-publish.subcommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAmE;AACnE,iFAA2E;AAOpE,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,8BAAa;IACtB;IAA7B,YAA6B,SAA2B;QACtD,KAAK,EAAE,CAAC;QADmB,cAAS,GAAT,SAAS,CAAkB;IAExD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE;QACvB,OAAO,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"sync-publish.subcommand.js","sourceRoot":"","sources":["../../../../src/commands/dev.command/sync-publish.subcommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAiC;AACjC,mDAAmE;AACnE,+BAA4B;AAC5B,iFAA2E;AAOpE,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,8BAAa;IACtB;IAA7B,YAA6B,SAA2B;QACtD,KAAK,EAAE,CAAC;QADmB,cAAS,GAAT,SAAS,CAAkB;IAExD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE;QACvB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAC7C,MAAM,KAAK,GAAG,IAAA,gBAAW,EAAC,aAAa,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aAC9D,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;aACtC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAOD,kBAAkB;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA3BY,gDAAkB;AAwB7B;IALC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,KAAK;KAChB,CAAC;;;;4DAGD;6BA1BU,kBAAkB;IAL9B,IAAA,2BAAU,EAAC;QACV,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,CAAC,IAAI,CAAC;QACf,WAAW,EAAE,0CAA0C;KACxD,CAAC;qCAEwC,oCAAgB;GAD7C,kBAAkB,CA2B9B"}
|
|
@@ -11,4 +11,5 @@ export declare class DatabaseService {
|
|
|
11
11
|
executeQuery(cwd: string, query: string, params?: any[]): Promise<any>;
|
|
12
12
|
testConnection(type: 'mysql' | 'postgres', host: string, user: string, password: string, database: string, port: number, silent?: boolean): Promise<boolean | undefined>;
|
|
13
13
|
generateEnvFileIfNotExists(appPath: string, dockerComposeFilePath: string): Promise<void>;
|
|
14
|
+
private upsertEnvVariable;
|
|
14
15
|
}
|
|
@@ -142,13 +142,18 @@ let DatabaseService = class DatabaseService {
|
|
|
142
142
|
}
|
|
143
143
|
async generateEnvFileIfNotExists(appPath, dockerComposeFilePath) {
|
|
144
144
|
const envFilePath = (0, path_1.resolve)(`${appPath}/.env`);
|
|
145
|
+
const envExamplePath = (0, path_1.resolve)(`${appPath}/.env.example`);
|
|
145
146
|
let envContent = '';
|
|
146
|
-
let shouldWrite = false;
|
|
147
147
|
try {
|
|
148
148
|
envContent = await (0, promises_1.readFile)(envFilePath, 'utf8');
|
|
149
149
|
}
|
|
150
150
|
catch {
|
|
151
|
-
|
|
151
|
+
try {
|
|
152
|
+
envContent = await (0, promises_1.readFile)(envExamplePath, 'utf8');
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
envContent = '';
|
|
156
|
+
}
|
|
152
157
|
}
|
|
153
158
|
const dockerComposeContent = await (0, promises_1.readFile)(dockerComposeFilePath, 'utf8');
|
|
154
159
|
const dbServiceMatch = dockerComposeContent.match(/(\w+):\s*image:\s*(postgres|mysql)/);
|
|
@@ -157,6 +162,11 @@ let DatabaseService = class DatabaseService {
|
|
|
157
162
|
let user = 'hedhog';
|
|
158
163
|
let password = 'changeme';
|
|
159
164
|
let db = 'hedhog';
|
|
165
|
+
let port = dbType === 'postgres' ? '5432' : '3306';
|
|
166
|
+
const portMatch = dockerComposeContent.match(/ports:\s*\r?\n\s*-\s*["']?(\d+):(5432|3306)["']?/);
|
|
167
|
+
if (portMatch) {
|
|
168
|
+
port = portMatch[1];
|
|
169
|
+
}
|
|
160
170
|
if (dbType === 'postgres') {
|
|
161
171
|
user =
|
|
162
172
|
dockerComposeContent.match(/POSTGRES_USER:\s*(\w+)/)?.[1] || user;
|
|
@@ -164,10 +174,8 @@ let DatabaseService = class DatabaseService {
|
|
|
164
174
|
dockerComposeContent.match(/POSTGRES_PASSWORD:\s*(\w+)/)?.[1] ||
|
|
165
175
|
password;
|
|
166
176
|
db = dockerComposeContent.match(/POSTGRES_DB:\s*(\w+)/)?.[1] || db;
|
|
167
|
-
const newEnv = `DATABASE_URL="postgresql://${user}:${password}@localhost
|
|
168
|
-
|
|
169
|
-
await (0, promises_1.writeFile)(envFilePath, newEnv, 'utf8');
|
|
170
|
-
}
|
|
177
|
+
const newEnv = `DATABASE_URL="postgresql://${user}:${password}@localhost:${port}/${db}"`;
|
|
178
|
+
envContent = this.upsertEnvVariable(envContent, 'DATABASE_URL', newEnv);
|
|
171
179
|
}
|
|
172
180
|
else if (dbType === 'mysql') {
|
|
173
181
|
user = dockerComposeContent.match(/MYSQL_USER:\s*(\w+)/)?.[1] || user;
|
|
@@ -175,12 +183,24 @@ let DatabaseService = class DatabaseService {
|
|
|
175
183
|
dockerComposeContent.match(/MYSQL_PASSWORD:\s*(\w+)/)?.[1] ||
|
|
176
184
|
password;
|
|
177
185
|
db = dockerComposeContent.match(/MYSQL_DATABASE:\s*(\w+)/)?.[1] || db;
|
|
178
|
-
const newEnv = `DATABASE_URL="mysql://${user}:${password}@localhost
|
|
179
|
-
|
|
180
|
-
await (0, promises_1.writeFile)(envFilePath, newEnv, 'utf8');
|
|
181
|
-
}
|
|
186
|
+
const newEnv = `DATABASE_URL="mysql://${user}:${password}@localhost:${port}/${db}"`;
|
|
187
|
+
envContent = this.upsertEnvVariable(envContent, 'DATABASE_URL', newEnv);
|
|
182
188
|
}
|
|
189
|
+
await (0, promises_1.writeFile)(envFilePath, envContent, 'utf8');
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
upsertEnvVariable(envContent, variableName, variableLine) {
|
|
193
|
+
const variablePattern = new RegExp(`^${variableName}=.*$`, 'm');
|
|
194
|
+
if (variablePattern.test(envContent)) {
|
|
195
|
+
return envContent.replace(variablePattern, variableLine);
|
|
196
|
+
}
|
|
197
|
+
if (!envContent.trim()) {
|
|
198
|
+
return `${variableLine}\n`;
|
|
183
199
|
}
|
|
200
|
+
const normalizedEnvContent = envContent.endsWith('\n')
|
|
201
|
+
? envContent
|
|
202
|
+
: `${envContent}\n`;
|
|
203
|
+
return `${normalizedEnvContent}${variableLine}\n`;
|
|
184
204
|
}
|
|
185
205
|
};
|
|
186
206
|
exports.DatabaseService = DatabaseService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.service.js","sourceRoot":"","sources":["../../../../src/modules/database/database.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+BAA+B;AAC/B,0CAAkD;AAClD,4CAAkD;AAClD,+BAA+B;AAC/B,2BAA4B;AAGrB,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,KAAK,CAAC,eAAe,CAAC,GAAW;QAC/B,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,IAAA,cAAO,EAAC,GAAG,GAAG,gCAAgC,CAAC,CAAC;YACzE,MAAM,aAAa,GAAG,MAAM,IAAA,mBAAQ,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;YAC/D,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;YAClE,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;gBAC5C,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;oBAC5B,OAAO,UAAU,CAAC;gBACpB,CAAC;qBAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;oBAC9B,OAAO,OAAO,CAAC;gBACjB,CAAC;YACH,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC;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O,KAAU,EAAE,CAAC;gBACpB,IAAI,CAAC,MAAM,EAAE,CAAC;oBACZ,OAAO,CAAC,KAAK,CACX,IAAI,EACJ,KAAK,CAAC,GAAG,CAAC,0BAA0B,GAAG,KAAK,EAAE,OAAO,CAAC,CACvD,CAAC;gBACJ,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,0BAA0B,CAC9B,OAAe,EACf,qBAA6B;QAE7B,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,GAAG,OAAO,OAAO,CAAC,CAAC;QAC/C,
|
|
1
|
+
{"version":3,"file":"database.service.js","sourceRoot":"","sources":["../../../../src/modules/database/database.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+BAA+B;AAC/B,0CAAkD;AAClD,4CAAkD;AAClD,+BAA+B;AAC/B,2BAA4B;AAGrB,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,KAAK,CAAC,eAAe,CAAC,GAAW;QAC/B,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,IAAA,cAAO,EAAC,GAAG,GAAG,gCAAgC,CAAC,CAAC;YACzE,MAAM,aAAa,GAAG,MAAM,IAAA,mBAAQ,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;YAC/D,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;YAClE,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;gBAC5C,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;oBAC5B,OAAO,UAAU,CAAC;gBACpB,CAAC;qBAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;oBAC9B,OAAO,OAAO,CAAC;gBACjB,CAAC;YACH,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC5D,CAAC;QAAC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,cAAc,IAAI,IAAI,EAAE,GAAG,CAAC;gBACpF,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;YAC1E,CAAC;YAED,MAAM,IAAA,oBAAS,EAAC,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAEO,iBAAiB,CACvB,UAAkB,EAClB,YAAoB,EACpB,YAAoB;QAEpB,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,IAAI,YAAY,MAAM,EAAE,GAAG,CAAC,CAAC;QAEhE,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACrC,OAAO,UAAU,CAAC,OAAO,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;YACvB,OAAO,GAAG,YAAY,IAAI,CAAC;QAC7B,CAAC;QAED,MAAM,oBAAoB,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;YACpD,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,GAAG,UAAU,IAAI,CAAC;QAEtB,OAAO,GAAG,oBAAoB,GAAG,YAAY,IAAI,CAAC;IACpD,CAAC;CACF,CAAA;AAnPY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;GACA,eAAe,CAmP3B"}
|
|
@@ -29,6 +29,7 @@ export declare class DeveloperService {
|
|
|
29
29
|
private getCurrentKubeContext;
|
|
30
30
|
private getKubeNamespaces;
|
|
31
31
|
private getKubeClusters;
|
|
32
|
+
private getDigitalOceanClusters;
|
|
32
33
|
private extractContainerPort;
|
|
33
34
|
private getDefaultAppPort;
|
|
34
35
|
private extractDockerfileExposedPort;
|
|
@@ -49,6 +50,10 @@ export declare class DeveloperService {
|
|
|
49
50
|
private generateDockerignore;
|
|
50
51
|
private generateGitHubActionsWorkflow;
|
|
51
52
|
private generateKubernetesManifests;
|
|
53
|
+
private parseDotEnv;
|
|
54
|
+
private getAppEnvVariables;
|
|
55
|
+
private isPostgresService;
|
|
56
|
+
private generatePostgresStatefulSetManifests;
|
|
52
57
|
private generateIngressManifest;
|
|
53
58
|
private generateCertManagerIssuer;
|
|
54
59
|
private generateDeploymentReadme;
|
|
@@ -548,6 +548,21 @@ let DeveloperService = class DeveloperService {
|
|
|
548
548
|
return [];
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
|
+
async getDigitalOceanClusters() {
|
|
552
|
+
try {
|
|
553
|
+
const result = await this.runner.executeCommand(runner_service_1.ProgramName.DOCTL, ['kubernetes', 'cluster', 'list', '--output', 'json'], {}, true);
|
|
554
|
+
const parsed = JSON.parse(result.stdout || '[]');
|
|
555
|
+
return parsed
|
|
556
|
+
.filter((cluster) => !!cluster.id)
|
|
557
|
+
.map((cluster) => ({
|
|
558
|
+
name: `${cluster.name || 'cluster'} (${cluster.id})`,
|
|
559
|
+
value: String(cluster.id),
|
|
560
|
+
}));
|
|
561
|
+
}
|
|
562
|
+
catch {
|
|
563
|
+
return [];
|
|
564
|
+
}
|
|
565
|
+
}
|
|
551
566
|
extractContainerPort(ports) {
|
|
552
567
|
for (const portEntry of ports || []) {
|
|
553
568
|
if (typeof portEntry === 'number' && portEntry > 0) {
|
|
@@ -847,8 +862,16 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
847
862
|
const currentContext = await this.getCurrentKubeContext();
|
|
848
863
|
const availableNamespaces = await this.getKubeNamespaces();
|
|
849
864
|
const availableClusters = await this.getKubeClusters();
|
|
865
|
+
const digitalOceanClusters = await this.getDigitalOceanClusters();
|
|
850
866
|
const composeData = await this.getDockerComposeServices(path);
|
|
851
867
|
const availableApps = await this.getAvailableApps(path);
|
|
868
|
+
const selectableClusterChoices = [
|
|
869
|
+
...digitalOceanClusters,
|
|
870
|
+
...availableClusters.map((cluster) => ({
|
|
871
|
+
name: `${cluster} (kubectl)`,
|
|
872
|
+
value: cluster,
|
|
873
|
+
})),
|
|
874
|
+
];
|
|
852
875
|
spinner.stop();
|
|
853
876
|
if (currentContext) {
|
|
854
877
|
console.log(chalk.gray(`Current kubectl context: ${chalk.cyan(currentContext)}\n`));
|
|
@@ -864,6 +887,7 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
864
887
|
console.log(chalk.gray(`Detected ${composeData.fileName}, but no image-based services were found.\n`));
|
|
865
888
|
}
|
|
866
889
|
}
|
|
890
|
+
const doClusterIdPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
867
891
|
const answers = await inquirer_1.default.prompt([
|
|
868
892
|
{
|
|
869
893
|
type: 'list',
|
|
@@ -905,31 +929,66 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
905
929
|
{
|
|
906
930
|
type: 'list',
|
|
907
931
|
name: 'clusterSelection',
|
|
908
|
-
message: 'How would you like to
|
|
909
|
-
choices:
|
|
932
|
+
message: 'How would you like to define K8S_CLUSTER_ID?',
|
|
933
|
+
choices: selectableClusterChoices.length > 0
|
|
910
934
|
? [
|
|
911
|
-
{
|
|
912
|
-
|
|
913
|
-
|
|
935
|
+
{
|
|
936
|
+
name: 'Use current context (you can still replace with UUID next step)',
|
|
937
|
+
value: 'current',
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
name: 'Select from available clusters (includes DigitalOcean UUIDs)',
|
|
941
|
+
value: 'select',
|
|
942
|
+
},
|
|
943
|
+
{ name: 'Enter cluster ID manually', value: 'manual' },
|
|
914
944
|
]
|
|
915
|
-
: [{ name: 'Enter cluster
|
|
916
|
-
default:
|
|
917
|
-
when: () =>
|
|
945
|
+
: [{ name: 'Enter cluster ID manually', value: 'manual' }],
|
|
946
|
+
default: selectableClusterChoices.length > 0 ? 'current' : 'manual',
|
|
947
|
+
when: () => selectableClusterChoices.length > 0 || !currentContext,
|
|
918
948
|
},
|
|
919
949
|
{
|
|
920
950
|
type: 'list',
|
|
921
|
-
name: '
|
|
922
|
-
message: 'Select your Kubernetes cluster:',
|
|
923
|
-
choices:
|
|
951
|
+
name: 'clusterCandidate',
|
|
952
|
+
message: 'Select your Kubernetes cluster (used as default for K8S_CLUSTER_ID):',
|
|
953
|
+
choices: selectableClusterChoices,
|
|
924
954
|
when: (answers) => answers.clusterSelection === 'select',
|
|
925
955
|
},
|
|
926
956
|
{
|
|
927
957
|
type: 'input',
|
|
928
|
-
name: '
|
|
929
|
-
message: 'Enter your Kubernetes cluster
|
|
930
|
-
validate: (input) =>
|
|
958
|
+
name: 'clusterCandidate',
|
|
959
|
+
message: 'Enter your Kubernetes cluster ID (DigitalOcean UUID, e.g. 05c7d4fa-4bc2-4dbf-80b6-757ecec43bff):',
|
|
960
|
+
validate: (input) => {
|
|
961
|
+
const value = String(input || '').trim();
|
|
962
|
+
if (!value)
|
|
963
|
+
return 'Cluster ID is required';
|
|
964
|
+
if (!doClusterIdPattern.test(value)) {
|
|
965
|
+
return 'Use a valid UUID format for DigitalOcean cluster ID';
|
|
966
|
+
}
|
|
967
|
+
return true;
|
|
968
|
+
},
|
|
931
969
|
when: (answers) => answers.clusterSelection === 'manual',
|
|
932
970
|
},
|
|
971
|
+
{
|
|
972
|
+
type: 'input',
|
|
973
|
+
name: 'k8sClusterId',
|
|
974
|
+
message: 'Enter K8S_CLUSTER_ID for GitHub Actions (DigitalOcean UUID):',
|
|
975
|
+
default: (answers) => String(answers.clusterCandidate || currentContext || '').trim(),
|
|
976
|
+
validate: (input) => {
|
|
977
|
+
const value = String(input || '').trim();
|
|
978
|
+
if (!value)
|
|
979
|
+
return 'K8S_CLUSTER_ID is required';
|
|
980
|
+
if (!doClusterIdPattern.test(value)) {
|
|
981
|
+
return 'K8S_CLUSTER_ID must be a UUID (example: 05c7d4fa-4bc2-4dbf-80b6-757ecec43bff)';
|
|
982
|
+
}
|
|
983
|
+
return true;
|
|
984
|
+
},
|
|
985
|
+
when: (answers) => {
|
|
986
|
+
const candidate = String(answers.clusterCandidate ||
|
|
987
|
+
(answers.clusterSelection === 'current' ? currentContext : '') ||
|
|
988
|
+
'').trim();
|
|
989
|
+
return !doClusterIdPattern.test(candidate);
|
|
990
|
+
},
|
|
991
|
+
},
|
|
933
992
|
{
|
|
934
993
|
type: 'list',
|
|
935
994
|
name: 'namespaceSelection',
|
|
@@ -1009,6 +1068,14 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
1009
1068
|
})),
|
|
1010
1069
|
validate: (selected) => (selected || []).length > 0 || 'Select at least one app',
|
|
1011
1070
|
},
|
|
1071
|
+
{
|
|
1072
|
+
type: 'input',
|
|
1073
|
+
name: 'frontendUrls',
|
|
1074
|
+
message: 'Enter FRONTEND_URLS for frontend runtime (optional, comma-separated if needed):',
|
|
1075
|
+
default: (answers) => answers.domain ? `https://${String(answers.domain).trim()}` : '',
|
|
1076
|
+
filter: (input) => String(input || '').trim(),
|
|
1077
|
+
when: (answers) => (answers.apps || []).includes('admin'),
|
|
1078
|
+
},
|
|
1012
1079
|
{
|
|
1013
1080
|
type: 'checkbox',
|
|
1014
1081
|
name: 'selectedInfraServices',
|
|
@@ -1054,11 +1121,13 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
1054
1121
|
if (!answers.confirmGeneration) {
|
|
1055
1122
|
return null;
|
|
1056
1123
|
}
|
|
1057
|
-
// Set cluster
|
|
1124
|
+
// Set cluster candidate from current context if using current
|
|
1058
1125
|
if (answers.clusterSelection === 'current' && currentContext) {
|
|
1059
|
-
|
|
1060
|
-
answers.clusterName = currentContext;
|
|
1126
|
+
answers.clusterCandidate = currentContext;
|
|
1061
1127
|
}
|
|
1128
|
+
// Keep explicit K8S cluster ID and preserve backward compatibility
|
|
1129
|
+
answers.k8sClusterId = String(answers.k8sClusterId || answers.clusterCandidate || '').trim();
|
|
1130
|
+
const clusterName = answers.k8sClusterId;
|
|
1062
1131
|
// Store if namespace needs to be created
|
|
1063
1132
|
const createNamespace = answers.namespaceSelection === 'new';
|
|
1064
1133
|
const parseReplicaCount = (value) => {
|
|
@@ -1091,6 +1160,7 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
1091
1160
|
const appPorts = await this.getAppPortsFromDockerfiles(path, answers.apps || []);
|
|
1092
1161
|
return {
|
|
1093
1162
|
...answers,
|
|
1163
|
+
clusterName,
|
|
1094
1164
|
createNamespace,
|
|
1095
1165
|
appReplicas,
|
|
1096
1166
|
appPorts,
|
|
@@ -1117,7 +1187,7 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
1117
1187
|
await this.generateGitHubActionsWorkflow(workflowsDir, config);
|
|
1118
1188
|
// Generate Kubernetes manifests for each app
|
|
1119
1189
|
for (const app of config.apps) {
|
|
1120
|
-
await this.generateKubernetesManifests(k8sDir, app, config);
|
|
1190
|
+
await this.generateKubernetesManifests(path, k8sDir, app, config);
|
|
1121
1191
|
}
|
|
1122
1192
|
// Generate Ingress if requested
|
|
1123
1193
|
if (config.setupIngress) {
|
|
@@ -1127,6 +1197,8 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
1127
1197
|
if (config.setupSSL) {
|
|
1128
1198
|
await this.generateCertManagerIssuer(k8sDir, config);
|
|
1129
1199
|
}
|
|
1200
|
+
// Generate PostgreSQL StatefulSet manifest for postgres infra service
|
|
1201
|
+
await this.generatePostgresStatefulSetManifests(k8sDir, config);
|
|
1130
1202
|
// Generate optional Helm charts for detected docker-compose services
|
|
1131
1203
|
await this.generateComposeServiceHelmCharts(path, config);
|
|
1132
1204
|
// Generate README with deployment instructions
|
|
@@ -1231,12 +1303,17 @@ temp
|
|
|
1231
1303
|
await (0, promises_1.writeFile)(workflowPath, workflowContent, 'utf8');
|
|
1232
1304
|
this.log(chalk.green(`Created GitHub Actions workflow: ${workflowPath}`));
|
|
1233
1305
|
}
|
|
1234
|
-
async generateKubernetesManifests(dir, app, config) {
|
|
1306
|
+
async generateKubernetesManifests(projectPath, dir, app, config) {
|
|
1235
1307
|
const appDir = pathModule.join(dir, app);
|
|
1236
1308
|
await (0, promises_1.mkdir)(appDir, { recursive: true });
|
|
1309
|
+
const appEnv = await this.getAppEnvVariables(projectPath, app);
|
|
1237
1310
|
const deploymentTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'k8s.deployment.yaml.ejs');
|
|
1238
1311
|
const deploymentTemplate = await (0, promises_1.readFile)(deploymentTemplatePath, 'utf8');
|
|
1239
|
-
const deploymentContent = await (0, ejs_1.render)(deploymentTemplate, {
|
|
1312
|
+
const deploymentContent = await (0, ejs_1.render)(deploymentTemplate, {
|
|
1313
|
+
config,
|
|
1314
|
+
app,
|
|
1315
|
+
appEnv,
|
|
1316
|
+
});
|
|
1240
1317
|
await (0, promises_1.writeFile)(pathModule.join(appDir, 'deployment.yaml'), this.normalizeYamlContent(deploymentContent, `k8s/${app}/deployment.yaml`), 'utf8');
|
|
1241
1318
|
const serviceTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'k8s.service.yaml.ejs');
|
|
1242
1319
|
const serviceTemplate = await (0, promises_1.readFile)(serviceTemplatePath, 'utf8');
|
|
@@ -1244,6 +1321,84 @@ temp
|
|
|
1244
1321
|
await (0, promises_1.writeFile)(pathModule.join(appDir, 'service.yaml'), this.normalizeYamlContent(serviceContent, `k8s/${app}/service.yaml`), 'utf8');
|
|
1245
1322
|
this.log(chalk.green(`Created Kubernetes manifests for ${app}`));
|
|
1246
1323
|
}
|
|
1324
|
+
parseDotEnv(content) {
|
|
1325
|
+
const result = {};
|
|
1326
|
+
for (const rawLine of content.split(/\r?\n/)) {
|
|
1327
|
+
const line = rawLine.trim();
|
|
1328
|
+
if (!line || line.startsWith('#')) {
|
|
1329
|
+
continue;
|
|
1330
|
+
}
|
|
1331
|
+
const normalized = line.startsWith('export ')
|
|
1332
|
+
? line.slice('export '.length).trim()
|
|
1333
|
+
: line;
|
|
1334
|
+
const separatorIndex = normalized.indexOf('=');
|
|
1335
|
+
if (separatorIndex < 1) {
|
|
1336
|
+
continue;
|
|
1337
|
+
}
|
|
1338
|
+
const key = normalized.slice(0, separatorIndex).trim();
|
|
1339
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
let value = normalized.slice(separatorIndex + 1).trim();
|
|
1343
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
1344
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
1345
|
+
value = value.slice(1, -1);
|
|
1346
|
+
}
|
|
1347
|
+
result[key] = value;
|
|
1348
|
+
}
|
|
1349
|
+
return result;
|
|
1350
|
+
}
|
|
1351
|
+
async getAppEnvVariables(projectPath, app) {
|
|
1352
|
+
const envPath = pathModule.join(projectPath, 'apps', app, '.env');
|
|
1353
|
+
if (!(0, fs_1.existsSync)(envPath)) {
|
|
1354
|
+
return {};
|
|
1355
|
+
}
|
|
1356
|
+
try {
|
|
1357
|
+
const envContent = await (0, promises_1.readFile)(envPath, 'utf8');
|
|
1358
|
+
return this.parseDotEnv(envContent);
|
|
1359
|
+
}
|
|
1360
|
+
catch {
|
|
1361
|
+
return {};
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
isPostgresService(service) {
|
|
1365
|
+
const serviceName = String(service?.name || '').toLowerCase();
|
|
1366
|
+
const imageName = String(service?.image || '').toLowerCase();
|
|
1367
|
+
return serviceName.includes('postgres') || imageName.includes('postgres');
|
|
1368
|
+
}
|
|
1369
|
+
async generatePostgresStatefulSetManifests(k8sDir, config) {
|
|
1370
|
+
const infraServices = (config.infraServices || []);
|
|
1371
|
+
const postgresService = infraServices.find((service) => this.isPostgresService(service));
|
|
1372
|
+
if (!postgresService) {
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
const postgresDir = pathModule.join(k8sDir, 'postgres');
|
|
1376
|
+
await (0, promises_1.mkdir)(postgresDir, { recursive: true });
|
|
1377
|
+
const templatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'k8s.postgres.statefulset.yaml.ejs');
|
|
1378
|
+
const templateContent = await (0, promises_1.readFile)(templatePath, 'utf8');
|
|
1379
|
+
const statefulSetContent = await (0, ejs_1.render)(templateContent, {
|
|
1380
|
+
config,
|
|
1381
|
+
service: postgresService,
|
|
1382
|
+
postgresDbName: config.appName,
|
|
1383
|
+
});
|
|
1384
|
+
await (0, promises_1.writeFile)(pathModule.join(postgresDir, 'statefulset.yaml'), this.normalizeYamlContent(statefulSetContent, 'k8s/postgres/statefulset.yaml'), 'utf8');
|
|
1385
|
+
const serviceTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'k8s.postgres.service.yaml.ejs');
|
|
1386
|
+
const serviceTemplateContent = await (0, promises_1.readFile)(serviceTemplatePath, 'utf8');
|
|
1387
|
+
const serviceContent = await (0, ejs_1.render)(serviceTemplateContent, {
|
|
1388
|
+
config,
|
|
1389
|
+
});
|
|
1390
|
+
await (0, promises_1.writeFile)(pathModule.join(postgresDir, 'service.yaml'), this.normalizeYamlContent(serviceContent, 'k8s/postgres/service.yaml'), 'utf8');
|
|
1391
|
+
const readmeTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'k8s.postgres.readme.ms.ejs');
|
|
1392
|
+
const readmeTemplateContent = await (0, promises_1.readFile)(readmeTemplatePath, 'utf8');
|
|
1393
|
+
const readmeContent = await (0, ejs_1.render)(readmeTemplateContent, {
|
|
1394
|
+
config,
|
|
1395
|
+
postgresDbName: config.appName,
|
|
1396
|
+
postgresResourceName: `postgresql-${config.appName}`,
|
|
1397
|
+
k8sClusterId: config.k8sClusterId || config.clusterName,
|
|
1398
|
+
});
|
|
1399
|
+
await (0, promises_1.writeFile)(pathModule.join(postgresDir, 'README.ms'), readmeContent, 'utf8');
|
|
1400
|
+
this.log(chalk.green('Created PostgreSQL Kubernetes manifests and README'));
|
|
1401
|
+
}
|
|
1247
1402
|
async generateIngressManifest(dir, config) {
|
|
1248
1403
|
const templatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'k8s.ingress.yaml.ejs');
|
|
1249
1404
|
const templateContent = await (0, promises_1.readFile)(templatePath, 'utf8');
|
|
@@ -1273,7 +1428,8 @@ temp
|
|
|
1273
1428
|
console.log(chalk.white('Deploy Branch: ') +
|
|
1274
1429
|
chalk.cyan(config.deployBranch || 'production'));
|
|
1275
1430
|
}
|
|
1276
|
-
console.log(chalk.white('Cluster:
|
|
1431
|
+
console.log(chalk.white('K8S Cluster ID: ') +
|
|
1432
|
+
chalk.cyan(config.k8sClusterId || config.clusterName));
|
|
1277
1433
|
console.log(chalk.white('Namespace: ') +
|
|
1278
1434
|
chalk.cyan(config.namespace) +
|
|
1279
1435
|
chalk.gray(config.createNamespace ? ' (will be created)' : ' (existing)'));
|
|
@@ -1282,6 +1438,9 @@ temp
|
|
|
1282
1438
|
if (config.domain) {
|
|
1283
1439
|
console.log(chalk.white('Domain: ') + chalk.cyan(config.domain));
|
|
1284
1440
|
}
|
|
1441
|
+
if (config.frontendUrls) {
|
|
1442
|
+
console.log(chalk.white('Frontend URLs: ') + chalk.cyan(config.frontendUrls));
|
|
1443
|
+
}
|
|
1285
1444
|
console.log(chalk.white('Apps: ') + chalk.cyan(config.apps.join(', ')));
|
|
1286
1445
|
console.log(chalk.white('Replicas: ') +
|
|
1287
1446
|
chalk.cyan(config.apps
|
|
@@ -1298,6 +1457,7 @@ temp
|
|
|
1298
1457
|
console.log(chalk.green.bold('\n✓ Generated Files:\n'));
|
|
1299
1458
|
console.log(chalk.gray(' .dockerignore'));
|
|
1300
1459
|
console.log(chalk.gray(' .github/workflows/deploy.yml'));
|
|
1460
|
+
const hasPostgresInfra = (config.infraServices || []).some((service) => this.isPostgresService(service));
|
|
1301
1461
|
config.apps.forEach((app) => {
|
|
1302
1462
|
console.log(chalk.gray(` k8s/${app}/deployment.yaml`));
|
|
1303
1463
|
console.log(chalk.gray(` k8s/${app}/service.yaml`));
|
|
@@ -1311,6 +1471,11 @@ temp
|
|
|
1311
1471
|
if (config.setupSSL) {
|
|
1312
1472
|
console.log(chalk.gray(' k8s/cert-manager-issuer.yaml'));
|
|
1313
1473
|
}
|
|
1474
|
+
if (hasPostgresInfra) {
|
|
1475
|
+
console.log(chalk.gray(' k8s/postgres/service.yaml'));
|
|
1476
|
+
console.log(chalk.gray(' k8s/postgres/statefulset.yaml'));
|
|
1477
|
+
console.log(chalk.gray(' k8s/postgres/README.ms'));
|
|
1478
|
+
}
|
|
1314
1479
|
if ((config.infraServices || []).length > 0) {
|
|
1315
1480
|
config.infraServices.forEach((service) => {
|
|
1316
1481
|
console.log(chalk.gray(` helm/services/${service.name}/Chart.yaml`));
|