@geek-fun/serverlessinsight 0.3.3 → 0.4.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/README.md +209 -21
- package/README.zh-CN.md +232 -0
- package/dist/package.json +33 -33
- package/dist/src/commands/index.js +3 -1
- package/dist/src/commands/local.js +6 -3
- package/dist/src/common/constants.js +2 -1
- package/dist/src/common/context.js +35 -17
- package/dist/src/common/iacHelper.js +39 -4
- package/dist/src/common/index.d.ts +1 -1
- package/dist/src/common/index.js +1 -1
- package/dist/src/common/requestHelper.js +16 -0
- package/dist/src/parser/eventParser.js +1 -1
- package/dist/src/parser/index.d.ts +2 -1
- package/dist/src/parser/index.js +32 -1
- package/dist/src/stack/localStack/aliyunFc.js +145 -0
- package/dist/src/stack/localStack/bucket.js +226 -0
- package/dist/src/stack/localStack/event.js +133 -26
- package/dist/src/stack/localStack/function.js +120 -0
- package/dist/src/stack/localStack/functionRunner.js +270 -0
- package/dist/src/stack/localStack/index.d.ts +4 -1
- package/dist/src/stack/localStack/index.js +14 -4
- package/dist/src/stack/localStack/localServer.js +111 -0
- package/dist/src/stack/localStack/utils.js +36 -0
- package/dist/src/stack/rosStack/bootstrap.js +1 -3
- package/dist/src/types/localStack/index.d.ts +81 -0
- package/dist/src/types/localStack/index.js +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -33
- package/dist/src/common/domainHelper.js +0 -10
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# ServerlessInsight
|
|
2
2
|
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
3
5
|
[](https://github.com/geek-fun/serverlessinsight/actions/workflows/node.yml)
|
|
4
6
|
[](https://github.com/geek-fun/serverlessinsight/actions/workflows/release.yml)
|
|
5
7
|
[](https://badge.fury.io/js/@geek-fun%2Fserverlessinsight)
|
|
@@ -7,55 +9,241 @@
|
|
|
7
9
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
8
10
|
[](https://codecov.io/gh/geek-fun/serverlessinsight)
|
|
9
11
|
|
|
10
|
-
Full life cycle cross
|
|
12
|
+
**Full life cycle cross-provider serverless application management for your fast-growing business**
|
|
13
|
+
|
|
14
|
+
[Website](https://serverlessinsight.geekfun.club) • [Documentation](https://serverlessinsight.geekfun.club) • [Examples](./samples) • [中文文档](./README.zh-CN.md)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
ServerlessInsight is a powerful serverless framework for managing serverless applications across multiple cloud providers. It provides a unified interface to deploy, manage, and debug serverless functions and resources using Infrastructure as Code (IaC) principles.
|
|
21
|
+
|
|
22
|
+
Whether you're building on AWS, Alibaba Cloud, Huawei Cloud, or other providers, ServerlessInsight simplifies your development workflow with:
|
|
23
|
+
|
|
24
|
+
- **Multi-cloud support** - Work with multiple cloud providers using a single tool
|
|
25
|
+
- **Infrastructure as Code** - Define your serverless infrastructure in YAML
|
|
26
|
+
- **Local development** - Test your functions locally before deploying
|
|
27
|
+
- **Type-safe templates** - Validate your configurations before deployment
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ✨ Features
|
|
32
|
+
|
|
33
|
+
- 🌍 **Multi-Cloud Provider Support** - Deploy to Alibaba Cloud, Huawei Cloud, and more
|
|
34
|
+
- 📦 **Unified Configuration** - Single YAML format for all providers
|
|
35
|
+
- 🚀 **Quick Deployment** - Deploy serverless applications with a single command
|
|
36
|
+
- 🔍 **Template Validation** - Validate your IaC templates before deployment
|
|
37
|
+
- 🏠 **Local Testing** - Run and debug serverless functions locally
|
|
38
|
+
- 🔄 **Template Generation** - Generate provider-specific IaC templates
|
|
39
|
+
- 🌐 **API Gateway Integration** - Configure HTTP endpoints for your functions
|
|
40
|
+
- 💾 **Resource Management** - Manage storage, databases, and other cloud resources
|
|
41
|
+
- 🔐 **Security First** - Built-in validation and security best practices
|
|
42
|
+
- 📊 **Comprehensive Logging** - Debug and monitor your applications
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## ☁️ Supported Providers
|
|
47
|
+
|
|
48
|
+
ServerlessInsight supports the following cloud providers:
|
|
49
|
+
|
|
50
|
+
| Provider | Functions | API Gateway | Storage | Databases | Status |
|
|
51
|
+
|----------|-----------|-------------|---------|-----------|--------|
|
|
52
|
+
| **Alibaba Cloud** | ✅ FC3 | ✅ API Gateway | ✅ OSS | ✅ RDS, OTS, ESS | Stable |
|
|
53
|
+
| **Huawei Cloud** | ✅ FunctionGraph | 🚧 Coming Soon | 🚧 Coming Soon | 🚧 Coming Soon | Beta |
|
|
54
|
+
| **AWS** | 🔜 Planned | 🔜 Planned | 🔜 Planned | 🔜 Planned | Planned |
|
|
55
|
+
| **Azure** | 🔜 Planned | 🔜 Planned | 🔜 Planned | 🔜 Planned | Planned |
|
|
56
|
+
| **Google Cloud** | 🔜 Planned | 🔜 Planned | 🔜 Planned | 🔜 Planned | Planned |
|
|
57
|
+
| **Tencent Cloud** | 🔜 Planned | 🔜 Planned | 🔜 Planned | 🔜 Planned | Planned |
|
|
58
|
+
|
|
59
|
+
---
|
|
11
60
|
|
|
12
|
-
##
|
|
61
|
+
## 🚀 Getting Started
|
|
13
62
|
|
|
14
|
-
###
|
|
63
|
+
### Prerequisites
|
|
15
64
|
|
|
16
|
-
- Node.js 16.x
|
|
65
|
+
- **Node.js** 16.x or higher
|
|
66
|
+
- Cloud provider credentials (Alibaba Cloud AccessKey, Huawei Cloud credentials, etc.)
|
|
17
67
|
|
|
18
|
-
###
|
|
68
|
+
### Installation
|
|
69
|
+
|
|
70
|
+
Install ServerlessInsight globally using npm:
|
|
19
71
|
|
|
20
72
|
```bash
|
|
21
73
|
npm install -g @geek-fun/serverlessinsight
|
|
22
74
|
```
|
|
23
75
|
|
|
24
|
-
|
|
76
|
+
Verify the installation:
|
|
25
77
|
|
|
26
78
|
```bash
|
|
27
|
-
si
|
|
79
|
+
si --version
|
|
28
80
|
```
|
|
29
81
|
|
|
30
|
-
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📚 Usage
|
|
31
85
|
|
|
32
86
|
```bash
|
|
33
|
-
|
|
34
|
-
|
|
87
|
+
# Validate your serverless configuration
|
|
88
|
+
si validate <stackName> -f serverless.yml
|
|
35
89
|
|
|
36
|
-
|
|
90
|
+
# Deploy your serverless application
|
|
91
|
+
si deploy <stackName> -f serverless.yml -s dev
|
|
37
92
|
|
|
38
|
-
|
|
39
|
-
si
|
|
40
|
-
```
|
|
93
|
+
# Run your application locally for debugging
|
|
94
|
+
si local <stackName> -f serverless.yml -s local
|
|
41
95
|
|
|
42
|
-
|
|
96
|
+
# Generate provider-specific template
|
|
97
|
+
si template <stackName> -f serverless.yml -t JSON
|
|
43
98
|
|
|
44
|
-
|
|
45
|
-
si
|
|
99
|
+
# Destroy the deployed stack
|
|
100
|
+
si destroy <stackName> -f serverless.yml
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 💡 Examples
|
|
106
|
+
|
|
107
|
+
ServerlessInsight uses a simple YAML format to define your serverless infrastructure:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
version: 0.0.1
|
|
111
|
+
provider:
|
|
112
|
+
name: aliyun
|
|
113
|
+
region: cn-hongkong
|
|
114
|
+
|
|
115
|
+
service: my-api-service
|
|
116
|
+
|
|
117
|
+
functions:
|
|
118
|
+
hello_function:
|
|
119
|
+
name: hello-world-fn
|
|
120
|
+
code:
|
|
121
|
+
runtime: nodejs18
|
|
122
|
+
handler: index.handler
|
|
123
|
+
path: ./src
|
|
124
|
+
memory: 512
|
|
125
|
+
timeout: 10
|
|
126
|
+
environment:
|
|
127
|
+
NODE_ENV: production
|
|
128
|
+
|
|
129
|
+
events:
|
|
130
|
+
api_gateway:
|
|
131
|
+
type: API_GATEWAY
|
|
132
|
+
name: my-api-gateway
|
|
133
|
+
triggers:
|
|
134
|
+
- method: GET
|
|
135
|
+
path: /api/hello
|
|
136
|
+
backend: ${functions.hello_function}
|
|
46
137
|
```
|
|
47
138
|
|
|
48
|
-
|
|
139
|
+
For more examples, check out the [samples](./samples) directory:
|
|
140
|
+
|
|
141
|
+
- [API Gateway Example](./samples/aliyun-poc-api.yml) - Deploy functions with HTTP endpoints
|
|
142
|
+
- [Storage Example](./samples/aliyun-poc-bucket.yml) - Configure OSS buckets
|
|
143
|
+
- [Database Example](./samples/aliyun-poc-rds.yml) - Set up RDS databases
|
|
144
|
+
- [Table Store Example](./samples/aliyun-poc-table.yml) - Configure OTS table storage
|
|
145
|
+
- [Elasticsearch Example](./samples/aliyun-poc-es.yml) - Deploy Elasticsearch Serverless
|
|
146
|
+
- [Custom Domain Example](./samples/aliyun-poc-domain.yml) - Configure custom domains
|
|
147
|
+
- [GPU Functions Example](./samples/aliyun-poc-fc-gpu.yml) - Deploy GPU-enabled functions
|
|
148
|
+
- [Huawei Cloud Example](./samples/huawei-poc-fc.yml) - Deploy to Huawei Cloud FunctionGraph
|
|
49
149
|
|
|
50
|
-
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🔧 Local Development
|
|
51
153
|
|
|
52
154
|
```bash
|
|
155
|
+
# Clone and setup
|
|
156
|
+
git clone https://github.com/geek-fun/serverlessinsight.git
|
|
157
|
+
cd serverlessinsight
|
|
158
|
+
npm install
|
|
159
|
+
|
|
160
|
+
# Build and link for development
|
|
53
161
|
npm run build
|
|
54
162
|
npm link
|
|
163
|
+
|
|
164
|
+
# Run local development server
|
|
165
|
+
si local my-stack -f serverless.yml -s local
|
|
166
|
+
|
|
167
|
+
# Run tests
|
|
168
|
+
npm test
|
|
169
|
+
|
|
170
|
+
# Lint code
|
|
171
|
+
npm run lint:check
|
|
55
172
|
```
|
|
56
173
|
|
|
57
|
-
|
|
174
|
+
### Local Testing with Buckets
|
|
175
|
+
|
|
176
|
+
When running the local development server, you can test bucket operations by accessing files through the LocalStack server:
|
|
58
177
|
|
|
59
178
|
```bash
|
|
60
|
-
|
|
179
|
+
# List all files in a bucket
|
|
180
|
+
curl http://localhost:4567/si_buckets/<bucket_key>/
|
|
181
|
+
|
|
182
|
+
# Access a specific file from a bucket
|
|
183
|
+
curl http://localhost:4567/si_buckets/<bucket_key>/path/to/file.html
|
|
184
|
+
|
|
185
|
+
# List files in a subdirectory
|
|
186
|
+
curl http://localhost:4567/si_buckets/<bucket_key>/subdir/
|
|
61
187
|
```
|
|
188
|
+
|
|
189
|
+
The bucket handler serves files from the directory specified in your bucket's `website.code` configuration.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 📘 Documentation
|
|
194
|
+
|
|
195
|
+
For comprehensive documentation, visit [serverlessinsight.geekfun.club](https://serverlessinsight.geekfun.club)
|
|
196
|
+
|
|
197
|
+
Additional resources:
|
|
198
|
+
- [Quick Start Guide](https://serverlessinsight.geekfun.club)
|
|
199
|
+
- [Configuration Reference](https://serverlessinsight.geekfun.club)
|
|
200
|
+
- [API Documentation](https://serverlessinsight.geekfun.club)
|
|
201
|
+
- [Best Practices](https://serverlessinsight.geekfun.club)
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 🤝 Contributing
|
|
206
|
+
|
|
207
|
+
We welcome contributions from the community! Here's how you can help:
|
|
208
|
+
|
|
209
|
+
1. **Fork the repository**
|
|
210
|
+
2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)
|
|
211
|
+
3. **Commit your changes** (`git commit -m 'Add amazing feature'`)
|
|
212
|
+
4. **Push to the branch** (`git push origin feature/amazing-feature`)
|
|
213
|
+
5. **Open a Pull Request**
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 👥 Community
|
|
218
|
+
|
|
219
|
+
Join our community to get help, share ideas, and contribute:
|
|
220
|
+
|
|
221
|
+
- **GitHub Issues** - [Report bugs or request features](https://github.com/geek-fun/serverlessinsight/issues)
|
|
222
|
+
- **Website** - [serverlessinsight.geekfun.club](https://serverlessinsight.geekfun.club)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 📄 License
|
|
227
|
+
|
|
228
|
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 🙏 Acknowledgments
|
|
233
|
+
|
|
234
|
+
ServerlessInsight is built with these amazing technologies:
|
|
235
|
+
|
|
236
|
+
- [Node.js](https://nodejs.org/) - JavaScript runtime
|
|
237
|
+
- [TypeScript](https://www.typescriptlang.org/) - Type-safe JavaScript
|
|
238
|
+
- [Commander.js](https://github.com/tj/commander.js/) - CLI framework
|
|
239
|
+
- [Alibaba Cloud ROS CDK](https://github.com/aliyun/Resource-Orchestration-Service-Cloud-Development-Kit) - Cloud infrastructure SDK
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
<div align="center">
|
|
244
|
+
|
|
245
|
+
**Made with ❤️ by the [geek-fun](https://github.com/geek-fun) team**
|
|
246
|
+
|
|
247
|
+
[⬆ Back to Top](#serverlessinsight)
|
|
248
|
+
|
|
249
|
+
</div>
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# ServerlessInsight
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
[](https://github.com/geek-fun/serverlessinsight/actions/workflows/node.yml)
|
|
6
|
+
[](https://github.com/geek-fun/serverlessinsight/actions/workflows/release.yml)
|
|
7
|
+
[](https://badge.fury.io/js/@geek-fun%2Fserverlessinsight)
|
|
8
|
+
[](https://snyk.io/test/github/geek-fun/serverlessinsight)
|
|
9
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
10
|
+
[](https://codecov.io/gh/geek-fun/serverlessinsight)
|
|
11
|
+
|
|
12
|
+
**为快速增长的业务提供全生命周期跨云服务商的 Serverless 应用管理**
|
|
13
|
+
|
|
14
|
+
[官方网站](https://serverlessinsight.geekfun.club) • [文档](https://serverlessinsight.geekfun.club) • [示例](./samples) • [English](./README.md)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
ServerlessInsight 是一个强大的 Serverless 框架,用于跨多个云服务商管理 Serverless 应用。它提供了统一的接口来部署、管理和调试 Serverless 函数和资源,使用基础设施即代码(IaC)原则。
|
|
21
|
+
|
|
22
|
+
无论您是在 AWS、阿里云、华为云还是其他服务商上构建应用,ServerlessInsight 都能简化您的开发工作流程:
|
|
23
|
+
|
|
24
|
+
- **多云支持** - 使用单一工具与多个云服务商协作
|
|
25
|
+
- **基础设施即代码** - 使用 YAML 定义您的 Serverless 基础设施
|
|
26
|
+
- **本地开发** - 在部署前本地测试您的函数
|
|
27
|
+
- **类型安全模板** - 在部署前验证您的配置
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ✨ 特性
|
|
32
|
+
|
|
33
|
+
- 🌍 **多云服务商支持** - 部署到阿里云、华为云等多个平台
|
|
34
|
+
- 📦 **统一配置** - 所有服务商使用单一 YAML 格式
|
|
35
|
+
- 🚀 **快速部署** - 使用单个命令部署 Serverless 应用
|
|
36
|
+
- 🔍 **模板验证** - 在部署前验证您的 IaC 模板
|
|
37
|
+
- 🏠 **本地测试** - 在本地运行和调试 Serverless 函数
|
|
38
|
+
- 🔄 **模板生成** - 生成特定云服务商的 IaC 模板
|
|
39
|
+
- 🌐 **API 网关集成** - 为您的函数配置 HTTP 端点
|
|
40
|
+
- 💾 **资源管理** - 管理存储、数据库和其他云资源
|
|
41
|
+
- 🔐 **安全优先** - 内置验证和安全最佳实践
|
|
42
|
+
- 📊 **全面的日志记录** - 调试和监控您的应用
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## ☁️ 支持的云服务商
|
|
47
|
+
|
|
48
|
+
ServerlessInsight 支持以下云服务商:
|
|
49
|
+
|
|
50
|
+
| 云服务商 | 函数 | API 网关 | 存储 | 数据库 | 状态 |
|
|
51
|
+
|----------|------|----------|------|--------|------|
|
|
52
|
+
| **阿里云** | ✅ FC3 | ✅ API 网关 | ✅ OSS | ✅ RDS, OTS, ESS | 稳定 |
|
|
53
|
+
| **华为云** | ✅ FunctionGraph | 🚧 即将推出 | 🚧 即将推出 | 🚧 即将推出 | 测试版 |
|
|
54
|
+
| **AWS** | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 计划中 |
|
|
55
|
+
| **Azure** | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 计划中 |
|
|
56
|
+
| **Google Cloud** | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 计划中 |
|
|
57
|
+
| **腾讯云** | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 计划中 |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 🚀 快速开始
|
|
62
|
+
|
|
63
|
+
### 前置要求
|
|
64
|
+
|
|
65
|
+
- **Node.js** 16.x 或更高版本
|
|
66
|
+
- 云服务商凭证(阿里云 AccessKey、华为云凭证等)
|
|
67
|
+
|
|
68
|
+
### 安装
|
|
69
|
+
|
|
70
|
+
使用 npm 全局安装 ServerlessInsight:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install -g @geek-fun/serverlessinsight
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
验证安装:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
si --version
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📚 使用方法
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 验证您的 Serverless 配置
|
|
88
|
+
si validate <stackName> -f serverless.yml
|
|
89
|
+
|
|
90
|
+
# 部署您的 Serverless 应用
|
|
91
|
+
si deploy <stackName> -f serverless.yml -s dev
|
|
92
|
+
|
|
93
|
+
# 本地运行您的应用进行调试
|
|
94
|
+
si local <stackName> -f serverless.yml -s local
|
|
95
|
+
|
|
96
|
+
# 生成特定云服务商的模板
|
|
97
|
+
si template <stackName> -f serverless.yml -t JSON
|
|
98
|
+
|
|
99
|
+
# 销毁已部署的堆栈
|
|
100
|
+
si destroy <stackName> -f serverless.yml
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 💡 示例
|
|
106
|
+
|
|
107
|
+
ServerlessInsight 使用简单的 YAML 格式来定义您的 Serverless 基础设施:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
version: 0.0.1
|
|
111
|
+
provider:
|
|
112
|
+
name: aliyun
|
|
113
|
+
region: cn-hongkong
|
|
114
|
+
|
|
115
|
+
service: my-api-service
|
|
116
|
+
|
|
117
|
+
functions:
|
|
118
|
+
hello_function:
|
|
119
|
+
name: hello-world-fn
|
|
120
|
+
code:
|
|
121
|
+
runtime: nodejs18
|
|
122
|
+
handler: index.handler
|
|
123
|
+
path: ./src
|
|
124
|
+
memory: 512
|
|
125
|
+
timeout: 10
|
|
126
|
+
environment:
|
|
127
|
+
NODE_ENV: production
|
|
128
|
+
|
|
129
|
+
events:
|
|
130
|
+
api_gateway:
|
|
131
|
+
type: API_GATEWAY
|
|
132
|
+
name: my-api-gateway
|
|
133
|
+
triggers:
|
|
134
|
+
- method: GET
|
|
135
|
+
path: /api/hello
|
|
136
|
+
backend: ${functions.hello_function}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
更多示例请查看 [samples](./samples) 目录:
|
|
140
|
+
|
|
141
|
+
- [API 网关示例](./samples/aliyun-poc-api.yml) - 部署带 HTTP 端点的函数
|
|
142
|
+
- [存储示例](./samples/aliyun-poc-bucket.yml) - 配置 OSS 存储桶
|
|
143
|
+
- [数据库示例](./samples/aliyun-poc-rds.yml) - 设置 RDS 数据库
|
|
144
|
+
- [表格存储示例](./samples/aliyun-poc-table.yml) - 配置 OTS 表格存储
|
|
145
|
+
- [Elasticsearch 示例](./samples/aliyun-poc-es.yml) - 部署 Elasticsearch Serverless
|
|
146
|
+
- [自定义域名示例](./samples/aliyun-poc-domain.yml) - 配置自定义域名
|
|
147
|
+
- [GPU 函数示例](./samples/aliyun-poc-fc-gpu.yml) - 部署支持 GPU 的函数
|
|
148
|
+
- [华为云示例](./samples/huawei-poc-fc.yml) - 部署到华为云 FunctionGraph
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🔧 本地开发
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# 克隆和设置
|
|
156
|
+
git clone https://github.com/geek-fun/serverlessinsight.git
|
|
157
|
+
cd serverlessinsight
|
|
158
|
+
npm install
|
|
159
|
+
|
|
160
|
+
# 构建并链接用于开发
|
|
161
|
+
npm run build
|
|
162
|
+
npm link
|
|
163
|
+
|
|
164
|
+
# 运行本地开发服务器
|
|
165
|
+
si local my-stack -f serverless.yml -s local
|
|
166
|
+
|
|
167
|
+
# 运行测试
|
|
168
|
+
npm test
|
|
169
|
+
|
|
170
|
+
# 检查代码规范
|
|
171
|
+
npm run lint:check
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 📘 文档
|
|
177
|
+
|
|
178
|
+
完整文档请访问 [serverlessinsight.geekfun.club](https://serverlessinsight.geekfun.club)
|
|
179
|
+
|
|
180
|
+
其他资源:
|
|
181
|
+
- [快速开始指南](https://serverlessinsight.geekfun.club)
|
|
182
|
+
- [配置参考](https://serverlessinsight.geekfun.club)
|
|
183
|
+
- [API 文档](https://serverlessinsight.geekfun.club)
|
|
184
|
+
- [最佳实践](https://serverlessinsight.geekfun.club)
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 🤝 贡献
|
|
189
|
+
|
|
190
|
+
我们欢迎社区的贡献!以下是您可以帮助的方式:
|
|
191
|
+
|
|
192
|
+
1. **Fork 仓库**
|
|
193
|
+
2. **创建功能分支** (`git checkout -b feature/amazing-feature`)
|
|
194
|
+
3. **提交您的更改** (`git commit -m 'Add amazing feature'`)
|
|
195
|
+
4. **推送到分支** (`git push origin feature/amazing-feature`)
|
|
196
|
+
5. **打开 Pull Request**
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 👥 社区
|
|
201
|
+
|
|
202
|
+
加入我们的社区以获取帮助、分享想法和贡献:
|
|
203
|
+
|
|
204
|
+
- **GitHub Issues** - [报告错误或请求功能](https://github.com/geek-fun/serverlessinsight/issues)
|
|
205
|
+
- **官方网站** - [serverlessinsight.geekfun.club](https://serverlessinsight.geekfun.club)
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 📄 许可证
|
|
210
|
+
|
|
211
|
+
本项目采用 Apache License 2.0 许可证 - 详见 [LICENSE](LICENSE) 文件。
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 🙏 致谢
|
|
216
|
+
|
|
217
|
+
ServerlessInsight 使用以下优秀技术构建:
|
|
218
|
+
|
|
219
|
+
- [Node.js](https://nodejs.org/) - JavaScript 运行时
|
|
220
|
+
- [TypeScript](https://www.typescriptlang.org/) - 类型安全的 JavaScript
|
|
221
|
+
- [Commander.js](https://github.com/tj/commander.js/) - CLI 框架
|
|
222
|
+
- [阿里云 ROS CDK](https://github.com/aliyun/Resource-Orchestration-Service-Cloud-Development-Kit) - 云基础设施 SDK
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
<div align="center">
|
|
227
|
+
|
|
228
|
+
**由 [geek-fun](https://github.com/geek-fun) 团队用 ❤️ 制作**
|
|
229
|
+
|
|
230
|
+
[⬆ 回到顶部](#serverlessinsight)
|
|
231
|
+
|
|
232
|
+
</div>
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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,52 +51,52 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@alicloud/ims20190815": "^2.3.2",
|
|
53
53
|
"@alicloud/openapi-client": "^0.4.15",
|
|
54
|
-
"@alicloud/ros-cdk-apigateway": "^1.
|
|
55
|
-
"@alicloud/ros-cdk-core": "^1.
|
|
56
|
-
"@alicloud/ros-cdk-dns": "^1.
|
|
57
|
-
"@alicloud/ros-cdk-ecs": "^1.
|
|
58
|
-
"@alicloud/ros-cdk-elasticsearchserverless": "^1.
|
|
59
|
-
"@alicloud/ros-cdk-fc3": "^1.
|
|
60
|
-
"@alicloud/ros-cdk-nas": "^1.
|
|
61
|
-
"@alicloud/ros-cdk-oss": "^1.
|
|
62
|
-
"@alicloud/ros-cdk-ossdeployment": "^1.
|
|
63
|
-
"@alicloud/ros-cdk-ots": "^1.
|
|
64
|
-
"@alicloud/ros-cdk-ram": "^1.
|
|
65
|
-
"@alicloud/ros-cdk-rds": "^1.
|
|
66
|
-
"@alicloud/ros-cdk-ros": "^1.
|
|
67
|
-
"@alicloud/ros-cdk-sls": "^1.
|
|
68
|
-
"@alicloud/ros-cdk-vpc": "^1.
|
|
54
|
+
"@alicloud/ros-cdk-apigateway": "^1.11.0",
|
|
55
|
+
"@alicloud/ros-cdk-core": "^1.11.0",
|
|
56
|
+
"@alicloud/ros-cdk-dns": "^1.11.0",
|
|
57
|
+
"@alicloud/ros-cdk-ecs": "^1.11.0",
|
|
58
|
+
"@alicloud/ros-cdk-elasticsearchserverless": "^1.11.0",
|
|
59
|
+
"@alicloud/ros-cdk-fc3": "^1.11.0",
|
|
60
|
+
"@alicloud/ros-cdk-nas": "^1.11.0",
|
|
61
|
+
"@alicloud/ros-cdk-oss": "^1.11.0",
|
|
62
|
+
"@alicloud/ros-cdk-ossdeployment": "^1.11.0",
|
|
63
|
+
"@alicloud/ros-cdk-ots": "^1.11.0",
|
|
64
|
+
"@alicloud/ros-cdk-ram": "^1.11.0",
|
|
65
|
+
"@alicloud/ros-cdk-rds": "^1.11.0",
|
|
66
|
+
"@alicloud/ros-cdk-ros": "^1.11.0",
|
|
67
|
+
"@alicloud/ros-cdk-sls": "^1.11.0",
|
|
68
|
+
"@alicloud/ros-cdk-vpc": "^1.11.0",
|
|
69
69
|
"@alicloud/ros20190910": "^3.6.0",
|
|
70
70
|
"ajv": "^8.17.1",
|
|
71
71
|
"ali-oss": "^6.23.0",
|
|
72
72
|
"chalk": "^5.6.2",
|
|
73
|
-
"commander": "^14.0.
|
|
73
|
+
"commander": "^14.0.2",
|
|
74
74
|
"i": "^0.3.7",
|
|
75
|
-
"i18n": "^0.15.
|
|
75
|
+
"i18n": "^0.15.3",
|
|
76
76
|
"jszip": "^3.10.1",
|
|
77
77
|
"lodash": "^4.17.21",
|
|
78
|
-
"npm": "^11.
|
|
79
|
-
"pino": "^
|
|
80
|
-
"pino-pretty": "^13.1.
|
|
81
|
-
"yaml": "^2.8.
|
|
78
|
+
"npm": "^11.7.0",
|
|
79
|
+
"pino": "^10.1.0",
|
|
80
|
+
"pino-pretty": "^13.1.3",
|
|
81
|
+
"yaml": "^2.8.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@types/ali-oss": "^6.16.
|
|
84
|
+
"@types/ali-oss": "^6.16.13",
|
|
85
85
|
"@types/i18n": "^0.13.12",
|
|
86
86
|
"@types/jest": "^30.0.0",
|
|
87
|
-
"@types/lodash": "^4.17.
|
|
88
|
-
"@types/node": "^
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
90
|
-
"@typescript-eslint/parser": "^8.
|
|
91
|
-
"eslint": "^9.
|
|
87
|
+
"@types/lodash": "^4.17.21",
|
|
88
|
+
"@types/node": "^25.0.3",
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
|
90
|
+
"@typescript-eslint/parser": "^8.50.0",
|
|
91
|
+
"eslint": "^9.39.2",
|
|
92
92
|
"eslint-config-prettier": "^10.1.8",
|
|
93
93
|
"eslint-plugin-prettier": "^5.5.4",
|
|
94
|
-
"globals": "^16.
|
|
94
|
+
"globals": "^16.5.0",
|
|
95
95
|
"husky": "^9.1.7",
|
|
96
|
-
"jest": "^30.0
|
|
97
|
-
"prettier": "^3.
|
|
98
|
-
"ts-jest": "^29.4.
|
|
96
|
+
"jest": "^30.2.0",
|
|
97
|
+
"prettier": "^3.7.4",
|
|
98
|
+
"ts-jest": "^29.4.6",
|
|
99
99
|
"ts-node": "^10.9.2",
|
|
100
|
-
"typescript": "^5.9.
|
|
100
|
+
"typescript": "^5.9.3"
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -86,16 +86,18 @@ program
|
|
|
86
86
|
program
|
|
87
87
|
.command('local <stackName>')
|
|
88
88
|
.description('run Serverless application locally for debugging')
|
|
89
|
+
.option('-f, --file <path>', 'specify the yaml file')
|
|
89
90
|
.option('-s, --stage <stage>', 'specify the stage', 'default')
|
|
90
91
|
.option('-p, --port <port>', 'specify the port', '3000')
|
|
91
92
|
.option('-d, --debug', 'enable debug mode')
|
|
92
93
|
.option('-w, --watch', 'enable file watch', true)
|
|
93
|
-
.action(async (stackName, { stage, port, debug, watch }) => {
|
|
94
|
+
.action(async (stackName, { stage, port, debug, watch, file }) => {
|
|
94
95
|
await (0, local_1.runLocal)(stackName, {
|
|
95
96
|
stage,
|
|
96
97
|
port: Number(port) || 3000,
|
|
97
98
|
debug: !!debug,
|
|
98
99
|
watch: typeof watch === 'boolean' ? watch : true,
|
|
100
|
+
location: file,
|
|
99
101
|
});
|
|
100
102
|
});
|
|
101
103
|
program.parse();
|
|
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runLocal = void 0;
|
|
4
4
|
const common_1 = require("../common");
|
|
5
5
|
const localStack_1 = require("../stack/localStack");
|
|
6
|
+
const parser_1 = require("../parser");
|
|
6
7
|
const runLocal = async (stackName, opts) => {
|
|
7
|
-
const { stage, port, debug, watch } = opts;
|
|
8
|
-
await (0, common_1.setContext)({ stage });
|
|
8
|
+
const { stage, port, debug, watch, location } = opts;
|
|
9
|
+
await (0, common_1.setContext)({ stage, location });
|
|
10
|
+
const ctx = (0, common_1.getContext)();
|
|
11
|
+
const iac = (0, parser_1.revalYaml)((0, common_1.getIacLocation)(location), ctx);
|
|
9
12
|
common_1.logger.info(`run-local starting: stack=${stackName} stage=${stage} port=${port} debug=${debug} watch=${watch}`);
|
|
10
|
-
await (0, localStack_1.startLocalStack)();
|
|
13
|
+
await (0, localStack_1.startLocalStack)(iac);
|
|
11
14
|
// if (watch) {
|
|
12
15
|
// const cwd = process.cwd();
|
|
13
16
|
// try {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
|
|
3
|
+
exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
|
|
4
4
|
exports.CODE_ZIP_SIZE_LIMIT = 300 * 1000; // 300 KB ROS TemplateBody size limit 512 KB
|
|
5
5
|
exports.OSS_DEPLOYMENT_TIMEOUT = 3000; // in seconds
|
|
6
6
|
exports.SI_BOOTSTRAP_FC_PREFIX = 'si-bootstrap-api';
|
|
7
7
|
exports.SI_BOOTSTRAP_BUCKET_PREFIX = 'si-bootstrap-artifacts';
|
|
8
|
+
exports.SI_LOCALSTACK_SERVER_PORT = 4567;
|