Skip to content

Commit 0cbfa44

Browse files
authored
Merge pull request #75 from devsapp/zechen-dev
add start-egg-container template
2 parents 14d3d67 + 4af2a4e commit 0cbfa44

File tree

24 files changed

+654
-1
lines changed

24 files changed

+654
-1
lines changed

update.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web-framework/nodejs/egg
1+
web-framework/nodejs/egg-container
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
async function preInit(inputObj) {
2+
console.log(`
3+
Serverless Devs Application Case
4+
5+
Cloud services required:
6+
- FC : https://fc.console.aliyun.com/
7+
8+
Tips:
9+
- FC Component: https://www.serverless-devs.com/fc/readme`)
10+
11+
}
12+
13+
async function postInit(inputObj) {
14+
console.log(`
15+
* Before using, please check whether the actions command in Yaml file is available
16+
* Carefully reading the notes in s.yaml is helpful for the use of the tool
17+
* If need help in the use process, please apply to join the Dingtalk Group: 33947367
18+
`)
19+
}
20+
21+
module.exports = {
22+
postInit,
23+
preInit
24+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Type: Application
2+
Name: start-egg-container
3+
Provider:
4+
- 阿里云
5+
Version: 0.0.1
6+
Description: 为企业级框架和应用而生(部署到 Custom Container 运行时)
7+
HomePage: https://github.com/devsapp/start-web-framework
8+
Tags:
9+
- Web框架
10+
- Egg
11+
Category: Web框架
12+
Service:
13+
函数计算:
14+
Authorities:
15+
- AliyunFCFullAccess
16+
Parameters:
17+
type: object
18+
additionalProperties: false # 不允许增加其他属性
19+
required: # 必填项
20+
- region
21+
- serviceName
22+
- functionName
23+
- acrRegistry
24+
properties:
25+
region:
26+
title: 地域
27+
type: string
28+
default: cn-hangzhou
29+
description: 创建应用所在的地区
30+
enum:
31+
- cn-beijing
32+
- cn-hangzhou
33+
- cn-shanghai
34+
- cn-qingdao
35+
- cn-zhangjiakou
36+
- cn-huhehaote
37+
- cn-shenzhen
38+
- cn-chengdu
39+
- cn-hongkong
40+
- ap-southeast-1
41+
- ap-southeast-2
42+
- ap-southeast-3
43+
- ap-southeast-5
44+
- ap-northeast-1
45+
- eu-central-1
46+
- eu-west-1
47+
- us-west-1
48+
- us-east-1
49+
- ap-south-1
50+
serviceName:
51+
title: 服务名
52+
type: string
53+
default: web-framework-${default-suffix}
54+
pattern: "^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$"
55+
description: 服务名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-128 之间
56+
functionName:
57+
title: 函数名
58+
type: string
59+
default: egg
60+
description: 函数名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-64 之间
61+
acrRegistry:
62+
title: 镜像仓库
63+
type: string
64+
default: 'registry.<region>.aliyuncs.com/<namespace>/<repo>:v0.1'
65+
examples: ['registry.cn-hangzhou.aliyuncs.com/fc-demo/custom-cpp-event-function:v0.1']
66+
description: 镜像仓库地址,需要在 https://cr.console.aliyun.com/ 中开通服务、创建仓库以及设置访问凭证
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# start-egg 帮助文档
2+
3+
<p align="center" class="flex justify-center">
4+
<a href="https://www.serverless-devs.com" class="ml-1">
5+
<img src="http://editor.devsapp.cn/icon?package=start-egg&type=packageType">
6+
</a>
7+
<a href="http://www.devsapp.cn/details.html?name=start-egg" class="ml-1">
8+
<img src="http://editor.devsapp.cn/icon?package=start-egg&type=packageVersion">
9+
</a>
10+
<a href="http://www.devsapp.cn/details.html?name=start-egg" class="ml-1">
11+
<img src="http://editor.devsapp.cn/icon?package=start-egg&type=packageDownload">
12+
</a>
13+
</p>
14+
15+
<description>
16+
17+
为企业级框架和应用而生(部署到Custom运行时)
18+
19+
</description>
20+
21+
<table>
22+
23+
## 前期准备
24+
使用该项目,推荐您拥有以下的产品权限 / 策略:
25+
26+
| 服务/业务 | 函数计算 |
27+
| --- | --- |
28+
| 权限/策略 | AliyunFCFullAccess |
29+
30+
</table>
31+
32+
<codepre id="codepre">
33+
34+
# 代码 & 预览
35+
36+
- [ :smiley_cat: 源代码](https://github.com/devsapp/start-web-framework/blob/master/web-framework/nodejs/egg)
37+
38+
</codepre>
39+
40+
<deploy>
41+
42+
## 部署 & 体验
43+
44+
<appcenter>
45+
46+
- :fire: 通过 [Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=start-egg)
47+
[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://fcnext.console.aliyun.com/applications/create?template=start-egg) 该应用。
48+
49+
</appcenter>
50+
51+
- 通过 [Serverless Devs Cli](https://www.serverless-devs.com/serverless-devs/install) 进行部署:
52+
- [安装 Serverless Devs Cli 开发者工具](https://www.serverless-devs.com/serverless-devs/install) ,并进行[授权信息配置](https://www.serverless-devs.com/fc/config)
53+
- 初始化项目:`s init start-egg -d start-egg`
54+
- 进入项目,并进行项目部署:`cd start-egg && s deploy -y`
55+
56+
</deploy>
57+
58+
<appdetail id="flushContent">
59+
60+
# 应用详情
61+
62+
63+
本应用仅作为学习和参考使用,您可以基于本项目进行二次开发和完善,实现自己的业务逻辑
64+
65+
66+
</appdetail>
67+
68+
<devgroup>
69+
70+
## 开发者社区
71+
72+
您如果有关于错误的反馈或者未来的期待,您可以在 [Serverless Devs repo Issues](https://github.com/serverless-devs/serverless-devs/issues) 中进行反馈和交流。如果您想要加入我们的讨论组或者了解 FC 组件的最新动态,您可以通过以下渠道进行:
73+
74+
<p align="center">
75+
76+
| <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407298906_20211028074819117230.png" width="130px" > | <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407044136_20211028074404326599.png" width="130px" > | <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407252200_20211028074732517533.png" width="130px" > |
77+
|--- | --- | --- |
78+
| <center>微信公众号:`serverless`</center> | <center>微信小助手:`xiaojiangwh`</center> | <center>钉钉交流群:`33947367`</center> |
79+
80+
</p>
81+
82+
</devgroup>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
module.exports = {
4+
write: true,
5+
prefix: '^',
6+
plugin: 'autod-egg',
7+
test: [
8+
'test',
9+
'benchmark',
10+
],
11+
dep: [
12+
'egg',
13+
'egg-scripts',
14+
],
15+
devdep: [
16+
'egg-ci',
17+
'egg-bin',
18+
'egg-mock',
19+
'autod',
20+
'autod-egg',
21+
'eslint',
22+
'eslint-config-egg',
23+
],
24+
exclude: [
25+
'./test/fixtures',
26+
'./dist',
27+
],
28+
};
29+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.s
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
language: node_js
3+
node_js:
4+
- '10'
5+
before_install:
6+
- npm i npminstall -g
7+
install:
8+
- npminstall
9+
script:
10+
- npm run ci
11+
after_script:
12+
- npminstall codecov && codecov
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM node:16.15
2+
3+
WORKDIR /workspace
4+
COPY . .
5+
RUN npm install --production --registry=https://registry.npmmirror.com
6+
7+
EXPOSE 9000
8+
ENTRYPOINT [ "node", "server.js" ]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
const Controller = require('egg').Controller;
4+
5+
class HomeController extends Controller {
6+
async index() {
7+
const { ctx } = this;
8+
await ctx.render('home.nj', {});
9+
}
10+
}
11+
12+
module.exports = HomeController;

0 commit comments

Comments
 (0)