@ctxpipe/aws-cdk 0.0.0-beta-20260528142254
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 +131 -0
- package/lib/ctxpipe.d.ts +20 -0
- package/lib/ctxpipe.d.ts.map +1 -0
- package/lib/ctxpipe.js +322 -0
- package/lib/ctxpipe.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/contracts.d.ts +154 -0
- package/lib/internal/contracts.d.ts.map +1 -0
- package/lib/internal/contracts.js +3 -0
- package/lib/internal/contracts.js.map +1 -0
- package/lib/internal/data-plane-construct.d.ts +7 -0
- package/lib/internal/data-plane-construct.d.ts.map +1 -0
- package/lib/internal/data-plane-construct.js +114 -0
- package/lib/internal/data-plane-construct.js.map +1 -0
- package/lib/internal/ingress-construct.d.ts +7 -0
- package/lib/internal/ingress-construct.d.ts.map +1 -0
- package/lib/internal/ingress-construct.js +94 -0
- package/lib/internal/ingress-construct.js.map +1 -0
- package/lib/internal/migrate-on-deploy-construct.d.ts +7 -0
- package/lib/internal/migrate-on-deploy-construct.d.ts.map +1 -0
- package/lib/internal/migrate-on-deploy-construct.js +208 -0
- package/lib/internal/migrate-on-deploy-construct.js.map +1 -0
- package/lib/internal/networking-construct.d.ts +7 -0
- package/lib/internal/networking-construct.d.ts.map +1 -0
- package/lib/internal/networking-construct.js +112 -0
- package/lib/internal/networking-construct.js.map +1 -0
- package/lib/internal/outputs-construct.d.ts +6 -0
- package/lib/internal/outputs-construct.d.ts.map +1 -0
- package/lib/internal/outputs-construct.js +65 -0
- package/lib/internal/outputs-construct.js.map +1 -0
- package/lib/internal/secrets-construct.d.ts +7 -0
- package/lib/internal/secrets-construct.d.ts.map +1 -0
- package/lib/internal/secrets-construct.js +211 -0
- package/lib/internal/secrets-construct.js.map +1 -0
- package/lib/internal/services-construct.d.ts +7 -0
- package/lib/internal/services-construct.d.ts.map +1 -0
- package/lib/internal/services-construct.js +123 -0
- package/lib/internal/services-construct.js.map +1 -0
- package/lib/internal/task-definitions-construct.d.ts +8 -0
- package/lib/internal/task-definitions-construct.d.ts.map +1 -0
- package/lib/internal/task-definitions-construct.js +204 -0
- package/lib/internal/task-definitions-construct.js.map +1 -0
- package/lib/pinned-service-image-tag.d.ts +7 -0
- package/lib/pinned-service-image-tag.d.ts.map +1 -0
- package/lib/pinned-service-image-tag.js +11 -0
- package/lib/pinned-service-image-tag.js.map +1 -0
- package/lib/types.d.ts +57 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.OutputsConstruct = void 0;
|
|
37
|
+
const cdk = __importStar(require("aws-cdk-lib"));
|
|
38
|
+
const constructs_1 = require("constructs");
|
|
39
|
+
class OutputsConstruct extends constructs_1.Construct {
|
|
40
|
+
constructor(scope, id, props) {
|
|
41
|
+
super(scope, id);
|
|
42
|
+
new cdk.CfnOutput(this, "AppUrl", {
|
|
43
|
+
value: props.appUrl,
|
|
44
|
+
});
|
|
45
|
+
new cdk.CfnOutput(this, "AlbDnsName", {
|
|
46
|
+
value: props.albDnsName,
|
|
47
|
+
});
|
|
48
|
+
new cdk.CfnOutput(this, "DatabaseUrlSecretArn", {
|
|
49
|
+
value: props.databaseUrlSecretArn,
|
|
50
|
+
});
|
|
51
|
+
new cdk.CfnOutput(this, "ModelProviderSecretArn", {
|
|
52
|
+
value: props.modelProviderSecretArn,
|
|
53
|
+
});
|
|
54
|
+
new cdk.CfnOutput(this, "SmtpSecretArn", {
|
|
55
|
+
value: props.smtpSecretArn,
|
|
56
|
+
});
|
|
57
|
+
if (props.connectorSecretArn) {
|
|
58
|
+
new cdk.CfnOutput(this, "ConnectorSecretArn", {
|
|
59
|
+
value: props.connectorSecretArn,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.OutputsConstruct = OutputsConstruct;
|
|
65
|
+
//# sourceMappingURL=outputs-construct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputs-construct.js","sourceRoot":"","sources":["../../src/internal/outputs-construct.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,2CAAuC;AAGvC,MAAa,gBAAiB,SAAQ,sBAAS;IAC7C,YAAmB,KAAgB,EAAE,EAAU,EAAE,KAA4B;QAC3E,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE;YAChC,KAAK,EAAE,KAAK,CAAC,MAAM;SACpB,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE;YACpC,KAAK,EAAE,KAAK,CAAC,UAAU;SACxB,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,sBAAsB,EAAE;YAC9C,KAAK,EAAE,KAAK,CAAC,oBAAoB;SAClC,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,wBAAwB,EAAE;YAChD,KAAK,EAAE,KAAK,CAAC,sBAAsB;SACpC,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE;YACvC,KAAK,EAAE,KAAK,CAAC,aAAa;SAC3B,CAAC,CAAC;QAEH,IAAI,KAAK,CAAC,kBAAkB,EAAE,CAAC;YAC7B,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,oBAAoB,EAAE;gBAC5C,KAAK,EAAE,KAAK,CAAC,kBAAkB;aAChC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA1BD,4CA0BC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import type { SecretsConstructProps, SecretsResources } from "./contracts";
|
|
3
|
+
export declare class SecretsConstruct extends Construct {
|
|
4
|
+
readonly resources: SecretsResources;
|
|
5
|
+
constructor(scope: Construct, id: string, props: SecretsConstructProps);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=secrets-construct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-construct.d.ts","sourceRoot":"","sources":["../../src/internal/secrets-construct.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3E,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,SAAgB,SAAS,EAAE,gBAAgB,CAAC;gBAEzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB;CA6M9E"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SecretsConstruct = void 0;
|
|
37
|
+
const cdk = __importStar(require("aws-cdk-lib"));
|
|
38
|
+
const ecs = __importStar(require("aws-cdk-lib/aws-ecs"));
|
|
39
|
+
const iam = __importStar(require("aws-cdk-lib/aws-iam"));
|
|
40
|
+
const lambda = __importStar(require("aws-cdk-lib/aws-lambda"));
|
|
41
|
+
const ses = __importStar(require("aws-cdk-lib/aws-ses"));
|
|
42
|
+
const secretsmanager = __importStar(require("aws-cdk-lib/aws-secretsmanager"));
|
|
43
|
+
const cr = __importStar(require("aws-cdk-lib/custom-resources"));
|
|
44
|
+
const constructs_1 = require("constructs");
|
|
45
|
+
class SecretsConstruct extends constructs_1.Construct {
|
|
46
|
+
resources;
|
|
47
|
+
constructor(scope, id, props) {
|
|
48
|
+
super(scope, id);
|
|
49
|
+
const authSecret = new secretsmanager.Secret(this, "AuthSecret", {
|
|
50
|
+
generateSecretString: {
|
|
51
|
+
secretStringTemplate: "{}",
|
|
52
|
+
generateStringKey: "AUTH_SECRET",
|
|
53
|
+
passwordLength: 64,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const databaseUrl = cdk.Fn.join("", [
|
|
57
|
+
"postgresql://ctxpipe:",
|
|
58
|
+
props.dataPlane.dbCredentialsSecret.secretValueFromJson("password").toString(),
|
|
59
|
+
"@",
|
|
60
|
+
props.dataPlane.dbCluster.clusterEndpoint.hostname,
|
|
61
|
+
":",
|
|
62
|
+
cdk.Token.asString(props.dataPlane.dbCluster.clusterEndpoint.port),
|
|
63
|
+
"/",
|
|
64
|
+
props.databaseName,
|
|
65
|
+
]);
|
|
66
|
+
const databaseUrlSecret = new secretsmanager.Secret(this, "DatabaseUrlSecret", {
|
|
67
|
+
secretObjectValue: {
|
|
68
|
+
DATABASE_URL: cdk.SecretValue.unsafePlainText(databaseUrl),
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
const modelProviderSecret = new secretsmanager.Secret(this, "ModelProviderSecret", {
|
|
72
|
+
secretObjectValue: {
|
|
73
|
+
API_KEY: props.modelProviderApiKey,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
const sesIdentity = new ses.EmailIdentity(this, "SesIdentity", {
|
|
77
|
+
// The hosted zone passed to CtxPipe is expected to be public.
|
|
78
|
+
identity: ses.Identity.publicHostedZone(props.hostedZone),
|
|
79
|
+
});
|
|
80
|
+
const sesSmtpUser = new iam.User(this, "SesSmtpUser");
|
|
81
|
+
sesIdentity.grantSendEmail(sesSmtpUser);
|
|
82
|
+
sesSmtpUser.addToPolicy(new iam.PolicyStatement({
|
|
83
|
+
actions: ["ses:SendEmail", "ses:SendRawEmail"],
|
|
84
|
+
resources: ["*"],
|
|
85
|
+
}));
|
|
86
|
+
const sesSmtpAccessKey = new iam.CfnAccessKey(this, "SesSmtpAccessKey", {
|
|
87
|
+
userName: sesSmtpUser.userName,
|
|
88
|
+
});
|
|
89
|
+
const smtpPasswordFunction = new lambda.Function(this, "SesSmtpPasswordFunction", {
|
|
90
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
91
|
+
handler: "index.handler",
|
|
92
|
+
timeout: cdk.Duration.seconds(15),
|
|
93
|
+
code: lambda.Code.fromInline(`
|
|
94
|
+
const crypto = require("crypto");
|
|
95
|
+
function sign(key, message) {
|
|
96
|
+
return crypto.createHmac("sha256", key).update(message, "utf8").digest();
|
|
97
|
+
}
|
|
98
|
+
function toSmtpPassword(secretAccessKey, region) {
|
|
99
|
+
const kDate = sign("AWS4" + secretAccessKey, "11111111");
|
|
100
|
+
const kRegion = sign(kDate, region);
|
|
101
|
+
const kService = sign(kRegion, "ses");
|
|
102
|
+
const kSigning = sign(kService, "aws4_request");
|
|
103
|
+
const kMessage = sign(kSigning, "SendRawEmail");
|
|
104
|
+
return Buffer.concat([Buffer.from([0x04]), kMessage]).toString("base64");
|
|
105
|
+
}
|
|
106
|
+
exports.handler = async (event) => {
|
|
107
|
+
if (event.RequestType === "Delete") {
|
|
108
|
+
return { PhysicalResourceId: event.PhysicalResourceId || "ses-smtp-config" };
|
|
109
|
+
}
|
|
110
|
+
const accessKeyId = event.ResourceProperties.AccessKeyId;
|
|
111
|
+
const secretAccessKey = event.ResourceProperties.SecretAccessKey;
|
|
112
|
+
const region = event.ResourceProperties.Region;
|
|
113
|
+
const fromAddress = event.ResourceProperties.FromAddress;
|
|
114
|
+
const normalizedFromAddress = String(fromAddress).replace(/\\.$/, "");
|
|
115
|
+
const smtpPassword = toSmtpPassword(secretAccessKey, region);
|
|
116
|
+
const encodedUser = encodeURIComponent(accessKeyId);
|
|
117
|
+
const encodedPass = encodeURIComponent(smtpPassword);
|
|
118
|
+
return {
|
|
119
|
+
PhysicalResourceId: "ses-smtp-config",
|
|
120
|
+
Data: {
|
|
121
|
+
SmtpConnectionUrl: "smtps://" + encodedUser + ":" + encodedPass + "@email-smtp." + region + ".amazonaws.com:465",
|
|
122
|
+
EmailFromAddress: normalizedFromAddress
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
`),
|
|
127
|
+
});
|
|
128
|
+
const smtpProvider = new cr.Provider(this, "SesSmtpProvider", {
|
|
129
|
+
onEventHandler: smtpPasswordFunction,
|
|
130
|
+
});
|
|
131
|
+
const smtpConfiguration = new cdk.CustomResource(this, "SesSmtpConfig", {
|
|
132
|
+
serviceToken: smtpProvider.serviceToken,
|
|
133
|
+
properties: {
|
|
134
|
+
AccessKeyId: sesSmtpAccessKey.ref,
|
|
135
|
+
SecretAccessKey: sesSmtpAccessKey.attrSecretAccessKey,
|
|
136
|
+
Region: cdk.Stack.of(this).region,
|
|
137
|
+
FromAddress: props.emailFromAddress,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
const smtpSecret = new secretsmanager.Secret(this, "SmtpSecret", {
|
|
141
|
+
secretObjectValue: {
|
|
142
|
+
SMTP_CONNECTION_URL: cdk.SecretValue.unsafePlainText(smtpConfiguration.getAttString("SmtpConnectionUrl")),
|
|
143
|
+
EMAIL_FROM_ADDRESS: cdk.SecretValue.unsafePlainText(smtpConfiguration.getAttString("EmailFromAddress")),
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
smtpSecret.node.addDependency(sesIdentity);
|
|
147
|
+
const connectorSecret = props.connectorSecrets
|
|
148
|
+
? new secretsmanager.Secret(this, "ConnectorSecret", {
|
|
149
|
+
secretObjectValue: {
|
|
150
|
+
...(props.connectorSecrets.githubAppId
|
|
151
|
+
? { GITHUB_APP_ID: props.connectorSecrets.githubAppId }
|
|
152
|
+
: {}),
|
|
153
|
+
...(props.connectorSecrets.githubPrivateKey
|
|
154
|
+
? { GITHUB_PRIVATE_KEY: props.connectorSecrets.githubPrivateKey }
|
|
155
|
+
: {}),
|
|
156
|
+
...(props.connectorSecrets.githubWebhookSecret
|
|
157
|
+
? { GITHUB_WEBHOOK_SECRET: props.connectorSecrets.githubWebhookSecret }
|
|
158
|
+
: {}),
|
|
159
|
+
...(props.connectorSecrets.githubClientId
|
|
160
|
+
? { GITHUB_CLIENT_ID: props.connectorSecrets.githubClientId }
|
|
161
|
+
: {}),
|
|
162
|
+
...(props.connectorSecrets.githubClientSecret
|
|
163
|
+
? { GITHUB_CLIENT_SECRET: props.connectorSecrets.githubClientSecret }
|
|
164
|
+
: {}),
|
|
165
|
+
...(props.connectorSecrets.atlassianClientId
|
|
166
|
+
? { ATLASSIAN_CLIENT_ID: props.connectorSecrets.atlassianClientId }
|
|
167
|
+
: {}),
|
|
168
|
+
...(props.connectorSecrets.atlassianClientSecret
|
|
169
|
+
? {
|
|
170
|
+
ATLASSIAN_CLIENT_SECRET: props.connectorSecrets.atlassianClientSecret,
|
|
171
|
+
}
|
|
172
|
+
: {}),
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
: undefined;
|
|
176
|
+
const connectorEnv = {};
|
|
177
|
+
if (connectorSecret) {
|
|
178
|
+
if (props.connectorSecrets?.githubAppId) {
|
|
179
|
+
connectorEnv.GITHUB_APP_ID = ecs.Secret.fromSecretsManager(connectorSecret, "GITHUB_APP_ID");
|
|
180
|
+
}
|
|
181
|
+
if (props.connectorSecrets?.githubPrivateKey) {
|
|
182
|
+
connectorEnv.GITHUB_PRIVATE_KEY = ecs.Secret.fromSecretsManager(connectorSecret, "GITHUB_PRIVATE_KEY");
|
|
183
|
+
}
|
|
184
|
+
if (props.connectorSecrets?.githubWebhookSecret) {
|
|
185
|
+
connectorEnv.GITHUB_WEBHOOK_SECRET = ecs.Secret.fromSecretsManager(connectorSecret, "GITHUB_WEBHOOK_SECRET");
|
|
186
|
+
}
|
|
187
|
+
if (props.connectorSecrets?.githubClientId) {
|
|
188
|
+
connectorEnv.GITHUB_CLIENT_ID = ecs.Secret.fromSecretsManager(connectorSecret, "GITHUB_CLIENT_ID");
|
|
189
|
+
}
|
|
190
|
+
if (props.connectorSecrets?.githubClientSecret) {
|
|
191
|
+
connectorEnv.GITHUB_CLIENT_SECRET = ecs.Secret.fromSecretsManager(connectorSecret, "GITHUB_CLIENT_SECRET");
|
|
192
|
+
}
|
|
193
|
+
if (props.connectorSecrets?.atlassianClientId) {
|
|
194
|
+
connectorEnv.ATLASSIAN_CLIENT_ID = ecs.Secret.fromSecretsManager(connectorSecret, "ATLASSIAN_CLIENT_ID");
|
|
195
|
+
}
|
|
196
|
+
if (props.connectorSecrets?.atlassianClientSecret) {
|
|
197
|
+
connectorEnv.ATLASSIAN_CLIENT_SECRET = ecs.Secret.fromSecretsManager(connectorSecret, "ATLASSIAN_CLIENT_SECRET");
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
this.resources = {
|
|
201
|
+
authSecret,
|
|
202
|
+
databaseUrlSecret,
|
|
203
|
+
modelProviderSecret,
|
|
204
|
+
smtpSecret,
|
|
205
|
+
connectorSecret,
|
|
206
|
+
connectorEnv,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.SecretsConstruct = SecretsConstruct;
|
|
211
|
+
//# sourceMappingURL=secrets-construct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-construct.js","sourceRoot":"","sources":["../../src/internal/secrets-construct.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,yDAA2C;AAC3C,yDAA2C;AAC3C,+DAAiD;AAEjD,yDAA2C;AAC3C,+EAAiE;AACjE,iEAAmD;AACnD,2CAAuC;AAGvC,MAAa,gBAAiB,SAAQ,sBAAS;IAC7B,SAAS,CAAmB;IAE5C,YAAmB,KAAgB,EAAE,EAAU,EAAE,KAA4B;QAC3E,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,MAAM,UAAU,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE;YAC/D,oBAAoB,EAAE;gBACpB,oBAAoB,EAAE,IAAI;gBAC1B,iBAAiB,EAAE,aAAa;gBAChC,cAAc,EAAE,EAAE;aACnB;SACF,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE;YAClC,uBAAuB;YACvB,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,UAAU,CAAC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AAC;YACD,IAAI,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;gBAClD,YAAY,CAAC,uBAAuB,GAAG,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAClE,eAAe,EACf,yBAAyB,CAC1B,CAAC;YACJ,CAAC;QACH,CAAC;QAED,IAAI,CAAC,SAAS,GAAG;YACf,UAAU;YACV,iBAAiB;YACjB,mBAAmB;YACnB,UAAU;YACV,eAAe;YACf,YAAY;SACb,CAAC;IACJ,CAAC;CACF;AAhND,4CAgNC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import type { ServiceResources, ServicesConstructProps } from "./contracts";
|
|
3
|
+
export declare class ServicesConstruct extends Construct {
|
|
4
|
+
readonly resources: ServiceResources;
|
|
5
|
+
constructor(scope: Construct, id: string, props: ServicesConstructProps);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=services-construct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services-construct.d.ts","sourceRoot":"","sources":["../../src/internal/services-construct.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBAAa,iBAAkB,SAAQ,SAAS;IAC9C,SAAgB,SAAS,EAAE,gBAAgB,CAAC;gBAEzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB;CAqF/E"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ServicesConstruct = void 0;
|
|
37
|
+
const ec2 = __importStar(require("aws-cdk-lib/aws-ec2"));
|
|
38
|
+
const ecs = __importStar(require("aws-cdk-lib/aws-ecs"));
|
|
39
|
+
const constructs_1 = require("constructs");
|
|
40
|
+
class ServicesConstruct extends constructs_1.Construct {
|
|
41
|
+
resources;
|
|
42
|
+
constructor(scope, id, props) {
|
|
43
|
+
super(scope, id);
|
|
44
|
+
const backendService = new ecs.FargateService(this, "BackendService", {
|
|
45
|
+
cluster: props.networking.cluster,
|
|
46
|
+
taskDefinition: props.tasks.backendTask,
|
|
47
|
+
desiredCount: props.sizeProfile.services.backendDesiredCount,
|
|
48
|
+
circuitBreaker: {
|
|
49
|
+
rollback: true,
|
|
50
|
+
},
|
|
51
|
+
assignPublicIp: false,
|
|
52
|
+
securityGroups: [props.networking.appSecurityGroup],
|
|
53
|
+
cloudMapOptions: {
|
|
54
|
+
name: "backend",
|
|
55
|
+
},
|
|
56
|
+
vpcSubnets: {
|
|
57
|
+
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
const workerService = new ecs.FargateService(this, "WorkerService", {
|
|
61
|
+
cluster: props.networking.cluster,
|
|
62
|
+
taskDefinition: props.tasks.workerTask,
|
|
63
|
+
desiredCount: props.sizeProfile.services.workerDesiredCount,
|
|
64
|
+
circuitBreaker: {
|
|
65
|
+
rollback: true,
|
|
66
|
+
},
|
|
67
|
+
assignPublicIp: false,
|
|
68
|
+
securityGroups: [props.networking.appSecurityGroup],
|
|
69
|
+
cloudMapOptions: {
|
|
70
|
+
name: "worker",
|
|
71
|
+
},
|
|
72
|
+
vpcSubnets: {
|
|
73
|
+
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
const uiService = new ecs.FargateService(this, "UiService", {
|
|
77
|
+
cluster: props.networking.cluster,
|
|
78
|
+
taskDefinition: props.tasks.uiTask,
|
|
79
|
+
desiredCount: props.sizeProfile.services.uiDesiredCount,
|
|
80
|
+
circuitBreaker: {
|
|
81
|
+
rollback: true,
|
|
82
|
+
},
|
|
83
|
+
assignPublicIp: false,
|
|
84
|
+
securityGroups: [props.networking.appSecurityGroup],
|
|
85
|
+
cloudMapOptions: {
|
|
86
|
+
name: "ui",
|
|
87
|
+
},
|
|
88
|
+
vpcSubnets: {
|
|
89
|
+
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
const codesearchService = new ecs.FargateService(this, "CodesearchService", {
|
|
93
|
+
cluster: props.networking.cluster,
|
|
94
|
+
taskDefinition: props.tasks.codesearchTask,
|
|
95
|
+
desiredCount: props.sizeProfile.services.codesearchDesiredCount,
|
|
96
|
+
circuitBreaker: {
|
|
97
|
+
rollback: true,
|
|
98
|
+
},
|
|
99
|
+
assignPublicIp: false,
|
|
100
|
+
securityGroups: [props.networking.appSecurityGroup],
|
|
101
|
+
cloudMapOptions: {
|
|
102
|
+
name: "codesearch",
|
|
103
|
+
},
|
|
104
|
+
vpcSubnets: {
|
|
105
|
+
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
if (props.migrateDependency) {
|
|
109
|
+
backendService.node.addDependency(props.migrateDependency);
|
|
110
|
+
workerService.node.addDependency(props.migrateDependency);
|
|
111
|
+
uiService.node.addDependency(props.migrateDependency);
|
|
112
|
+
codesearchService.node.addDependency(props.migrateDependency);
|
|
113
|
+
}
|
|
114
|
+
this.resources = {
|
|
115
|
+
backendService,
|
|
116
|
+
workerService,
|
|
117
|
+
uiService,
|
|
118
|
+
codesearchService,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.ServicesConstruct = ServicesConstruct;
|
|
123
|
+
//# sourceMappingURL=services-construct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services-construct.js","sourceRoot":"","sources":["../../src/internal/services-construct.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAC3C,yDAA2C;AAC3C,2CAAuC;AAGvC,MAAa,iBAAkB,SAAQ,sBAAS;IAC9B,SAAS,CAAmB;IAE5C,YAAmB,KAAgB,EAAE,EAAU,EAAE,KAA6B;QAC5E,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QA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a;YACb,SAAS;YACT,iBAAiB;SAClB,CAAC;IACJ,CAAC;CACF;AAxFD,8CAwFC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import type { TaskDefinitionsConstructProps, TaskDefinitionsResources } from "./contracts";
|
|
3
|
+
export declare class TaskDefinitionsConstruct extends Construct {
|
|
4
|
+
readonly resources: TaskDefinitionsResources;
|
|
5
|
+
constructor(scope: Construct, id: string, props: TaskDefinitionsConstructProps);
|
|
6
|
+
private grantTaskSecrets;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=task-definitions-construct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-definitions-construct.d.ts","sourceRoot":"","sources":["../../src/internal/task-definitions-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAErB,qBAAa,wBAAyB,SAAQ,SAAS;IACrD,SAAgB,SAAS,EAAE,wBAAwB,CAAC;gBAEjC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,6BAA6B;IAyMrF,OAAO,CAAC,gBAAgB;CAgBzB"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TaskDefinitionsConstruct = void 0;
|
|
37
|
+
const ecs = __importStar(require("aws-cdk-lib/aws-ecs"));
|
|
38
|
+
const constructs_1 = require("constructs");
|
|
39
|
+
class TaskDefinitionsConstruct extends constructs_1.Construct {
|
|
40
|
+
resources;
|
|
41
|
+
constructor(scope, id, props) {
|
|
42
|
+
super(scope, id);
|
|
43
|
+
const appUrl = `https://${props.customDomain.domainName}`;
|
|
44
|
+
const backendTask = new ecs.FargateTaskDefinition(this, "BackendTask", {
|
|
45
|
+
memoryLimitMiB: props.sizeProfile.tasks.backend.memoryLimitMiB,
|
|
46
|
+
cpu: props.sizeProfile.tasks.backend.cpu,
|
|
47
|
+
});
|
|
48
|
+
const workerTask = new ecs.FargateTaskDefinition(this, "WorkerTask", {
|
|
49
|
+
memoryLimitMiB: props.sizeProfile.tasks.worker.memoryLimitMiB,
|
|
50
|
+
cpu: props.sizeProfile.tasks.worker.cpu,
|
|
51
|
+
});
|
|
52
|
+
const uiTask = new ecs.FargateTaskDefinition(this, "UiTask", {
|
|
53
|
+
memoryLimitMiB: props.sizeProfile.tasks.ui.memoryLimitMiB,
|
|
54
|
+
cpu: props.sizeProfile.tasks.ui.cpu,
|
|
55
|
+
});
|
|
56
|
+
const codesearchTask = new ecs.FargateTaskDefinition(this, "CodesearchTask", {
|
|
57
|
+
memoryLimitMiB: props.sizeProfile.tasks.codesearch.memoryLimitMiB,
|
|
58
|
+
cpu: props.sizeProfile.tasks.codesearch.cpu,
|
|
59
|
+
});
|
|
60
|
+
codesearchTask.addVolume({
|
|
61
|
+
name: "codesearch-data",
|
|
62
|
+
efsVolumeConfiguration: {
|
|
63
|
+
fileSystemId: props.dataPlane.codesearchFileSystem.fileSystemId,
|
|
64
|
+
transitEncryption: "ENABLED",
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
backendTask.addContainer("backend", {
|
|
68
|
+
image: ecs.ContainerImage.fromRegistry(`ghcr.io/ctxpipe-ai/backend:${props.defaultImageTag}`),
|
|
69
|
+
environment: {
|
|
70
|
+
NODE_ENV: "production",
|
|
71
|
+
PORT: "3000",
|
|
72
|
+
AUTH_BASE_URL: appUrl,
|
|
73
|
+
AUTH_ALLOWED_ORIGINS: appUrl,
|
|
74
|
+
OTEL_SERVICE_NAME: "backend",
|
|
75
|
+
GRAPH_DB_PROVIDER: "neptune",
|
|
76
|
+
GRAPH_DB_URI: props.dataPlane.graphDbUri,
|
|
77
|
+
[`GRAPH_DB_URI_${props.orgSlug}`]: props.dataPlane.graphDbUri,
|
|
78
|
+
UI_PROXY_URL: "http://ui.ctxpipe.local:3002",
|
|
79
|
+
CODESEARCH_URL: "http://codesearch.ctxpipe.local:3001",
|
|
80
|
+
MODEL_PROVIDER_URL: props.modelProviderBaseUrl,
|
|
81
|
+
MODEL_FAST_NAME: props.modelProviderDefaultModel,
|
|
82
|
+
},
|
|
83
|
+
secrets: {
|
|
84
|
+
AUTH_SECRET: ecs.Secret.fromSecretsManager(props.secrets.authSecret, "AUTH_SECRET"),
|
|
85
|
+
DATABASE_URL: ecs.Secret.fromSecretsManager(props.secrets.databaseUrlSecret, "DATABASE_URL"),
|
|
86
|
+
MODEL_PROVIDER_API_KEY: ecs.Secret.fromSecretsManager(props.secrets.modelProviderSecret, "API_KEY"),
|
|
87
|
+
SMTP_CONNECTION_URL: ecs.Secret.fromSecretsManager(props.secrets.smtpSecret, "SMTP_CONNECTION_URL"),
|
|
88
|
+
EMAIL_FROM_ADDRESS: ecs.Secret.fromSecretsManager(props.secrets.smtpSecret, "EMAIL_FROM_ADDRESS"),
|
|
89
|
+
...props.secrets.connectorEnv,
|
|
90
|
+
},
|
|
91
|
+
portMappings: [{ containerPort: 3000 }],
|
|
92
|
+
logging: ecs.LogDrivers.awsLogs({ streamPrefix: "ctxpipe-backend" }),
|
|
93
|
+
});
|
|
94
|
+
workerTask.addContainer("worker", {
|
|
95
|
+
image: ecs.ContainerImage.fromRegistry(`ghcr.io/ctxpipe-ai/worker:${props.defaultImageTag}`),
|
|
96
|
+
environment: {
|
|
97
|
+
NODE_ENV: "production",
|
|
98
|
+
AUTH_BASE_URL: appUrl,
|
|
99
|
+
AUTH_ALLOWED_ORIGINS: appUrl,
|
|
100
|
+
GRAPH_DB_PROVIDER: "neptune",
|
|
101
|
+
GRAPH_DB_URI: props.dataPlane.graphDbUri,
|
|
102
|
+
[`GRAPH_DB_URI_${props.orgSlug}`]: props.dataPlane.graphDbUri,
|
|
103
|
+
UI_PROXY_URL: "http://ui.ctxpipe.local:3002",
|
|
104
|
+
CODESEARCH_URL: "http://codesearch.ctxpipe.local:3001",
|
|
105
|
+
MODEL_PROVIDER_URL: props.modelProviderBaseUrl,
|
|
106
|
+
MODEL_FAST_NAME: props.modelProviderDefaultModel,
|
|
107
|
+
},
|
|
108
|
+
secrets: {
|
|
109
|
+
AUTH_SECRET: ecs.Secret.fromSecretsManager(props.secrets.authSecret, "AUTH_SECRET"),
|
|
110
|
+
DATABASE_URL: ecs.Secret.fromSecretsManager(props.secrets.databaseUrlSecret, "DATABASE_URL"),
|
|
111
|
+
MODEL_PROVIDER_API_KEY: ecs.Secret.fromSecretsManager(props.secrets.modelProviderSecret, "API_KEY"),
|
|
112
|
+
SMTP_CONNECTION_URL: ecs.Secret.fromSecretsManager(props.secrets.smtpSecret, "SMTP_CONNECTION_URL"),
|
|
113
|
+
EMAIL_FROM_ADDRESS: ecs.Secret.fromSecretsManager(props.secrets.smtpSecret, "EMAIL_FROM_ADDRESS"),
|
|
114
|
+
...props.secrets.connectorEnv,
|
|
115
|
+
},
|
|
116
|
+
logging: ecs.LogDrivers.awsLogs({ streamPrefix: "ctxpipe-worker" }),
|
|
117
|
+
});
|
|
118
|
+
uiTask.addContainer("ui", {
|
|
119
|
+
image: ecs.ContainerImage.fromRegistry(`ghcr.io/ctxpipe-ai/ui:${props.defaultImageTag}`),
|
|
120
|
+
environment: {
|
|
121
|
+
NODE_ENV: "production",
|
|
122
|
+
PORT: "3002",
|
|
123
|
+
VITE_PUBLIC_API_URL: appUrl,
|
|
124
|
+
},
|
|
125
|
+
portMappings: [{ containerPort: 3002 }],
|
|
126
|
+
logging: ecs.LogDrivers.awsLogs({ streamPrefix: "ctxpipe-ui" }),
|
|
127
|
+
});
|
|
128
|
+
const codesearchContainer = codesearchTask.addContainer("codesearch", {
|
|
129
|
+
image: ecs.ContainerImage.fromRegistry(`ghcr.io/ctxpipe-ai/codesearch:${props.defaultImageTag}`),
|
|
130
|
+
environment: {
|
|
131
|
+
NODE_ENV: "production",
|
|
132
|
+
PORT: "3001",
|
|
133
|
+
AUTH_TOKEN_AUDIENCE_CODESEARCH: "codesearch",
|
|
134
|
+
ZOEKT_WEBSERVER_URL: "http://127.0.0.1:6070",
|
|
135
|
+
},
|
|
136
|
+
secrets: {
|
|
137
|
+
AUTH_SECRET: ecs.Secret.fromSecretsManager(props.secrets.authSecret, "AUTH_SECRET"),
|
|
138
|
+
DATABASE_URL: ecs.Secret.fromSecretsManager(props.secrets.databaseUrlSecret, "DATABASE_URL"),
|
|
139
|
+
},
|
|
140
|
+
portMappings: [{ containerPort: 3001 }],
|
|
141
|
+
logging: ecs.LogDrivers.awsLogs({ streamPrefix: "ctxpipe-codesearch" }),
|
|
142
|
+
});
|
|
143
|
+
codesearchContainer.addMountPoints({
|
|
144
|
+
sourceVolume: "codesearch-data",
|
|
145
|
+
containerPath: "/data",
|
|
146
|
+
readOnly: false,
|
|
147
|
+
});
|
|
148
|
+
const migrateTask = new ecs.FargateTaskDefinition(this, "MigrateTask", {
|
|
149
|
+
memoryLimitMiB: props.sizeProfile.tasks.migrate.memoryLimitMiB,
|
|
150
|
+
cpu: props.sizeProfile.tasks.migrate.cpu,
|
|
151
|
+
});
|
|
152
|
+
migrateTask.addContainer("migrate", {
|
|
153
|
+
image: ecs.ContainerImage.fromRegistry(`ghcr.io/ctxpipe-ai/backend:${props.defaultImageTag}`),
|
|
154
|
+
command: ["bun", "run", "apps/backend/src/db/migrate.ts"],
|
|
155
|
+
secrets: {
|
|
156
|
+
AUTH_SECRET: ecs.Secret.fromSecretsManager(props.secrets.authSecret, "AUTH_SECRET"),
|
|
157
|
+
DATABASE_URL: ecs.Secret.fromSecretsManager(props.secrets.databaseUrlSecret, "DATABASE_URL"),
|
|
158
|
+
},
|
|
159
|
+
logging: ecs.LogDrivers.awsLogs({ streamPrefix: "ctxpipe-migrate" }),
|
|
160
|
+
});
|
|
161
|
+
this.grantTaskSecrets(backendTask, [
|
|
162
|
+
props.secrets.authSecret,
|
|
163
|
+
props.secrets.databaseUrlSecret,
|
|
164
|
+
props.secrets.modelProviderSecret,
|
|
165
|
+
props.secrets.smtpSecret,
|
|
166
|
+
props.secrets.connectorSecret,
|
|
167
|
+
]);
|
|
168
|
+
this.grantTaskSecrets(workerTask, [
|
|
169
|
+
props.secrets.authSecret,
|
|
170
|
+
props.secrets.databaseUrlSecret,
|
|
171
|
+
props.secrets.modelProviderSecret,
|
|
172
|
+
props.secrets.smtpSecret,
|
|
173
|
+
props.secrets.connectorSecret,
|
|
174
|
+
]);
|
|
175
|
+
this.grantTaskSecrets(codesearchTask, [
|
|
176
|
+
props.secrets.authSecret,
|
|
177
|
+
props.secrets.databaseUrlSecret,
|
|
178
|
+
]);
|
|
179
|
+
this.grantTaskSecrets(migrateTask, [
|
|
180
|
+
props.secrets.authSecret,
|
|
181
|
+
props.secrets.databaseUrlSecret,
|
|
182
|
+
]);
|
|
183
|
+
this.resources = {
|
|
184
|
+
backendTask,
|
|
185
|
+
workerTask,
|
|
186
|
+
uiTask,
|
|
187
|
+
codesearchTask,
|
|
188
|
+
migrateTask,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
grantTaskSecrets(task, secrets) {
|
|
192
|
+
const principals = [task.taskRole, task.executionRole].filter((role) => role !== undefined);
|
|
193
|
+
for (const secret of secrets) {
|
|
194
|
+
if (!secret) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
for (const principal of principals) {
|
|
198
|
+
secret.grantRead(principal);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.TaskDefinitionsConstruct = TaskDefinitionsConstruct;
|
|
204
|
+
//# sourceMappingURL=task-definitions-construct.js.map
|