fargate-nodejs 1.0.0
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/LICENSE +21 -0
- package/README.md +140 -0
- package/dist/bundling.d.ts +19 -0
- package/dist/bundling.d.ts.map +1 -0
- package/dist/bundling.js +89 -0
- package/dist/bundling.js.map +1 -0
- package/dist/fargate-nodejs-service.d.ts +22 -0
- package/dist/fargate-nodejs-service.d.ts.map +1 -0
- package/dist/fargate-nodejs-service.js +249 -0
- package/dist/fargate-nodejs-service.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +95 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Oleksandr Hanhaliuk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Fargate-nodejs
|
|
2
|
+
|
|
3
|
+
Deploy Node.js/TypeScript to AWS Fargate with automatic esbuild bundling, similar to [Lambda's `NodejsFunction`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_nodejs.NodejsFunction.html).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Automatic code bundling with esbuild (no Docker knowledge required)
|
|
8
|
+
- TypeScript and JavaScript support
|
|
9
|
+
- Works for HTTP services, SQS workers, scheduled tasks, or background jobs
|
|
10
|
+
- Optional ALB integration
|
|
11
|
+
- Auto-scaling based on CPU, memory, or SQS queue depth
|
|
12
|
+
- IAM roles and security groups configured automatically
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install fargate-nodejs
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
HTTP service:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { FargateNodejsService } from 'fargate-nodejs';
|
|
26
|
+
|
|
27
|
+
const service = new FargateNodejsService(stack, 'MyService', {
|
|
28
|
+
entry: './src/index.ts',
|
|
29
|
+
runtime: '18',
|
|
30
|
+
containerPort: 3000,
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
SQS worker (no ports needed):
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const worker = new FargateNodejsService(stack, 'Worker', {
|
|
38
|
+
entry: './src/worker.ts',
|
|
39
|
+
environment: { QUEUE_URL: queue.queueUrl },
|
|
40
|
+
autoScaling: {
|
|
41
|
+
sqsQueue: queue,
|
|
42
|
+
messagesPerTask: 10,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
### With Load Balancer
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
|
|
53
|
+
|
|
54
|
+
const service = new FargateNodejsService(stack, 'MyService', {
|
|
55
|
+
entry: './src/index.ts',
|
|
56
|
+
loadBalancer: {
|
|
57
|
+
loadBalancer: alb,
|
|
58
|
+
pathPatterns: ['/api/*'],
|
|
59
|
+
healthCheckPath: '/health',
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### With Auto Scaling
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
const service = new FargateNodejsService(stack, 'MyService', {
|
|
68
|
+
entry: './src/index.ts',
|
|
69
|
+
autoScaling: {
|
|
70
|
+
minCapacity: 2,
|
|
71
|
+
maxCapacity: 10,
|
|
72
|
+
targetCpuUtilization: 70,
|
|
73
|
+
// Or for SQS: sqsQueue: queue, messagesPerTask: 5
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Advanced Configuration
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
const service = new FargateNodejsService(stack, 'MyService', {
|
|
82
|
+
entry: './src/index.ts',
|
|
83
|
+
projectRoot: './my-app',
|
|
84
|
+
cpu: 512,
|
|
85
|
+
memoryLimitMiB: 1024,
|
|
86
|
+
|
|
87
|
+
bundling: {
|
|
88
|
+
minify: true,
|
|
89
|
+
sourceMap: true,
|
|
90
|
+
externalModules: ['aws-sdk'],
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
environment: { API_KEY: 'value' },
|
|
94
|
+
secrets: { DB_PASSWORD: ecs.Secret.fromSecretsManager(secret) },
|
|
95
|
+
|
|
96
|
+
assignPublicIp: false,
|
|
97
|
+
enableExecuteCommand: true,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Grant permissions
|
|
101
|
+
service.grantPermissions([...]);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Properties
|
|
105
|
+
|
|
106
|
+
Key properties:
|
|
107
|
+
|
|
108
|
+
- `entry` (required) - Path to entry file
|
|
109
|
+
- `runtime` - Node.js version (14, 16, 18, 20, 22)
|
|
110
|
+
- `containerPort` - Port to expose (omit for workers)
|
|
111
|
+
- `cpu` / `memoryLimitMiB` - Resource limits
|
|
112
|
+
- `bundling` - esbuild options (minify, sourceMap, externalModules)
|
|
113
|
+
- `autoScaling` - CPU/memory/SQS-based scaling
|
|
114
|
+
- `loadBalancer` - ALB integration
|
|
115
|
+
- `environment` / `secrets` - Container config
|
|
116
|
+
|
|
117
|
+
See [types.ts](https://github.com/alexsanteenodev/fargate-nodejs/blob/main/lib/types.ts) for full API.
|
|
118
|
+
|
|
119
|
+
## Why use this?
|
|
120
|
+
|
|
121
|
+
**vs Lambda:** No 15-minute timeout, no cold starts, better for long-running workloads, WebSockets, or anything that needs persistent connections.
|
|
122
|
+
|
|
123
|
+
**vs raw Fargate:** No Docker expertise needed, automatic bundling, cleaner CDK code.
|
|
124
|
+
|
|
125
|
+
## Examples
|
|
126
|
+
|
|
127
|
+
- [Basic HTTP Service](https://github.com/alexsanteenodev/fargate-nodejs/tree/main/examples/basic) - Express app
|
|
128
|
+
- [SQS Worker](https://github.com/alexsanteenodev/fargate-nodejs/tree/main/examples/sqs-worker) - Background worker with queue scaling
|
|
129
|
+
|
|
130
|
+
## Development
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npm install
|
|
134
|
+
npm run build
|
|
135
|
+
npm test
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
[MIT](https://github.com/alexsanteenodev/fargate-nodejs/blob/main/LICENSE)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface BundlerOptions {
|
|
2
|
+
entry: string;
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
runtime: string;
|
|
5
|
+
minify?: boolean;
|
|
6
|
+
sourceMap?: boolean;
|
|
7
|
+
externalModules?: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare class Bundler {
|
|
10
|
+
private readonly entry;
|
|
11
|
+
private readonly runtime;
|
|
12
|
+
private readonly minify;
|
|
13
|
+
private readonly sourceMap;
|
|
14
|
+
private readonly externalModules;
|
|
15
|
+
constructor(options: BundlerOptions);
|
|
16
|
+
bundle(): string;
|
|
17
|
+
static findProjectRoot(startPath: string): string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=bundling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundling.d.ts","sourceRoot":"","sources":["../lib/bundling.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,cAAc;IAI7B,KAAK,EAAE,MAAM,CAAC;IAKd,WAAW,EAAE,MAAM,CAAC;IAKpB,OAAO,EAAE,MAAM,CAAC;IAKhB,MAAM,CAAC,EAAE,OAAO,CAAC;IAKjB,SAAS,CAAC,EAAE,OAAO,CAAC;IAKpB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAKD,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAW;gBAE/B,OAAO,EAAE,cAAc;IAWnC,MAAM,IAAI,MAAM;IAoChB,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAYlD"}
|
package/dist/bundling.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
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.Bundler = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const os = __importStar(require("os"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const esbuild = __importStar(require("esbuild"));
|
|
41
|
+
class Bundler {
|
|
42
|
+
entry;
|
|
43
|
+
runtime;
|
|
44
|
+
minify;
|
|
45
|
+
sourceMap;
|
|
46
|
+
externalModules;
|
|
47
|
+
constructor(options) {
|
|
48
|
+
this.entry = options.entry;
|
|
49
|
+
this.runtime = options.runtime;
|
|
50
|
+
this.minify = options.minify ?? false;
|
|
51
|
+
this.sourceMap = options.sourceMap ?? false;
|
|
52
|
+
this.externalModules = options.externalModules || [];
|
|
53
|
+
}
|
|
54
|
+
bundle() {
|
|
55
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'fargate-nodejs-'));
|
|
56
|
+
const target = `node${this.runtime}`;
|
|
57
|
+
const outfile = path.join(tempDir, 'index.js');
|
|
58
|
+
const buildOptions = {
|
|
59
|
+
entryPoints: [this.entry],
|
|
60
|
+
bundle: true,
|
|
61
|
+
platform: 'node',
|
|
62
|
+
target,
|
|
63
|
+
outfile,
|
|
64
|
+
minify: this.minify,
|
|
65
|
+
sourcemap: this.sourceMap,
|
|
66
|
+
external: this.externalModules,
|
|
67
|
+
format: 'cjs',
|
|
68
|
+
logLevel: 'warning',
|
|
69
|
+
};
|
|
70
|
+
esbuild.buildSync(buildOptions);
|
|
71
|
+
const dockerfileSrc = path.join(__dirname, '..', 'lib', 'docker', 'Dockerfile');
|
|
72
|
+
const dockerfileDest = path.join(tempDir, 'Dockerfile');
|
|
73
|
+
fs.copyFileSync(dockerfileSrc, dockerfileDest);
|
|
74
|
+
return tempDir;
|
|
75
|
+
}
|
|
76
|
+
static findProjectRoot(startPath) {
|
|
77
|
+
let currentPath = startPath;
|
|
78
|
+
while (currentPath !== path.dirname(currentPath)) {
|
|
79
|
+
const packageJsonPath = path.join(currentPath, 'package.json');
|
|
80
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
81
|
+
return currentPath;
|
|
82
|
+
}
|
|
83
|
+
currentPath = path.dirname(currentPath);
|
|
84
|
+
}
|
|
85
|
+
return startPath;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.Bundler = Bundler;
|
|
89
|
+
//# sourceMappingURL=bundling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundling.js","sourceRoot":"","sources":["../lib/bundling.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAE7B,iDAAmC;AAwCnC,MAAa,OAAO;IACD,KAAK,CAAS;IACd,OAAO,CAAS;IAChB,MAAM,CAAU;IAChB,SAAS,CAAU;IACnB,eAAe,CAAW;IAE3C,YAAY,OAAuB;QACjC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;IACvD,CAAC;IAKD,MAAM;QAEJ,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC;QAG1E,MAAM,MAAM,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;QAGrC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC/C,MAAM,YAAY,GAAyB;YACzC,WAAW,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,MAAM;YAChB,MAAM;YACN,OAAO;YACP,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,eAAe;YAC9B,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,SAAS;SACpB,CAAC;QAEF,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAIhC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QAChF,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACxD,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QAE/C,OAAO,OAAO,CAAC;IACjB,CAAC;IAKD,MAAM,CAAC,eAAe,CAAC,SAAiB;QACtC,IAAI,WAAW,GAAG,SAAS,CAAC;QAC5B,OAAO,WAAW,KAAK,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACjD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YAC/D,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;gBACnC,OAAO,WAAW,CAAC;YACrB,CAAC;YACD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAlED,0BAkEC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
3
|
+
import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
|
|
4
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
5
|
+
import { Construct } from 'constructs';
|
|
6
|
+
import { FargateNodejsServiceProps } from './types';
|
|
7
|
+
export declare class FargateNodejsService extends Construct {
|
|
8
|
+
readonly service: ecs.FargateService;
|
|
9
|
+
readonly taskDefinition: ecs.FargateTaskDefinition;
|
|
10
|
+
readonly container: ecs.ContainerDefinition;
|
|
11
|
+
readonly vpc: ec2.IVpc;
|
|
12
|
+
readonly cluster: ecs.ICluster;
|
|
13
|
+
readonly securityGroup: ec2.ISecurityGroup;
|
|
14
|
+
targetGroup?: elbv2.ApplicationTargetGroup;
|
|
15
|
+
constructor(scope: Construct, id: string, props: FargateNodejsServiceProps);
|
|
16
|
+
private configureLoadBalancer;
|
|
17
|
+
private configureAutoScaling;
|
|
18
|
+
grantPermissions(permissions: iam.PolicyStatement[]): void;
|
|
19
|
+
addEnvironment(key: string, value: string): void;
|
|
20
|
+
addSecret(key: string, secret: ecs.Secret): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=fargate-nodejs-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fargate-nodejs-service.d.ts","sourceRoot":"","sources":["../lib/fargate-nodejs-service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,wCAAwC,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAKpD,qBAAa,oBAAqB,SAAQ,SAAS;IAIjD,SAAgB,OAAO,EAAE,GAAG,CAAC,cAAc,CAAC;IAK5C,SAAgB,cAAc,EAAE,GAAG,CAAC,qBAAqB,CAAC;IAK1D,SAAgB,SAAS,EAAE,GAAG,CAAC,mBAAmB,CAAC;IAKnD,SAAgB,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC;IAK9B,SAAgB,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC;IAKtC,SAAgB,aAAa,EAAE,GAAG,CAAC,cAAc,CAAC;IAK3C,WAAW,CAAC,EAAE,KAAK,CAAC,sBAAsB,CAAC;gBAEtC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;IA2J1E,OAAO,CAAC,qBAAqB;IAgD7B,OAAO,CAAC,oBAAoB;IAmDrB,gBAAgB,CAAC,WAAW,EAAE,GAAG,CAAC,eAAe,EAAE,GAAG,IAAI;IAU1D,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAOhD,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI;CAGxD"}
|
|
@@ -0,0 +1,249 @@
|
|
|
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.FargateNodejsService = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const cdk = __importStar(require("aws-cdk-lib"));
|
|
39
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
40
|
+
const ec2 = __importStar(require("aws-cdk-lib/aws-ec2"));
|
|
41
|
+
const ecr_assets = __importStar(require("aws-cdk-lib/aws-ecr-assets"));
|
|
42
|
+
const ecs = __importStar(require("aws-cdk-lib/aws-ecs"));
|
|
43
|
+
const elbv2 = __importStar(require("aws-cdk-lib/aws-elasticloadbalancingv2"));
|
|
44
|
+
const logs = __importStar(require("aws-cdk-lib/aws-logs"));
|
|
45
|
+
const constructs_1 = require("constructs");
|
|
46
|
+
const bundling_1 = require("./bundling");
|
|
47
|
+
class FargateNodejsService extends constructs_1.Construct {
|
|
48
|
+
service;
|
|
49
|
+
taskDefinition;
|
|
50
|
+
container;
|
|
51
|
+
vpc;
|
|
52
|
+
cluster;
|
|
53
|
+
securityGroup;
|
|
54
|
+
targetGroup;
|
|
55
|
+
constructor(scope, id, props) {
|
|
56
|
+
super(scope, id);
|
|
57
|
+
if (!props.entry) {
|
|
58
|
+
throw new Error('entry is required');
|
|
59
|
+
}
|
|
60
|
+
const entryPath = path.resolve(props.entry);
|
|
61
|
+
const projectRoot = props.projectRoot || bundling_1.Bundler.findProjectRoot(path.dirname(entryPath));
|
|
62
|
+
const runtime = props.runtime || '18';
|
|
63
|
+
const containerPort = props.containerPort || (props.loadBalancer ? 3000 : undefined);
|
|
64
|
+
const bundler = new bundling_1.Bundler({
|
|
65
|
+
entry: entryPath,
|
|
66
|
+
projectRoot,
|
|
67
|
+
runtime,
|
|
68
|
+
minify: props.bundling?.minify,
|
|
69
|
+
sourceMap: props.bundling?.sourceMap,
|
|
70
|
+
externalModules: props.bundling?.externalModules,
|
|
71
|
+
});
|
|
72
|
+
const bundleDir = bundler.bundle();
|
|
73
|
+
this.vpc =
|
|
74
|
+
props.vpc ||
|
|
75
|
+
new ec2.Vpc(this, 'Vpc', {
|
|
76
|
+
maxAzs: 2,
|
|
77
|
+
natGateways: props.assignPublicIp ? 0 : 1,
|
|
78
|
+
});
|
|
79
|
+
this.cluster =
|
|
80
|
+
props.cluster ||
|
|
81
|
+
new ecs.Cluster(this, 'Cluster', {
|
|
82
|
+
vpc: this.vpc,
|
|
83
|
+
});
|
|
84
|
+
this.taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', {
|
|
85
|
+
cpu: props.cpu || 256,
|
|
86
|
+
memoryLimitMiB: props.memoryLimitMiB || 512,
|
|
87
|
+
executionRole: props.executionRole,
|
|
88
|
+
taskRole: props.taskRole,
|
|
89
|
+
runtimePlatform: {
|
|
90
|
+
cpuArchitecture: props.architecture || ecs.CpuArchitecture.X86_64,
|
|
91
|
+
operatingSystemFamily: ecs.OperatingSystemFamily.LINUX,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
const logGroup = props.logGroup ||
|
|
95
|
+
new logs.LogGroup(this, 'LogGroup', {
|
|
96
|
+
retention: props.logRetention || logs.RetentionDays.ONE_WEEK,
|
|
97
|
+
removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
|
|
98
|
+
});
|
|
99
|
+
const image = ecs.ContainerImage.fromAsset(bundleDir, {
|
|
100
|
+
platform: props.architecture === ecs.CpuArchitecture.ARM64
|
|
101
|
+
? ecr_assets.Platform.LINUX_ARM64
|
|
102
|
+
: ecr_assets.Platform.LINUX_AMD64,
|
|
103
|
+
buildArgs: {
|
|
104
|
+
NODE_VERSION: runtime,
|
|
105
|
+
...props.buildArgs,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
this.container = this.taskDefinition.addContainer('app', {
|
|
109
|
+
image,
|
|
110
|
+
logging: ecs.LogDriver.awsLogs({
|
|
111
|
+
logGroup,
|
|
112
|
+
streamPrefix: 'fargate-nodejs',
|
|
113
|
+
}),
|
|
114
|
+
environment: props.environment,
|
|
115
|
+
secrets: props.secrets,
|
|
116
|
+
workingDirectory: '/app',
|
|
117
|
+
});
|
|
118
|
+
if (containerPort !== undefined) {
|
|
119
|
+
this.container.addPortMappings({
|
|
120
|
+
containerPort,
|
|
121
|
+
protocol: ecs.Protocol.TCP,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const securityGroups = props.securityGroups || [
|
|
125
|
+
new ec2.SecurityGroup(this, 'SecurityGroup', {
|
|
126
|
+
vpc: this.vpc,
|
|
127
|
+
description: `Security group for ${id}`,
|
|
128
|
+
allowAllOutbound: true,
|
|
129
|
+
}),
|
|
130
|
+
];
|
|
131
|
+
this.securityGroup = securityGroups[0];
|
|
132
|
+
if (containerPort !== undefined && this.securityGroup instanceof ec2.SecurityGroup) {
|
|
133
|
+
this.securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(containerPort), 'Allow inbound traffic on container port');
|
|
134
|
+
}
|
|
135
|
+
this.service = new ecs.FargateService(this, 'Service', {
|
|
136
|
+
cluster: this.cluster,
|
|
137
|
+
taskDefinition: this.taskDefinition,
|
|
138
|
+
desiredCount: props.desiredCount || 1,
|
|
139
|
+
serviceName: props.serviceName,
|
|
140
|
+
assignPublicIp: props.assignPublicIp || false,
|
|
141
|
+
securityGroups,
|
|
142
|
+
vpcSubnets: props.vpcSubnets || {
|
|
143
|
+
subnetType: props.assignPublicIp
|
|
144
|
+
? ec2.SubnetType.PUBLIC
|
|
145
|
+
: ec2.SubnetType.PRIVATE_WITH_EGRESS,
|
|
146
|
+
},
|
|
147
|
+
enableExecuteCommand: props.enableExecuteCommand || false,
|
|
148
|
+
minHealthyPercent: props.minHealthyPercent || 100,
|
|
149
|
+
maxHealthyPercent: props.maxHealthyPercent || 200,
|
|
150
|
+
});
|
|
151
|
+
if (props.loadBalancer) {
|
|
152
|
+
if (containerPort === undefined) {
|
|
153
|
+
throw new Error('containerPort must be specified when loadBalancer is configured');
|
|
154
|
+
}
|
|
155
|
+
this.configureLoadBalancer(props, containerPort);
|
|
156
|
+
}
|
|
157
|
+
if (props.autoScaling) {
|
|
158
|
+
this.configureAutoScaling(props);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
configureLoadBalancer(props, containerPort) {
|
|
162
|
+
if (!props.loadBalancer)
|
|
163
|
+
return;
|
|
164
|
+
const lbConfig = props.loadBalancer;
|
|
165
|
+
const listener = lbConfig.listener ||
|
|
166
|
+
lbConfig.loadBalancer.addListener('Listener', {
|
|
167
|
+
port: 80,
|
|
168
|
+
protocol: elbv2.ApplicationProtocol.HTTP,
|
|
169
|
+
});
|
|
170
|
+
this.targetGroup = new elbv2.ApplicationTargetGroup(this, 'TargetGroup', {
|
|
171
|
+
vpc: this.vpc,
|
|
172
|
+
port: containerPort,
|
|
173
|
+
protocol: elbv2.ApplicationProtocol.HTTP,
|
|
174
|
+
targetType: elbv2.TargetType.IP,
|
|
175
|
+
healthCheck: {
|
|
176
|
+
path: lbConfig.healthCheckPath || '/health',
|
|
177
|
+
interval: lbConfig.healthCheckInterval || aws_cdk_lib_1.Duration.seconds(30),
|
|
178
|
+
},
|
|
179
|
+
deregistrationDelay: lbConfig.deregistrationDelay || aws_cdk_lib_1.Duration.seconds(30),
|
|
180
|
+
});
|
|
181
|
+
this.service.attachToApplicationTargetGroup(this.targetGroup);
|
|
182
|
+
new elbv2.ApplicationListenerRule(this, 'ListenerRule', {
|
|
183
|
+
listener,
|
|
184
|
+
priority: lbConfig.priority ?? 1,
|
|
185
|
+
conditions: [
|
|
186
|
+
...(lbConfig.pathPatterns
|
|
187
|
+
? [elbv2.ListenerCondition.pathPatterns(lbConfig.pathPatterns)]
|
|
188
|
+
: []),
|
|
189
|
+
...(lbConfig.hostHeaders
|
|
190
|
+
? [elbv2.ListenerCondition.hostHeaders(lbConfig.hostHeaders)]
|
|
191
|
+
: []),
|
|
192
|
+
],
|
|
193
|
+
targetGroups: [this.targetGroup],
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
configureAutoScaling(props) {
|
|
197
|
+
if (!props.autoScaling)
|
|
198
|
+
return;
|
|
199
|
+
const autoScalingConfig = props.autoScaling;
|
|
200
|
+
const scaling = this.service.autoScaleTaskCount({
|
|
201
|
+
minCapacity: autoScalingConfig.minCapacity || 1,
|
|
202
|
+
maxCapacity: autoScalingConfig.maxCapacity || 10,
|
|
203
|
+
});
|
|
204
|
+
if (autoScalingConfig.targetCpuUtilization) {
|
|
205
|
+
scaling.scaleOnCpuUtilization('CpuScaling', {
|
|
206
|
+
targetUtilizationPercent: autoScalingConfig.targetCpuUtilization,
|
|
207
|
+
scaleInCooldown: autoScalingConfig.scaleInCooldown || aws_cdk_lib_1.Duration.seconds(300),
|
|
208
|
+
scaleOutCooldown: autoScalingConfig.scaleOutCooldown || aws_cdk_lib_1.Duration.seconds(60),
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
if (autoScalingConfig.targetMemoryUtilization) {
|
|
212
|
+
scaling.scaleOnMemoryUtilization('MemoryScaling', {
|
|
213
|
+
targetUtilizationPercent: autoScalingConfig.targetMemoryUtilization,
|
|
214
|
+
scaleInCooldown: autoScalingConfig.scaleInCooldown || aws_cdk_lib_1.Duration.seconds(300),
|
|
215
|
+
scaleOutCooldown: autoScalingConfig.scaleOutCooldown || aws_cdk_lib_1.Duration.seconds(60),
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (autoScalingConfig.sqsQueue) {
|
|
219
|
+
const messagesPerTask = autoScalingConfig.messagesPerTask || 5;
|
|
220
|
+
scaling.scaleOnMetric('SqsQueueScaling', {
|
|
221
|
+
metric: autoScalingConfig.sqsQueue.metricApproximateNumberOfMessagesVisible({
|
|
222
|
+
statistic: 'Average',
|
|
223
|
+
period: aws_cdk_lib_1.Duration.minutes(1),
|
|
224
|
+
}),
|
|
225
|
+
scalingSteps: [
|
|
226
|
+
{ upper: 0, change: -1 },
|
|
227
|
+
{ lower: messagesPerTask, change: +1 },
|
|
228
|
+
{ lower: messagesPerTask * 2, change: +2 },
|
|
229
|
+
{ lower: messagesPerTask * 4, change: +3 },
|
|
230
|
+
],
|
|
231
|
+
adjustmentType: cdk.aws_applicationautoscaling.AdjustmentType.CHANGE_IN_CAPACITY,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
grantPermissions(permissions) {
|
|
236
|
+
const taskRole = this.taskDefinition.taskRole;
|
|
237
|
+
permissions.forEach((permission) => {
|
|
238
|
+
taskRole.addToPrincipalPolicy(permission);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
addEnvironment(key, value) {
|
|
242
|
+
this.container.addEnvironment(key, value);
|
|
243
|
+
}
|
|
244
|
+
addSecret(key, secret) {
|
|
245
|
+
this.container.addSecret(key, secret);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
exports.FargateNodejsService = FargateNodejsService;
|
|
249
|
+
//# sourceMappingURL=fargate-nodejs-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fargate-nodejs-service.js","sourceRoot":"","sources":["../lib/fargate-nodejs-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,iDAAmC;AACnC,6CAAsD;AACtD,yDA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|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Bundler = exports.FargateNodejsService = void 0;
|
|
18
|
+
var fargate_nodejs_service_1 = require("./fargate-nodejs-service");
|
|
19
|
+
Object.defineProperty(exports, "FargateNodejsService", { enumerable: true, get: function () { return fargate_nodejs_service_1.FargateNodejsService; } });
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
21
|
+
var bundling_1 = require("./bundling");
|
|
22
|
+
Object.defineProperty(exports, "Bundler", { enumerable: true, get: function () { return bundling_1.Bundler; } });
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mEAAgE;AAAvD,8HAAA,oBAAoB,OAAA;AAC7B,0CAAwB;AACxB,uCAAqC;AAA5B,mGAAA,OAAO,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Duration } from 'aws-cdk-lib';
|
|
2
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
3
|
+
import * as ecs from 'aws-cdk-lib/aws-ecs';
|
|
4
|
+
import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
|
|
5
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
6
|
+
import * as logs from 'aws-cdk-lib/aws-logs';
|
|
7
|
+
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
8
|
+
import { BuildOptions } from 'esbuild';
|
|
9
|
+
export interface ICommandHooks {
|
|
10
|
+
beforeBundling?(inputDir: string, outputDir: string): string[];
|
|
11
|
+
afterBundling?(inputDir: string, outputDir: string): string[];
|
|
12
|
+
beforeInstall?(inputDir: string, outputDir: string): string[];
|
|
13
|
+
}
|
|
14
|
+
export interface BundlingOptions {
|
|
15
|
+
readonly minify?: boolean;
|
|
16
|
+
readonly sourceMap?: boolean;
|
|
17
|
+
readonly target?: string;
|
|
18
|
+
readonly externalModules?: string[];
|
|
19
|
+
readonly nodeModules?: string[];
|
|
20
|
+
readonly commandHooks?: ICommandHooks;
|
|
21
|
+
readonly esbuildOptions?: Partial<BuildOptions>;
|
|
22
|
+
readonly bundleAll?: boolean;
|
|
23
|
+
readonly dockerImage?: string;
|
|
24
|
+
readonly charset?: 'ascii' | 'utf8';
|
|
25
|
+
readonly format?: 'cjs' | 'esm';
|
|
26
|
+
readonly keepNames?: boolean;
|
|
27
|
+
readonly logLevel?: 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
|
28
|
+
}
|
|
29
|
+
export interface HealthCheckConfig {
|
|
30
|
+
readonly command?: string[];
|
|
31
|
+
readonly interval?: Duration;
|
|
32
|
+
readonly timeout?: Duration;
|
|
33
|
+
readonly retries?: number;
|
|
34
|
+
readonly startPeriod?: Duration;
|
|
35
|
+
}
|
|
36
|
+
export interface AutoScalingConfig {
|
|
37
|
+
readonly minCapacity?: number;
|
|
38
|
+
readonly maxCapacity?: number;
|
|
39
|
+
readonly targetCpuUtilization?: number;
|
|
40
|
+
readonly targetMemoryUtilization?: number;
|
|
41
|
+
readonly scaleInCooldown?: Duration;
|
|
42
|
+
readonly scaleOutCooldown?: Duration;
|
|
43
|
+
readonly sqsQueue?: sqs.IQueue;
|
|
44
|
+
readonly messagesPerTask?: number;
|
|
45
|
+
}
|
|
46
|
+
export interface LoadBalancerConfig {
|
|
47
|
+
readonly loadBalancer: elbv2.IApplicationLoadBalancer;
|
|
48
|
+
readonly listener?: elbv2.IApplicationListener;
|
|
49
|
+
readonly priority?: number;
|
|
50
|
+
readonly pathPatterns?: string[];
|
|
51
|
+
readonly hostHeaders?: string[];
|
|
52
|
+
readonly healthCheckPath?: string;
|
|
53
|
+
readonly healthCheckInterval?: Duration;
|
|
54
|
+
readonly deregistrationDelay?: Duration;
|
|
55
|
+
}
|
|
56
|
+
export interface FargateNodejsServiceProps {
|
|
57
|
+
readonly entry: string;
|
|
58
|
+
readonly handler?: string;
|
|
59
|
+
readonly projectRoot?: string;
|
|
60
|
+
readonly depsLockFilePath?: string;
|
|
61
|
+
readonly bundling?: BundlingOptions;
|
|
62
|
+
readonly vpc?: ec2.IVpc;
|
|
63
|
+
readonly cluster?: ecs.ICluster;
|
|
64
|
+
readonly cpu?: number;
|
|
65
|
+
readonly memoryLimitMiB?: number;
|
|
66
|
+
readonly environment?: {
|
|
67
|
+
[key: string]: string;
|
|
68
|
+
};
|
|
69
|
+
readonly secrets?: {
|
|
70
|
+
[key: string]: ecs.Secret;
|
|
71
|
+
};
|
|
72
|
+
readonly containerPort?: number;
|
|
73
|
+
readonly healthCheck?: HealthCheckConfig;
|
|
74
|
+
readonly minHealthyPercent?: number;
|
|
75
|
+
readonly maxHealthyPercent?: number;
|
|
76
|
+
readonly desiredCount?: number;
|
|
77
|
+
readonly serviceName?: string;
|
|
78
|
+
readonly assignPublicIp?: boolean;
|
|
79
|
+
readonly securityGroups?: ec2.ISecurityGroup[];
|
|
80
|
+
readonly vpcSubnets?: ec2.SubnetSelection;
|
|
81
|
+
readonly executionRole?: iam.IRole;
|
|
82
|
+
readonly taskRole?: iam.IRole;
|
|
83
|
+
readonly logGroup?: logs.ILogGroup;
|
|
84
|
+
readonly logRetention?: logs.RetentionDays;
|
|
85
|
+
readonly enableExecuteCommand?: boolean;
|
|
86
|
+
readonly autoScaling?: AutoScalingConfig;
|
|
87
|
+
readonly loadBalancer?: LoadBalancerConfig;
|
|
88
|
+
readonly runtime?: '14' | '16' | '18' | '20' | '22';
|
|
89
|
+
readonly architecture?: ecs.CpuArchitecture;
|
|
90
|
+
readonly workingDirectory?: string;
|
|
91
|
+
readonly buildArgs?: {
|
|
92
|
+
[key: string]: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,wCAAwC,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC,MAAM,WAAW,aAAa;IAI5B,cAAc,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAK/D,aAAa,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAK9D,aAAa,CAAC,CAAC,QAAQ,EAA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AAC,EAAE,kBAAkB,CAAC;IAM3C,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAMpD,QAAQ,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC;IAM5C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAMnC,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAChD"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fargate-nodejs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Fargate NodeJS lib, similar to lambda nodejs library",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"Lambda",
|
|
9
|
+
"Fargate",
|
|
10
|
+
"AWS",
|
|
11
|
+
"nodejs",
|
|
12
|
+
"typescript",
|
|
13
|
+
"serverless"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "Oleksandr Hanhaliuk",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/alexsanteenodev/fargate-nodejs.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/alexsanteenodev/fargate-nodejs/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/alexsanteenodev/fargate-nodejs#readme",
|
|
25
|
+
"directories": {
|
|
26
|
+
"lib": "lib"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/**/*",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"clean": "rm -rf dist",
|
|
36
|
+
"prebuild": "npm run clean",
|
|
37
|
+
"eslint": "eslint --ext .ts,.js --max-warnings=0 lib",
|
|
38
|
+
"eslint:fix": "eslint -c .eslintrc.json --fix lib/**/*.ts",
|
|
39
|
+
"format": "prettier --write .",
|
|
40
|
+
"format:check": "prettier --check .",
|
|
41
|
+
"prepare": "npm run build",
|
|
42
|
+
"prepublishOnly": "npm run eslint",
|
|
43
|
+
"preversion": "npm run eslint",
|
|
44
|
+
"version": "npm run format && git add -A lib",
|
|
45
|
+
"postversion": "git push --follow-tags origin main && npm publish",
|
|
46
|
+
"commit:example": "echo 'npm run commit -- \"v.1.0.1: Fixes\"'",
|
|
47
|
+
"commit:patch": "npm version patch --no-git-tag-version --force",
|
|
48
|
+
"commit:minor": "npm version minor --no-git-tag-version --force",
|
|
49
|
+
"commit:major": "npm version major --no-git-tag-version --force",
|
|
50
|
+
"commit": "git add . && git commit -m",
|
|
51
|
+
"release": "npm run build && standard-version --commit-all",
|
|
52
|
+
"release:publish": "git add . && npm run release && git push --follow-tags origin main && npm publish",
|
|
53
|
+
"test": "jest"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"aws-cdk-lib": "^2.120.0",
|
|
57
|
+
"constructs": "^10.4.5",
|
|
58
|
+
"esbuild": "^0.20.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"aws-cdk-lib": "^2.0.0",
|
|
62
|
+
"constructs": "^10.0.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/jest": "^29.5.12",
|
|
66
|
+
"@types/node": "^20.0.0",
|
|
67
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
68
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
69
|
+
"eslint": "^8.50.0",
|
|
70
|
+
"eslint-config-prettier": "^9.0.0",
|
|
71
|
+
"eslint-plugin-import": "^2.29.0",
|
|
72
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
73
|
+
"jest": "^29.7.0",
|
|
74
|
+
"prettier": "^3.0.0",
|
|
75
|
+
"standard-version": "^9.5.0",
|
|
76
|
+
"ts-jest": "^29.1.2",
|
|
77
|
+
"typescript": "^5.9.3"
|
|
78
|
+
},
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=16.0.0",
|
|
81
|
+
"npm": ">=8.0.0"
|
|
82
|
+
}
|
|
83
|
+
}
|