@empire-builder-kit/containers 0.0.1-alpha.4 → 0.0.1-alpha.5
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/dist/generators/service/files-go/infra/service.ts.template +59 -0
- package/dist/generators/service/files-python/infra/service.ts.template +68 -0
- package/dist/generators/service/files-rust/infra/service.ts.template +59 -0
- package/dist/generators/service/files-typescript/src/main.ts.template +1 -1
- package/dist/generators/task/files-go/infra/task.ts.template +38 -0
- package/dist/generators/task/files-python/infra/task.ts.template +38 -0
- package/dist/generators/task/files-rust/infra/task.ts.template +38 -0
- package/package.json +4 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Empire Builder Kit Contributors
|
|
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.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface Register<%= className %>ServiceArgs {
|
|
2
|
+
cluster: sst.aws.Cluster;
|
|
3
|
+
domain?: string | { name: string };
|
|
4
|
+
environment?: Record<string, string>;
|
|
5
|
+
link?: any[];
|
|
6
|
+
publicLoadBalancer?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Go service runs a static binary — no node/curl in the runtime image,
|
|
10
|
+
// so the Docker HEALTHCHECK is omitted here and the load balancer's
|
|
11
|
+
// target-group health check on `/health` gates traffic instead. Add a
|
|
12
|
+
// HEALTHCHECK back in Dockerfile + pass `health` here explicitly if you
|
|
13
|
+
// need task-level health visibility in ECS.
|
|
14
|
+
export function register<%= className %>Service({
|
|
15
|
+
cluster,
|
|
16
|
+
domain,
|
|
17
|
+
environment = {},
|
|
18
|
+
link = [],
|
|
19
|
+
publicLoadBalancer = false,
|
|
20
|
+
}: Register<%= className %>ServiceArgs) {
|
|
21
|
+
const service = new sst.aws.Service('<%= projectName %>', {
|
|
22
|
+
cluster,
|
|
23
|
+
image: {
|
|
24
|
+
context: './apps/service/<%= name %>',
|
|
25
|
+
dockerfile: 'Dockerfile',
|
|
26
|
+
},
|
|
27
|
+
dev: {
|
|
28
|
+
command: 'pnpm nx run <%= projectName %>:dev',
|
|
29
|
+
directory: '../../..',
|
|
30
|
+
url: 'http://127.0.0.1:3000',
|
|
31
|
+
},
|
|
32
|
+
environment: {
|
|
33
|
+
PORT: '3000',
|
|
34
|
+
SERVICE_NAME: '<%= className %>Service',
|
|
35
|
+
SERVICE_VERSION: '0.0.1',
|
|
36
|
+
...environment,
|
|
37
|
+
},
|
|
38
|
+
link,
|
|
39
|
+
logging: {
|
|
40
|
+
retention: '1 month',
|
|
41
|
+
},
|
|
42
|
+
serviceRegistry: {
|
|
43
|
+
port: 3000,
|
|
44
|
+
},
|
|
45
|
+
loadBalancer: {
|
|
46
|
+
public: publicLoadBalancer,
|
|
47
|
+
...(domain ? { domain } : {}),
|
|
48
|
+
rules: [{ listen: '80/http', forward: '3000/http' }],
|
|
49
|
+
health: {
|
|
50
|
+
'3000/http': {
|
|
51
|
+
path: '/health',
|
|
52
|
+
successCodes: '200-399',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return { service };
|
|
59
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface Register<%= className %>ServiceArgs {
|
|
2
|
+
cluster: sst.aws.Cluster;
|
|
3
|
+
domain?: string | { name: string };
|
|
4
|
+
environment?: Record<string, string>;
|
|
5
|
+
link?: any[];
|
|
6
|
+
publicLoadBalancer?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Python service uses `python -c` for the Docker HEALTHCHECK — the
|
|
10
|
+
// runtime image already has python + stdlib `urllib.request`, so no
|
|
11
|
+
// extra system package is needed. The load balancer's target-group
|
|
12
|
+
// health check on `/health` still gates traffic independently.
|
|
13
|
+
export function register<%= className %>Service({
|
|
14
|
+
cluster,
|
|
15
|
+
domain,
|
|
16
|
+
environment = {},
|
|
17
|
+
link = [],
|
|
18
|
+
publicLoadBalancer = false,
|
|
19
|
+
}: Register<%= className %>ServiceArgs) {
|
|
20
|
+
const service = new sst.aws.Service('<%= projectName %>', {
|
|
21
|
+
cluster,
|
|
22
|
+
image: {
|
|
23
|
+
context: './apps/service/<%= name %>',
|
|
24
|
+
dockerfile: 'Dockerfile',
|
|
25
|
+
},
|
|
26
|
+
dev: {
|
|
27
|
+
command: 'pnpm nx run <%= projectName %>:dev',
|
|
28
|
+
directory: '../../..',
|
|
29
|
+
url: 'http://127.0.0.1:3000',
|
|
30
|
+
},
|
|
31
|
+
environment: {
|
|
32
|
+
PORT: '3000',
|
|
33
|
+
SERVICE_NAME: '<%= className %>Service',
|
|
34
|
+
SERVICE_VERSION: '0.0.1',
|
|
35
|
+
...environment,
|
|
36
|
+
},
|
|
37
|
+
health: {
|
|
38
|
+
command: [
|
|
39
|
+
'CMD-SHELL',
|
|
40
|
+
'python -c "import urllib.request,sys;sys.exit(0 if urllib.request.urlopen(\'http://127.0.0.1:3000/health\',timeout=2).status<400 else 1)"',
|
|
41
|
+
],
|
|
42
|
+
interval: '30 seconds',
|
|
43
|
+
timeout: '5 seconds',
|
|
44
|
+
retries: 3,
|
|
45
|
+
startPeriod: '10 seconds',
|
|
46
|
+
},
|
|
47
|
+
link,
|
|
48
|
+
logging: {
|
|
49
|
+
retention: '1 month',
|
|
50
|
+
},
|
|
51
|
+
serviceRegistry: {
|
|
52
|
+
port: 3000,
|
|
53
|
+
},
|
|
54
|
+
loadBalancer: {
|
|
55
|
+
public: publicLoadBalancer,
|
|
56
|
+
...(domain ? { domain } : {}),
|
|
57
|
+
rules: [{ listen: '80/http', forward: '3000/http' }],
|
|
58
|
+
health: {
|
|
59
|
+
'3000/http': {
|
|
60
|
+
path: '/health',
|
|
61
|
+
successCodes: '200-399',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return { service };
|
|
68
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface Register<%= className %>ServiceArgs {
|
|
2
|
+
cluster: sst.aws.Cluster;
|
|
3
|
+
domain?: string | { name: string };
|
|
4
|
+
environment?: Record<string, string>;
|
|
5
|
+
link?: any[];
|
|
6
|
+
publicLoadBalancer?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Rust service runs a native binary inside debian-slim — no node/curl in
|
|
10
|
+
// the runtime image, so the Docker HEALTHCHECK is omitted here and the
|
|
11
|
+
// load balancer's target-group health check on `/health` gates traffic
|
|
12
|
+
// instead. Add a HEALTHCHECK back in Dockerfile + pass `health` here
|
|
13
|
+
// explicitly if you need task-level health visibility in ECS.
|
|
14
|
+
export function register<%= className %>Service({
|
|
15
|
+
cluster,
|
|
16
|
+
domain,
|
|
17
|
+
environment = {},
|
|
18
|
+
link = [],
|
|
19
|
+
publicLoadBalancer = false,
|
|
20
|
+
}: Register<%= className %>ServiceArgs) {
|
|
21
|
+
const service = new sst.aws.Service('<%= projectName %>', {
|
|
22
|
+
cluster,
|
|
23
|
+
image: {
|
|
24
|
+
context: './apps/service/<%= name %>',
|
|
25
|
+
dockerfile: 'Dockerfile',
|
|
26
|
+
},
|
|
27
|
+
dev: {
|
|
28
|
+
command: 'pnpm nx run <%= projectName %>:dev',
|
|
29
|
+
directory: '../../..',
|
|
30
|
+
url: 'http://127.0.0.1:3000',
|
|
31
|
+
},
|
|
32
|
+
environment: {
|
|
33
|
+
PORT: '3000',
|
|
34
|
+
SERVICE_NAME: '<%= className %>Service',
|
|
35
|
+
SERVICE_VERSION: '0.0.1',
|
|
36
|
+
...environment,
|
|
37
|
+
},
|
|
38
|
+
link,
|
|
39
|
+
logging: {
|
|
40
|
+
retention: '1 month',
|
|
41
|
+
},
|
|
42
|
+
serviceRegistry: {
|
|
43
|
+
port: 3000,
|
|
44
|
+
},
|
|
45
|
+
loadBalancer: {
|
|
46
|
+
public: publicLoadBalancer,
|
|
47
|
+
...(domain ? { domain } : {}),
|
|
48
|
+
rules: [{ listen: '80/http', forward: '3000/http' }],
|
|
49
|
+
health: {
|
|
50
|
+
'3000/http': {
|
|
51
|
+
path: '/health',
|
|
52
|
+
successCodes: '200-399',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return { service };
|
|
59
|
+
}
|
|
@@ -31,7 +31,7 @@ const server = createServer((request, response) => {
|
|
|
31
31
|
const ctx = createRequestContext({
|
|
32
32
|
app: '<%= app %>',
|
|
33
33
|
operation: `${method} ${url}`,
|
|
34
|
-
stage: process.env.SST_STAGE ?? process.env.EBK_STAGE ?? '
|
|
34
|
+
stage: process.env.SST_STAGE ?? process.env.EBK_STAGE ?? 'development',
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
logger.info('request received', {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface Register<%= className %>TaskArgs {
|
|
2
|
+
cluster: sst.aws.Cluster;
|
|
3
|
+
environment?: Record<string, string>;
|
|
4
|
+
link?: any[];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// ECS task (not a long-running service) — runs once per trigger, no health
|
|
8
|
+
// endpoint required. Runtime-agnostic SST wrapper; the Dockerfile decides
|
|
9
|
+
// whether the workload is Rust, Go, Python, or Node.
|
|
10
|
+
export function register<%= className %>Task({
|
|
11
|
+
cluster,
|
|
12
|
+
environment = {},
|
|
13
|
+
link = [],
|
|
14
|
+
}: Register<%= className %>TaskArgs) {
|
|
15
|
+
const task = new sst.aws.Task('<%= projectName %>', {
|
|
16
|
+
cluster,
|
|
17
|
+
image: {
|
|
18
|
+
context: './apps/task/<%= name %>',
|
|
19
|
+
dockerfile: 'Dockerfile',
|
|
20
|
+
},
|
|
21
|
+
dev: {
|
|
22
|
+
command: 'pnpm nx run <%= projectName %>:dev',
|
|
23
|
+
directory: '../../..',
|
|
24
|
+
},
|
|
25
|
+
environment: {
|
|
26
|
+
TASK_NAME: '<%= className %>Task',
|
|
27
|
+
TASK_VERSION: '0.0.1',
|
|
28
|
+
TASK_TRIGGER: 'manual',
|
|
29
|
+
...environment,
|
|
30
|
+
},
|
|
31
|
+
link,
|
|
32
|
+
logging: {
|
|
33
|
+
retention: '1 month',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return { task };
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface Register<%= className %>TaskArgs {
|
|
2
|
+
cluster: sst.aws.Cluster;
|
|
3
|
+
environment?: Record<string, string>;
|
|
4
|
+
link?: any[];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// ECS task (not a long-running service) — runs once per trigger, no health
|
|
8
|
+
// endpoint required. Runtime-agnostic SST wrapper; the Dockerfile decides
|
|
9
|
+
// whether the workload is Rust, Go, Python, or Node.
|
|
10
|
+
export function register<%= className %>Task({
|
|
11
|
+
cluster,
|
|
12
|
+
environment = {},
|
|
13
|
+
link = [],
|
|
14
|
+
}: Register<%= className %>TaskArgs) {
|
|
15
|
+
const task = new sst.aws.Task('<%= projectName %>', {
|
|
16
|
+
cluster,
|
|
17
|
+
image: {
|
|
18
|
+
context: './apps/task/<%= name %>',
|
|
19
|
+
dockerfile: 'Dockerfile',
|
|
20
|
+
},
|
|
21
|
+
dev: {
|
|
22
|
+
command: 'pnpm nx run <%= projectName %>:dev',
|
|
23
|
+
directory: '../../..',
|
|
24
|
+
},
|
|
25
|
+
environment: {
|
|
26
|
+
TASK_NAME: '<%= className %>Task',
|
|
27
|
+
TASK_VERSION: '0.0.1',
|
|
28
|
+
TASK_TRIGGER: 'manual',
|
|
29
|
+
...environment,
|
|
30
|
+
},
|
|
31
|
+
link,
|
|
32
|
+
logging: {
|
|
33
|
+
retention: '1 month',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return { task };
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface Register<%= className %>TaskArgs {
|
|
2
|
+
cluster: sst.aws.Cluster;
|
|
3
|
+
environment?: Record<string, string>;
|
|
4
|
+
link?: any[];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// ECS task (not a long-running service) — runs once per trigger, no health
|
|
8
|
+
// endpoint required. Runtime-agnostic SST wrapper; the Dockerfile decides
|
|
9
|
+
// whether the workload is Rust, Go, Python, or Node.
|
|
10
|
+
export function register<%= className %>Task({
|
|
11
|
+
cluster,
|
|
12
|
+
environment = {},
|
|
13
|
+
link = [],
|
|
14
|
+
}: Register<%= className %>TaskArgs) {
|
|
15
|
+
const task = new sst.aws.Task('<%= projectName %>', {
|
|
16
|
+
cluster,
|
|
17
|
+
image: {
|
|
18
|
+
context: './apps/task/<%= name %>',
|
|
19
|
+
dockerfile: 'Dockerfile',
|
|
20
|
+
},
|
|
21
|
+
dev: {
|
|
22
|
+
command: 'pnpm nx run <%= projectName %>:dev',
|
|
23
|
+
directory: '../../..',
|
|
24
|
+
},
|
|
25
|
+
environment: {
|
|
26
|
+
TASK_NAME: '<%= className %>Task',
|
|
27
|
+
TASK_VERSION: '0.0.1',
|
|
28
|
+
TASK_TRIGGER: 'manual',
|
|
29
|
+
...environment,
|
|
30
|
+
},
|
|
31
|
+
link,
|
|
32
|
+
logging: {
|
|
33
|
+
retention: '1 month',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return { task };
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empire-builder-kit/containers",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.5",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"publishConfig": {
|
|
5
6
|
"access": "public",
|
|
6
|
-
"provenance":
|
|
7
|
+
"provenance": false
|
|
7
8
|
},
|
|
8
9
|
"main": "./dist/index.js",
|
|
9
10
|
"module": "./dist/index.js",
|
|
@@ -89,4 +90,4 @@
|
|
|
89
90
|
"url": "https://github.com/LukasGuptaLeary/empire-builder-kit/issues"
|
|
90
91
|
},
|
|
91
92
|
"homepage": "https://github.com/LukasGuptaLeary/empire-builder-kit#readme"
|
|
92
|
-
}
|
|
93
|
+
}
|