@hed-hog/cli 0.0.79 → 0.0.81
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/modules/developer/developer.service.d.ts +1 -1
- package/dist/src/modules/developer/developer.service.js +63 -31
- package/dist/src/modules/developer/developer.service.js.map +1 -1
- package/dist/src/templates/deployment/helm.postgres.chart.yaml.ejs +6 -0
- package/dist/src/templates/deployment/helm.postgres.headless-service.yaml.ejs +14 -0
- package/dist/src/templates/deployment/helm.postgres.pvc.yaml.ejs +18 -0
- package/dist/src/templates/deployment/helm.postgres.secret.yaml.ejs +9 -0
- package/dist/src/templates/deployment/helm.postgres.service.yaml.ejs +14 -0
- package/dist/src/templates/deployment/helm.postgres.statefulset.yaml.ejs +42 -0
- package/dist/src/templates/deployment/helm.postgres.values.yaml.ejs +24 -0
- package/dist/src/templates/library/tsconfig.production.json.ejs +3 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -66,7 +66,7 @@ export declare class DeveloperService {
|
|
|
66
66
|
private parseDotEnv;
|
|
67
67
|
private getAppEnvVariables;
|
|
68
68
|
private isPostgresService;
|
|
69
|
-
private
|
|
69
|
+
private generatePostgresHelmChart;
|
|
70
70
|
private generateIngressManifest;
|
|
71
71
|
private generateCertManagerIssuer;
|
|
72
72
|
private generateDeploymentReadme;
|
|
@@ -1365,8 +1365,8 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
1365
1365
|
if (config.setupSSL) {
|
|
1366
1366
|
await this.generateCertManagerIssuer(k8sDir, config);
|
|
1367
1367
|
}
|
|
1368
|
-
// Generate
|
|
1369
|
-
await this.
|
|
1368
|
+
// Generate dedicated Helm chart for postgres infra service
|
|
1369
|
+
await this.generatePostgresHelmChart(path, config);
|
|
1370
1370
|
// Generate optional Helm charts for detected docker-compose services
|
|
1371
1371
|
await this.generateComposeServiceHelmCharts(path, config);
|
|
1372
1372
|
// Generate README with deployment instructions
|
|
@@ -1402,6 +1402,9 @@ CMD ["sh", "-c", "${startCmd}"]
|
|
|
1402
1402
|
const servicesRoot = pathModule.join(path, 'helm', 'services');
|
|
1403
1403
|
await (0, promises_1.mkdir)(servicesRoot, { recursive: true });
|
|
1404
1404
|
for (const service of infraServices) {
|
|
1405
|
+
if (this.isPostgresService(service)) {
|
|
1406
|
+
continue;
|
|
1407
|
+
}
|
|
1405
1408
|
const chartDir = pathModule.join(servicesRoot, service.name);
|
|
1406
1409
|
const templatesDir = pathModule.join(chartDir, 'templates');
|
|
1407
1410
|
await (0, promises_1.mkdir)(templatesDir, { recursive: true });
|
|
@@ -1534,38 +1537,59 @@ temp
|
|
|
1534
1537
|
const imageName = String(service?.image || '').toLowerCase();
|
|
1535
1538
|
return serviceName.includes('postgres') || imageName.includes('postgres');
|
|
1536
1539
|
}
|
|
1537
|
-
async
|
|
1540
|
+
async generatePostgresHelmChart(path, config) {
|
|
1538
1541
|
const infraServices = (config.infraServices || []);
|
|
1539
1542
|
const postgresService = infraServices.find((service) => this.isPostgresService(service));
|
|
1540
1543
|
if (!postgresService) {
|
|
1541
1544
|
return;
|
|
1542
1545
|
}
|
|
1543
|
-
const postgresDir = pathModule.join(
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
const
|
|
1547
|
-
|
|
1546
|
+
const postgresDir = pathModule.join(path, 'helm', 'services', 'postgres');
|
|
1547
|
+
const templatesDir = pathModule.join(postgresDir, 'templates');
|
|
1548
|
+
await (0, promises_1.mkdir)(templatesDir, { recursive: true });
|
|
1549
|
+
const servicePort = postgresService.containerPort ||
|
|
1550
|
+
this.getDefaultServicePort(postgresService.name);
|
|
1551
|
+
const chartTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'helm.postgres.chart.yaml.ejs');
|
|
1552
|
+
const valuesTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'helm.postgres.values.yaml.ejs');
|
|
1553
|
+
const headlessServiceTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'helm.postgres.headless-service.yaml.ejs');
|
|
1554
|
+
const pvcTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'helm.postgres.pvc.yaml.ejs');
|
|
1555
|
+
const secretTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'helm.postgres.secret.yaml.ejs');
|
|
1556
|
+
const serviceTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'helm.postgres.service.yaml.ejs');
|
|
1557
|
+
const statefulSetTemplatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'helm.postgres.statefulset.yaml.ejs');
|
|
1558
|
+
const renderContext = {
|
|
1548
1559
|
config,
|
|
1549
1560
|
service: postgresService,
|
|
1561
|
+
servicePort,
|
|
1550
1562
|
postgresDbName: config.appName,
|
|
1563
|
+
};
|
|
1564
|
+
const chartYaml = await (0, ejs_1.render)(await (0, promises_1.readFile)(chartTemplatePath, 'utf8'), {
|
|
1565
|
+
...renderContext,
|
|
1551
1566
|
});
|
|
1552
|
-
await (0,
|
|
1553
|
-
|
|
1554
|
-
const serviceTemplateContent = await (0, promises_1.readFile)(serviceTemplatePath, 'utf8');
|
|
1555
|
-
const serviceContent = await (0, ejs_1.render)(serviceTemplateContent, {
|
|
1556
|
-
config,
|
|
1567
|
+
const valuesYaml = await (0, ejs_1.render)(await (0, promises_1.readFile)(valuesTemplatePath, 'utf8'), {
|
|
1568
|
+
...renderContext,
|
|
1557
1569
|
});
|
|
1558
|
-
await (0,
|
|
1559
|
-
|
|
1560
|
-
const readmeTemplateContent = await (0, promises_1.readFile)(readmeTemplatePath, 'utf8');
|
|
1561
|
-
const readmeContent = await (0, ejs_1.render)(readmeTemplateContent, {
|
|
1562
|
-
config,
|
|
1563
|
-
postgresDbName: config.appName,
|
|
1564
|
-
postgresResourceName: `postgresql-${config.appName}`,
|
|
1565
|
-
k8sClusterId: config.k8sClusterId || config.clusterName,
|
|
1570
|
+
const headlessServiceYaml = await (0, ejs_1.render)(await (0, promises_1.readFile)(headlessServiceTemplatePath, 'utf8'), {
|
|
1571
|
+
...renderContext,
|
|
1566
1572
|
});
|
|
1567
|
-
await (0,
|
|
1568
|
-
|
|
1573
|
+
const pvcYaml = await (0, ejs_1.render)(await (0, promises_1.readFile)(pvcTemplatePath, 'utf8'), {
|
|
1574
|
+
...renderContext,
|
|
1575
|
+
});
|
|
1576
|
+
const secretYaml = await (0, ejs_1.render)(await (0, promises_1.readFile)(secretTemplatePath, 'utf8'), {
|
|
1577
|
+
...renderContext,
|
|
1578
|
+
});
|
|
1579
|
+
const serviceYaml = await (0, ejs_1.render)(await (0, promises_1.readFile)(serviceTemplatePath, 'utf8'), {
|
|
1580
|
+
...renderContext,
|
|
1581
|
+
});
|
|
1582
|
+
const statefulSetYaml = await (0, ejs_1.render)(await (0, promises_1.readFile)(statefulSetTemplatePath, 'utf8'), {
|
|
1583
|
+
...renderContext,
|
|
1584
|
+
});
|
|
1585
|
+
await (0, promises_1.writeFile)(pathModule.join(postgresDir, 'Chart.yaml'), this.normalizeYamlContent(chartYaml, 'helm/services/postgres/Chart.yaml'), 'utf8');
|
|
1586
|
+
await (0, promises_1.writeFile)(pathModule.join(postgresDir, 'values.yaml'), this.normalizeYamlContent(valuesYaml, 'helm/services/postgres/values.yaml'), 'utf8');
|
|
1587
|
+
await (0, promises_1.writeFile)(pathModule.join(templatesDir, 'headless-service.yaml'), headlessServiceYaml, 'utf8');
|
|
1588
|
+
await (0, promises_1.writeFile)(pathModule.join(templatesDir, 'pvc.yaml'), pvcYaml, 'utf8');
|
|
1589
|
+
await (0, promises_1.writeFile)(pathModule.join(templatesDir, 'secret.yaml'), secretYaml, 'utf8');
|
|
1590
|
+
await (0, promises_1.writeFile)(pathModule.join(templatesDir, 'service.yaml'), serviceYaml, 'utf8');
|
|
1591
|
+
await (0, promises_1.writeFile)(pathModule.join(templatesDir, 'statefulset.yaml'), statefulSetYaml, 'utf8');
|
|
1592
|
+
this.log(chalk.green('Created PostgreSQL Helm chart files'));
|
|
1569
1593
|
}
|
|
1570
1594
|
async generateIngressManifest(dir, config) {
|
|
1571
1595
|
const templatePath = pathModule.join(__dirname, '..', '..', 'templates', 'deployment', 'k8s.ingress.yaml.ejs');
|
|
@@ -1640,12 +1664,17 @@ temp
|
|
|
1640
1664
|
console.log(chalk.gray(' k8s/cert-manager-issuer.yaml'));
|
|
1641
1665
|
}
|
|
1642
1666
|
if (hasPostgresInfra) {
|
|
1643
|
-
console.log(chalk.gray('
|
|
1644
|
-
console.log(chalk.gray('
|
|
1645
|
-
console.log(chalk.gray('
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1667
|
+
console.log(chalk.gray(' helm/services/postgres/Chart.yaml'));
|
|
1668
|
+
console.log(chalk.gray(' helm/services/postgres/values.yaml'));
|
|
1669
|
+
console.log(chalk.gray(' helm/services/postgres/templates/headless-service.yaml'));
|
|
1670
|
+
console.log(chalk.gray(' helm/services/postgres/templates/pvc.yaml'));
|
|
1671
|
+
console.log(chalk.gray(' helm/services/postgres/templates/secret.yaml'));
|
|
1672
|
+
console.log(chalk.gray(' helm/services/postgres/templates/service.yaml'));
|
|
1673
|
+
console.log(chalk.gray(' helm/services/postgres/templates/statefulset.yaml'));
|
|
1674
|
+
}
|
|
1675
|
+
const nonPostgresInfraServices = (config.infraServices || []).filter((service) => !this.isPostgresService(service));
|
|
1676
|
+
if (nonPostgresInfraServices.length > 0) {
|
|
1677
|
+
nonPostgresInfraServices.forEach((service) => {
|
|
1649
1678
|
console.log(chalk.gray(` helm/services/${service.name}/Chart.yaml`));
|
|
1650
1679
|
console.log(chalk.gray(` helm/services/${service.name}/values.yaml`));
|
|
1651
1680
|
console.log(chalk.gray(` helm/services/${service.name}/templates/deployment.yaml`));
|
|
@@ -1658,10 +1687,13 @@ temp
|
|
|
1658
1687
|
console.log(chalk.white('2. Read DEPLOYMENT.md for setup instructions'));
|
|
1659
1688
|
console.log(chalk.white('3. Configure GitHub secrets now with this CLI or follow DEPLOYMENT.md'));
|
|
1660
1689
|
console.log(chalk.white(`4. Push to ${config.deployBranch || 'production'} branch to trigger deployment`));
|
|
1661
|
-
if (
|
|
1690
|
+
if (hasPostgresInfra || nonPostgresInfraServices.length > 0) {
|
|
1662
1691
|
console.log('');
|
|
1663
1692
|
console.log(chalk.blue.bold('ℹ Additional service charts were generated only (not applied):'));
|
|
1664
|
-
|
|
1693
|
+
if (hasPostgresInfra) {
|
|
1694
|
+
console.log(chalk.white(` helm upgrade --install postgres ./helm/services/postgres --namespace ${config.namespace} --create-namespace`));
|
|
1695
|
+
}
|
|
1696
|
+
nonPostgresInfraServices.forEach((service) => {
|
|
1665
1697
|
console.log(chalk.white(` helm upgrade --install ${service.name} ./helm/services/${service.name} --namespace ${config.namespace} --create-namespace`));
|
|
1666
1698
|
});
|
|
1667
1699
|
}
|