@geek-fun/serverlessinsight 0.2.1 → 0.3.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/dist/package.json +18 -12
- package/dist/src/commands/deploy.js +2 -2
- package/dist/src/commands/destroy.js +5 -3
- package/dist/src/commands/index.js +32 -5
- package/dist/src/commands/validate.js +2 -2
- package/dist/src/common/actionContext.js +14 -9
- package/dist/src/common/base64.js +3 -1
- package/dist/src/common/domainHelper.js +10 -0
- package/dist/src/common/iacHelper.js +1 -1
- package/dist/src/common/index.d.ts +2 -0
- package/dist/src/common/index.js +2 -0
- package/dist/src/common/rosAssets.js +152 -0
- package/dist/src/common/rosClient.js +1 -53
- package/dist/src/parser/bucketParser.js +35 -0
- package/dist/src/parser/eventParser.js +1 -0
- package/dist/src/parser/functionParser.js +11 -3
- package/dist/src/parser/index.js +2 -0
- package/dist/src/stack/rfsStack/function.js +3 -3
- package/dist/src/stack/rosStack/bucket.js +126 -0
- package/dist/src/stack/rosStack/event.js +58 -51
- package/dist/src/stack/rosStack/function.js +137 -13
- package/dist/src/stack/rosStack/index.js +3 -0
- package/dist/src/types/domains/bucket.js +9 -0
- package/dist/src/types/domains/function.js +19 -0
- package/dist/src/types/index.d.ts +6 -0
- package/dist/src/types/index.js +1 -0
- package/dist/src/validator/bucketSchema.js +76 -0
- package/dist/src/validator/eventSchema.js +3 -7
- package/dist/src/validator/functionSchema.js +93 -19
- package/dist/src/validator/iacSchema.js +2 -0
- package/dist/src/validator/rootSchema.js +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -12
- package/samples/{aliyun-poc-fc.yml → aliyun-poc-api.yml} +9 -20
- package/samples/aliyun-poc-bucket.yml +20 -0
- package/samples/aliyun-poc-domain.yml +23 -0
- package/samples/aliyun-poc-fc-gpu.yml +54 -0
- package/samples/huawei-poc-fc.yml +4 -3
|
@@ -7,31 +7,61 @@ exports.functionSchema = {
|
|
|
7
7
|
patternProperties: {
|
|
8
8
|
'.*': {
|
|
9
9
|
type: 'object',
|
|
10
|
-
required: ['name'
|
|
10
|
+
required: ['name'],
|
|
11
11
|
properties: {
|
|
12
12
|
name: { type: 'string' },
|
|
13
|
-
|
|
13
|
+
code: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
required: ['runtime', 'handler', 'path'],
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
properties: {
|
|
18
|
+
runtime: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
enum: [
|
|
21
|
+
'nodejs20',
|
|
22
|
+
'nodejs18',
|
|
23
|
+
'nodejs16',
|
|
24
|
+
'nodejs14',
|
|
25
|
+
'nodejs12',
|
|
26
|
+
'nodejs10',
|
|
27
|
+
'nodejs8',
|
|
28
|
+
'python3.10',
|
|
29
|
+
'python3.9',
|
|
30
|
+
'python3',
|
|
31
|
+
'PHP 7.2',
|
|
32
|
+
'Java 11',
|
|
33
|
+
'.NET Core 3.1',
|
|
34
|
+
'Go 1.x',
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
handler: { type: 'string' },
|
|
38
|
+
path: { type: 'string' },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
container: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
required: ['image', 'port'],
|
|
44
|
+
additionalProperties: false,
|
|
45
|
+
properties: {
|
|
46
|
+
image: { type: 'string' },
|
|
47
|
+
cmd: { type: 'string' },
|
|
48
|
+
port: { type: 'number' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
memory: { type: 'number' },
|
|
52
|
+
gpu: {
|
|
14
53
|
type: 'string',
|
|
15
54
|
enum: [
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'python3.9',
|
|
25
|
-
'python3',
|
|
26
|
-
'PHP 7.2',
|
|
27
|
-
'Java 11',
|
|
28
|
-
'.NET Core 3.1',
|
|
29
|
-
'Go 1.x',
|
|
55
|
+
'TESLA_8',
|
|
56
|
+
'TESLA_12',
|
|
57
|
+
'TESLA_16',
|
|
58
|
+
'AMPERE_8',
|
|
59
|
+
'AMPERE_12',
|
|
60
|
+
'AMPERE_16',
|
|
61
|
+
'AMPERE_24',
|
|
62
|
+
'ADA_48',
|
|
30
63
|
],
|
|
31
64
|
},
|
|
32
|
-
handler: { type: 'string' },
|
|
33
|
-
code: { type: 'string' },
|
|
34
|
-
memory: { type: 'number' },
|
|
35
65
|
timeout: { type: 'number' },
|
|
36
66
|
log: { type: 'boolean' },
|
|
37
67
|
environment: {
|
|
@@ -40,6 +70,50 @@ exports.functionSchema = {
|
|
|
40
70
|
type: ['string', 'number', 'boolean'],
|
|
41
71
|
},
|
|
42
72
|
},
|
|
73
|
+
network: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: {
|
|
76
|
+
vpc_id: { type: 'string' },
|
|
77
|
+
subnet_ids: { type: 'array', items: { type: 'string' } },
|
|
78
|
+
security_group: {
|
|
79
|
+
type: 'object',
|
|
80
|
+
properties: {
|
|
81
|
+
name: { type: 'string' },
|
|
82
|
+
ingress: { type: 'array', items: { type: 'string' } },
|
|
83
|
+
egress: { type: 'array', items: { type: 'string' } },
|
|
84
|
+
},
|
|
85
|
+
required: ['name', 'ingress'],
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
required: ['vpc_id', 'subnet_ids', 'security_group'],
|
|
90
|
+
},
|
|
91
|
+
storage: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: {
|
|
94
|
+
disk: { type: 'number' },
|
|
95
|
+
nas: {
|
|
96
|
+
type: 'array',
|
|
97
|
+
items: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
properties: {
|
|
100
|
+
mount_path: { type: 'string' },
|
|
101
|
+
storage_class: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
enum: [
|
|
104
|
+
'STANDARD_PERFORMANCE',
|
|
105
|
+
'STANDARD_CAPACITY',
|
|
106
|
+
'EXTREME_STANDARD',
|
|
107
|
+
'EXTREME_ADVANCE',
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
additionalProperties: false,
|
|
111
|
+
},
|
|
112
|
+
required: ['mount_path', 'storage_class'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
43
117
|
},
|
|
44
118
|
additionalProperties: false,
|
|
45
119
|
},
|
|
@@ -10,6 +10,7 @@ const rootSchema_1 = require("./rootSchema");
|
|
|
10
10
|
const databaseSchema_1 = require("./databaseSchema");
|
|
11
11
|
const eventSchema_1 = require("./eventSchema");
|
|
12
12
|
const functionSchema_1 = require("./functionSchema");
|
|
13
|
+
const bucketSchema_1 = require("./bucketSchema");
|
|
13
14
|
class IacSchemaErrors extends Error {
|
|
14
15
|
constructor(errors) {
|
|
15
16
|
super(`Invalid yaml`);
|
|
@@ -30,6 +31,7 @@ const validate = ajv
|
|
|
30
31
|
.addSchema(functionSchema_1.functionSchema)
|
|
31
32
|
.addSchema(eventSchema_1.eventSchema)
|
|
32
33
|
.addSchema(databaseSchema_1.databaseSchema)
|
|
34
|
+
.addSchema(bucketSchema_1.bucketSchema)
|
|
33
35
|
.compile(rootSchema_1.rootSchema);
|
|
34
36
|
const validateYaml = (iacJson) => {
|
|
35
37
|
const valid = validate(iacJson);
|
|
@@ -46,6 +46,9 @@ exports.rootSchema = {
|
|
|
46
46
|
databases: {
|
|
47
47
|
$ref: 'https://serverlessinsight.geekfun.club/schemas/databaseschema.json',
|
|
48
48
|
},
|
|
49
|
+
buckets: {
|
|
50
|
+
$ref: 'https://serverlessinsight.geekfun.club/schemas/bucketschema.json',
|
|
51
|
+
},
|
|
49
52
|
},
|
|
50
53
|
required: ['version', 'provider', 'service'],
|
|
51
54
|
additionalProperties: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/commands/deploy.ts","../src/commands/destroy.ts","../src/commands/index.ts","../src/commands/template.ts","../src/commands/validate.ts","../src/common/actionContext.ts","../src/common/base64.ts","../src/common/constants.ts","../src/common/getVersion.ts","../src/common/iacHelper.ts","../src/common/imsClient.ts","../src/common/index.ts","../src/common/logger.ts","../src/common/providerEnum.ts","../src/common/rosClient.ts","../src/lang/index.ts","../src/parser/databaseParser.ts","../src/parser/eventParser.ts","../src/parser/functionParser.ts","../src/parser/index.ts","../src/parser/tagParser.ts","../src/stack/deploy.ts","../src/stack/index.ts","../src/stack/rfsStack/function.ts","../src/stack/rfsStack/index.ts","../src/stack/rosStack/bootstrap.ts","../src/stack/rosStack/database.ts","../src/stack/rosStack/event.ts","../src/stack/rosStack/function.ts","../src/stack/rosStack/index.ts","../src/stack/rosStack/stage.ts","../src/stack/rosStack/tag.ts","../src/stack/rosStack/vars.ts","../src/types/assets.ts","../src/types/index.ts","../src/types/domains/context.ts","../src/types/domains/database.ts","../src/types/domains/event.ts","../src/types/domains/function.ts","../src/types/domains/provider.ts","../src/types/domains/tag.ts","../src/types/domains/vars.ts","../src/validator/databaseSchema.ts","../src/validator/eventSchema.ts","../src/validator/functionSchema.ts","../src/validator/iacSchema.ts","../src/validator/index.ts","../src/validator/rootSchema.ts"],"version":"5.7.2"}
|
|
1
|
+
{"root":["../src/index.ts","../src/commands/deploy.ts","../src/commands/destroy.ts","../src/commands/index.ts","../src/commands/template.ts","../src/commands/validate.ts","../src/common/actionContext.ts","../src/common/base64.ts","../src/common/constants.ts","../src/common/domainHelper.ts","../src/common/getVersion.ts","../src/common/iacHelper.ts","../src/common/imsClient.ts","../src/common/index.ts","../src/common/logger.ts","../src/common/providerEnum.ts","../src/common/rosAssets.ts","../src/common/rosClient.ts","../src/lang/index.ts","../src/parser/bucketParser.ts","../src/parser/databaseParser.ts","../src/parser/eventParser.ts","../src/parser/functionParser.ts","../src/parser/index.ts","../src/parser/tagParser.ts","../src/stack/deploy.ts","../src/stack/index.ts","../src/stack/rfsStack/function.ts","../src/stack/rfsStack/index.ts","../src/stack/rosStack/bootstrap.ts","../src/stack/rosStack/bucket.ts","../src/stack/rosStack/database.ts","../src/stack/rosStack/event.ts","../src/stack/rosStack/function.ts","../src/stack/rosStack/index.ts","../src/stack/rosStack/stage.ts","../src/stack/rosStack/tag.ts","../src/stack/rosStack/vars.ts","../src/types/assets.ts","../src/types/index.ts","../src/types/domains/bucket.ts","../src/types/domains/context.ts","../src/types/domains/database.ts","../src/types/domains/event.ts","../src/types/domains/function.ts","../src/types/domains/provider.ts","../src/types/domains/tag.ts","../src/types/domains/vars.ts","../src/validator/bucketSchema.ts","../src/validator/databaseSchema.ts","../src/validator/eventSchema.ts","../src/validator/functionSchema.ts","../src/validator/iacSchema.ts","../src/validator/index.ts","../src/validator/rootSchema.ts"],"version":"5.7.2"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
|
|
5
5
|
"homepage": "https://serverlessinsight.geekfun.club",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -51,25 +51,31 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@alicloud/ims20190815": "^2.1.4",
|
|
53
53
|
"@alicloud/openapi-client": "^0.4.12",
|
|
54
|
-
"@alicloud/ros-cdk-apigateway": "^1.
|
|
55
|
-
"@alicloud/ros-cdk-core": "^1.
|
|
56
|
-
"@alicloud/ros-cdk-
|
|
57
|
-
"@alicloud/ros-cdk-
|
|
58
|
-
"@alicloud/ros-cdk-
|
|
59
|
-
"@alicloud/ros-cdk-
|
|
60
|
-
"@alicloud/ros-cdk-
|
|
61
|
-
"@alicloud/ros-cdk-
|
|
62
|
-
"@alicloud/ros-cdk-
|
|
54
|
+
"@alicloud/ros-cdk-apigateway": "^1.6.0",
|
|
55
|
+
"@alicloud/ros-cdk-core": "^1.6.0",
|
|
56
|
+
"@alicloud/ros-cdk-dns": "^1.6.0",
|
|
57
|
+
"@alicloud/ros-cdk-ecs": "^1.6.0",
|
|
58
|
+
"@alicloud/ros-cdk-elasticsearchserverless": "^1.6.0",
|
|
59
|
+
"@alicloud/ros-cdk-fc3": "^1.6.0",
|
|
60
|
+
"@alicloud/ros-cdk-nas": "^1.6.0",
|
|
61
|
+
"@alicloud/ros-cdk-oss": "^1.6.0",
|
|
62
|
+
"@alicloud/ros-cdk-ossdeployment": "^1.6.0",
|
|
63
|
+
"@alicloud/ros-cdk-ram": "^1.6.0",
|
|
64
|
+
"@alicloud/ros-cdk-rds": "^1.6.0",
|
|
65
|
+
"@alicloud/ros-cdk-sls": "^1.6.0",
|
|
63
66
|
"@alicloud/ros20190910": "^3.5.2",
|
|
64
67
|
"ajv": "^8.17.1",
|
|
65
68
|
"ali-oss": "^6.22.0",
|
|
66
|
-
"chalk": "^5.
|
|
69
|
+
"chalk": "^5.4.1",
|
|
67
70
|
"commander": "^12.1.0",
|
|
71
|
+
"i": "^0.3.7",
|
|
68
72
|
"i18n": "^0.15.1",
|
|
73
|
+
"jszip": "^3.10.1",
|
|
69
74
|
"lodash": "^4.17.21",
|
|
75
|
+
"npm": "^11.1.0",
|
|
70
76
|
"pino": "^9.5.0",
|
|
71
77
|
"pino-pretty": "^13.0.0",
|
|
72
|
-
"yaml": "^2.
|
|
78
|
+
"yaml": "^2.7.0"
|
|
73
79
|
},
|
|
74
80
|
"devDependencies": {
|
|
75
81
|
"@types/ali-oss": "^6.16.11",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
version: 0.0.1
|
|
2
2
|
provider:
|
|
3
3
|
name: aliyun
|
|
4
|
-
region: cn-
|
|
4
|
+
region: cn-hongkong
|
|
5
5
|
|
|
6
6
|
vars:
|
|
7
7
|
region: cn-hangzhou
|
|
@@ -18,17 +18,18 @@ stages:
|
|
|
18
18
|
prod:
|
|
19
19
|
region: cn-shanghai
|
|
20
20
|
|
|
21
|
-
service: insight-poc
|
|
21
|
+
service: insight-poc-api
|
|
22
22
|
|
|
23
23
|
tags:
|
|
24
24
|
owner: geek-fun
|
|
25
25
|
|
|
26
26
|
functions:
|
|
27
27
|
insight_poc_fn:
|
|
28
|
-
name: insight-poc-fn
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
name: insight-poc-api-fn
|
|
29
|
+
code:
|
|
30
|
+
runtime: nodejs18
|
|
31
|
+
handler: ${vars.handler}
|
|
32
|
+
path: tests/fixtures/artifacts/artifact.zip
|
|
32
33
|
memory: 512
|
|
33
34
|
timeout: 10
|
|
34
35
|
environment:
|
|
@@ -36,15 +37,6 @@ functions:
|
|
|
36
37
|
TEST_VAR: ${vars.testv}
|
|
37
38
|
TEST_VAR_EXTRA: abcds-${vars.testv}-andyou
|
|
38
39
|
|
|
39
|
-
databases:
|
|
40
|
-
insight_poc_db:
|
|
41
|
-
name: insight-poc-db
|
|
42
|
-
type: RDS_POSTGRESQL_SERVERLESS
|
|
43
|
-
version: '17.0'
|
|
44
|
-
security:
|
|
45
|
-
basic_auth:
|
|
46
|
-
password: 'U34I6InQ8elseTgqTWT2t2oFXpoqFg'
|
|
47
|
-
|
|
48
40
|
events:
|
|
49
41
|
gateway_event:
|
|
50
42
|
type: API_GATEWAY
|
|
@@ -53,8 +45,5 @@ events:
|
|
|
53
45
|
- method: GET
|
|
54
46
|
path: /api/hello
|
|
55
47
|
backend: ${functions.insight_poc_fn}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
# certificate_name: test
|
|
59
|
-
# certificate_private_key: test
|
|
60
|
-
# certificate_body: test
|
|
48
|
+
domain:
|
|
49
|
+
domain_name: insight-api.serverlessinsight.com
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
version: 0.0.1
|
|
2
|
+
|
|
3
|
+
provider:
|
|
4
|
+
name: aliyun
|
|
5
|
+
region: cn-chengdu
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
service: insight-bucket-poc
|
|
9
|
+
|
|
10
|
+
tags:
|
|
11
|
+
owner: geek-fun
|
|
12
|
+
|
|
13
|
+
buckets:
|
|
14
|
+
insight_poc_bucket:
|
|
15
|
+
name: insight-poc-bucket
|
|
16
|
+
website:
|
|
17
|
+
code: dist
|
|
18
|
+
index: index.html
|
|
19
|
+
error_page: 404.html
|
|
20
|
+
error_code: 404
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
version: 0.0.1
|
|
2
|
+
|
|
3
|
+
provider:
|
|
4
|
+
name: aliyun
|
|
5
|
+
region: cn-hongkong
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
service: insight-poc-domain
|
|
9
|
+
|
|
10
|
+
tags:
|
|
11
|
+
owner: geek-fun
|
|
12
|
+
|
|
13
|
+
buckets:
|
|
14
|
+
insight_poc_bucket:
|
|
15
|
+
name: insight-poc-domain
|
|
16
|
+
security:
|
|
17
|
+
acl: PUBLIC_READ
|
|
18
|
+
website:
|
|
19
|
+
code: dist
|
|
20
|
+
domain: meke-ui.serverlessinsight.com
|
|
21
|
+
index: index.html
|
|
22
|
+
error_page: 404.html
|
|
23
|
+
error_code: 404
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
version: 0.0.1
|
|
2
|
+
provider:
|
|
3
|
+
name: aliyun
|
|
4
|
+
region: cn-hangzhou
|
|
5
|
+
|
|
6
|
+
vars:
|
|
7
|
+
testv: testVarValue
|
|
8
|
+
handler: index.handler
|
|
9
|
+
|
|
10
|
+
stages:
|
|
11
|
+
default:
|
|
12
|
+
node_env: default
|
|
13
|
+
dev:
|
|
14
|
+
node_env: development
|
|
15
|
+
prod:
|
|
16
|
+
region: cn-hangzhou
|
|
17
|
+
|
|
18
|
+
service: insight-poc-gpu
|
|
19
|
+
|
|
20
|
+
tags:
|
|
21
|
+
owner: geek-fun
|
|
22
|
+
|
|
23
|
+
functions:
|
|
24
|
+
insight_poc_fn:
|
|
25
|
+
name: insight-poc-gpu-fn
|
|
26
|
+
container:
|
|
27
|
+
image: registry.cn-chengdu.aliyuncs.com/geek-fun/meke-api:latest
|
|
28
|
+
cmd: "npm start"
|
|
29
|
+
port: 9000
|
|
30
|
+
memory: 512
|
|
31
|
+
gpu: TESLA_8
|
|
32
|
+
timeout: 10
|
|
33
|
+
network:
|
|
34
|
+
vpc_id: vpc-2vc8v9btc8470laqui9bk
|
|
35
|
+
subnet_ids:
|
|
36
|
+
- vsw-2vc9zrs5mojkxd14yo3zw
|
|
37
|
+
- vsw-2vceshdo0xjp9q9t0oyt0
|
|
38
|
+
security_group:
|
|
39
|
+
name: insight-poc-gpu-fn-sg
|
|
40
|
+
ingress:
|
|
41
|
+
- TCP:0.0.0.0/0:80
|
|
42
|
+
- TCP:0.0.0.0/0:443
|
|
43
|
+
- TCP:0.0.0.0/0:22/22
|
|
44
|
+
- ICMP:0.0.0.0/0:ALL
|
|
45
|
+
egress:
|
|
46
|
+
- ALL:0.0.0.0/0:ALL
|
|
47
|
+
storage:
|
|
48
|
+
nas:
|
|
49
|
+
- mount_path: /mnt/nas
|
|
50
|
+
storage_class: STANDARD_CAPACITY
|
|
51
|
+
environment:
|
|
52
|
+
NODE_ENV: ${stages.node_env}
|
|
53
|
+
TEST_VAR: ${vars.testv}
|
|
54
|
+
TEST_VAR_EXTRA: abcds-${vars.testv}-andyou
|
|
@@ -23,9 +23,10 @@ tags:
|
|
|
23
23
|
functions:
|
|
24
24
|
insight_poc_fn:
|
|
25
25
|
name: insight-poc-fn
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
code:
|
|
27
|
+
runtime: nodejs18
|
|
28
|
+
handler: ${vars.handler}
|
|
29
|
+
path: tests/fixtures/artifacts/artifact.zip
|
|
29
30
|
memory: 512
|
|
30
31
|
timeout: 10
|
|
31
32
|
environment:
|