create-steedos-app 2.4.11 → 2.4.12-beta.1

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.
@@ -0,0 +1,20 @@
1
+ FROM node:14-slim
2
+
3
+ RUN apt-get update || : && apt-get install -y \
4
+ python \
5
+ curl \
6
+ build-essential
7
+
8
+ WORKDIR /app
9
+
10
+ ADD .env .
11
+ ADD lerna.json .
12
+ ADD package.json .
13
+ ADD steedos.config.js .
14
+ ADD steedos-packages .
15
+
16
+ ENV NODE_ENV=production
17
+
18
+ RUN yarn --production
19
+
20
+ CMD ["yarn", "start"]
@@ -1,33 +1,64 @@
1
- This is a [Steedos](https://www.steedos.com/) project bootstrapped with [`create-steedos-app`](https://github.com/steedos/steedos-platform/tree/master/packages/create-steedos-app).
1
+ 华炎魔方模版项目
2
+ ===
2
3
 
3
- ## Getting Started
4
+ <p align="center">
5
+ <a href="./README_en.md">English</a>
6
+ <a href="https://www.steedos.cn/docs/"> · 文档</a>
7
+ <a href="https://www.steedos.cn/videos/"> · 视频</a>
8
+ <a href="https://demo.steedos.cn"> · 试用</a>
9
+ </p>
4
10
 
5
- ### Start mongodb & redis service
11
+
12
+ <p align="center" style="border-top: solid 1px #cccccc">
13
+ 华炎魔方是 <a href="https://developer.salesforce.com/developer-centers/developer-experience" target="_blank">Salesforce Developer Experience (DX)</a> 的开源替代方案,将低代码技术与 <a href="https://www.steedos.cn/docs/deploy/devops"> DevOps 工具</a> 结合,实现敏捷开发的新高度。
14
+ </p>
15
+
16
+ <h3 align="center">
17
+ 🤖 🎨 🚀
18
+ </h3>
19
+
20
+
21
+ # 快速向导
22
+
23
+ ## 启动华炎魔方
24
+
25
+ 开发软件包之前,先启动花华炎魔方服务。
26
+
27
+ 1. 将 .env 复制为 .env.local,并修改相关配置参数。
28
+ 2. 使用 docker 启动华炎魔方。
6
29
 
7
30
  ```bash
8
31
  docker-compose up
9
32
  ```
10
33
 
11
- ### Start steedos service
34
+ ## 访问华炎魔方
12
35
 
13
- ```bash
14
- yarn
15
- yarn start
16
- ```
36
+ 打开浏览器,访问 http://127.0.0.1:5000,进入华炎魔方。
17
37
 
18
- Open [http://localhost:5000](http://localhost:5000) with your browser to see the result.
38
+ 进入设置应用,可以:
39
+ - 创建自定义对象
40
+ - 创建应用
41
+ - 创建微页面
19
42
 
20
- ## Learn More
43
+ ## 开发软件包
21
44
 
22
- To learn more about Steedos Platform, take a look at the following resources:
45
+ 可以使用微服务的方式扩展华炎魔方。可以参考 services 文件夹下的例子。
23
46
 
24
- - [Steedos Documentation](https://www.steedos.com/docs) - learn about Steedos features and API.
25
- - [Steedos Examples](https://github.com/steedos/steedos-examples) - Enjoy our selection of steedos examples to learn from or incorporate into your project.
47
+ ```bash
48
+ yarn
49
+ yarn start
50
+ ```
26
51
 
27
- You can check out [the Steedos GitHub repository](https://github.com/steedos/steedos-platform/) - your feedback and contributions are welcome!
52
+ ## 使用 Node-RED
28
53
 
29
- ## Deploy your project
54
+ [Node-Red](https://nodered.org/) IBM 开源的服务端低代码开发工具,提供了可视化的开发环境,开发华炎魔方微服务。
30
55
 
31
- The easiest way to deploy your Steedos app is to use the [Docker Template](https://github.com/steedos/docker).
56
+ - 创建定时任务
57
+ - 自定义微服务
58
+ - 自定义API
59
+ - 自定义触发器
60
+ - 接收和推送消息
32
61
 
33
- Check out our [Steedos deployment documentation](https://www.steedos.com/docs/deploy/getting-started) for more details.
62
+ ```bash
63
+ yarn nodered
64
+ ```
@@ -2,28 +2,56 @@ version: "3.9"
2
2
 
3
3
  services:
4
4
 
5
+ steedos:
6
+ image: steedos/steedos-community:2.4
7
+ ports:
8
+ - "5000:5000"
9
+ env_file:
10
+ - .env.local
11
+ environment:
12
+ - PORT=5000
13
+ - MONGO_URL=mongodb://mongodb:27017/steedos
14
+ - MONGO_OPLOG_URL=mongodb://mongodb:27017/local
15
+ - TRANSPORTER=nats://nats:4222
16
+ - CACHER=redis://redis:6379
17
+ depends_on:
18
+ mongodb:
19
+ condition: service_healthy
20
+
5
21
  redis:
6
22
  image: redis:6.2
7
- command: "redis-server --save \"\" --appendonly no --loglevel warning"
8
23
  ports:
9
24
  - "6379:6379"
10
25
 
11
26
  mongodb:
12
- image: 'bitnami/mongodb:4.4'
13
- restart: on-failure
27
+ image: mongo:4.4
14
28
  ports:
15
29
  - 27017:27017
16
- environment:
17
- - MONGODB_REPLICA_SET_MODE=primary
18
- - MONGODB_PORT_NUMBER=${MONGODB_PORT_NUMBER:-27017}
19
- - MONGODB_INITIAL_PRIMARY_HOST=${MONGODB_INITIAL_PRIMARY_HOST:-mongodb}
20
- - MONGODB_INITIAL_PRIMARY_PORT_NUMBER=${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}
21
- - MONGODB_REPLICA_SET_NAME=${MONGODB_REPLICA_SET_NAME:-steedos}
22
- - MONGODB_ENABLE_JOURNAL=${MONGODB_ENABLE_JOURNAL:-true}
23
- - MONGODB_ADVERTISED_HOSTNAME=${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
24
- - ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD:-yes}
30
+ entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "steedos" ]
31
+ healthcheck:
32
+ test: echo 'db.runCommand("ping").ok' | mongo --quiet | grep 1
33
+ interval: 10s
34
+ timeout: 10s
35
+ retries: 5
25
36
  volumes:
26
- - 'steedos-mongo-data:/bitnami'
37
+ - 'steedos-mongo-data:/data/db'
38
+
39
+ mongodb-init:
40
+ image: mongo:4.4
41
+ restart: "no"
42
+ depends_on:
43
+ mongodb:
44
+ condition: service_healthy
45
+ command: >
46
+ mongo --host mongodb:27017 --eval "rs.initiate({ _id: 'steedos', members: [{_id: 0, host: 'mongodb:27017'}]})"
47
+
48
+ # Micro Service Transporter
49
+ nats:
50
+ image: bitnami/nats
51
+ ports:
52
+ - "4222:4222"
53
+ - "8222:8222" # monitor port
27
54
 
28
55
  volumes:
29
- steedos-mongo-data:
56
+ steedos-mongo-data:
57
+ driver: local
package/dist/default/env CHANGED
@@ -1,23 +1,44 @@
1
+ # 参考 https://www.steedos.cn/docs/deploy/steedos-config
2
+
1
3
  PORT=5000
2
4
  ROOT_URL=http://127.0.0.1:5000
3
- TRANSPORTER=redis://127.0.0.1:6379
4
- CACHER=redis://127.0.0.1:6379/1
5
+ TRANSPORTER=nats://127.0.0.1:4222
6
+ CACHER=redis://127.0.0.1:6379
5
7
  MONGO_URL=mongodb://127.0.0.1:27017/steedos
6
8
  MONGO_OPLOG_URL=mongodb://127.0.0.1:27017/local
9
+ # NODE_ENV=development
7
10
 
8
- STEEDOS_NODEID=steedos-primary
11
+ # STEEDOS_CFS_STORE=local
12
+ # STEEDOS_STORAGE_DIR=./storage
9
13
 
10
- STEEDOS_CFS_STORE=local
11
- STEEDOS_STORAGE_DIR=./storage
14
+ # 初始安装的软件包
15
+ # STEEDOS_INITIAL_PACKAGES=@steedos-labs/project-ee,@steedos-labs/demo-ee,@steedos-labs/flows
12
16
 
13
17
  # 身份验证
14
- STEEDOS_TENANT_ENABLE_PASSWORD_LOGIN=true
15
- STEEDOS_TENANT_TOKEN_SECRET=change-me
18
+ # STEEDOS_TENANT_ENABLE_PASSWORD_LOGIN=true
19
+ # STEEDOS_TENANT_TOKEN_SECRET=
20
+ # STEEDOS_TENANT_ENABLE_REGISTER=true
21
+
22
+ # VSCode 代码同步
23
+ # METADATA_SERVER=
24
+ # METADATA_APIKEY=
25
+
26
+ # 启用 Steedos ID 统一身份认证。
27
+ # STEEDOS_IDENTITY_OIDC_ENABLED=true
28
+ # STEEDOS_IDENTITY_OIDC_ISSUER=https://id.steedos.cn/realms/master
29
+ # STEEDOS_IDENTITY_OIDC_CONFIG_URL=https://id.steedos.cn/realms/master/.well-known/openid-configuration
30
+ # STEEDOS_IDENTITY_OIDC_CLIENT_ID=steedos-oidc-public
31
+ # STEEDOS_IDENTITY_OIDC_CLIENT_SECRET=none
32
+ # STEEDOS_IDENTITY_OIDC_NAME=Steedos ID
33
+
34
+ # Node-RED 配置
35
+ # NODERED_CREDENTIAL_SECRET=steedos
36
+
37
+ # 配置资产包 CDN 服务的网址
38
+ # STEEDOS_UNPKG_URL=https://unpkg.steedos.cn
16
39
 
17
- # 绑定华炎云账户
18
- STEEDOS_CLOUD_API_KEY=
19
- STEEDOS_CLOUD_SPACE_ID=
40
+ # 配置 Amis 当前引用的版本号
41
+ # STEEDOS_AMIS_VERSION=2.7.2
20
42
 
21
- # vscode 代码同步
22
- METADATA_SERVER=
23
- METADATA_APIKEY=
43
+ # 配置资产包的地址,多个资产包用,隔开
44
+ # STEEDOS_PUBLIC_PAGE_ASSETURLS=https://unpkg.steedos.cn/@steedos-widgets/amis-object@1.1/dist/assets.json
@@ -4,8 +4,6 @@
4
4
 
5
5
  **/node_modules
6
6
 
7
- .npmrc
8
- .yarnrc
9
7
  **/npm-error.log
10
8
  **/yarn-error.log
11
9
  **/lerna-debug.log
@@ -16,5 +14,6 @@ logs
16
14
 
17
15
  .env.local
18
16
  .steedos
17
+ .node-red
19
18
 
20
19
  yarn.lock
@@ -0,0 +1,40 @@
1
+ image: ecr.aws.steedos.cn/dockerhub/steedos/gitpod-workspace-base:2.2.3
2
+
3
+ # List the ports you want to expose and what to do when they are served. See https://www.gitpod.io/docs/config-ports/
4
+ ports:
5
+ - port: 5000
6
+ onOpen: ignore
7
+ visibility: public
8
+ - port: 6379
9
+ onOpen: ignore
10
+ - port: 27017
11
+ onOpen: ignore
12
+ visibility: public
13
+ - port: 4222
14
+ onOpen: ignore
15
+ - port: 8222
16
+ onOpen: ignore
17
+
18
+ # List the start up tasks. You can start them in parallel in multiple terminals. See https://www.gitpod.io/docs/config-start-tasks/
19
+ tasks:
20
+ - name: Docker
21
+ command: |
22
+ echo "ROOT_URL=$(gp url 5000)" >> .env.local
23
+ echo "METADATA_SERVER=$(gp url 5000)" >> .env.local
24
+ yarn
25
+ docker-compose up
26
+ - name: Nodejs Services
27
+ command: |
28
+ gp await-port 5000
29
+ yarn start
30
+ - name: Node-RED
31
+ command: |
32
+ gp await-port 5000
33
+ yarn nodered
34
+
35
+ vscode:
36
+ extensions:
37
+ - redhat.vscode-yaml
38
+ - steedos.steedosdx-vscode
39
+ - steedos.steedosdx-vscode-core
40
+ - ms-ceintl.vscode-language-pack-zh-hans
@@ -0,0 +1,7 @@
1
+ {
2
+ "packages": [
3
+ "services/*"
4
+ ],
5
+ "version": "0.0.1",
6
+ "useNx": false
7
+ }
@@ -0,0 +1,18 @@
1
+ require('dotenv-flow').config({});
2
+
3
+ // Moleculer Configuration
4
+ // https://moleculer.services/docs/0.14/configuration.html
5
+ module.exports = {
6
+ // Namespace of nodes to segment your nodes on the same network.
7
+ namespace: "steedos",
8
+ // Default log level for built-in console logger. It can be overwritten in logger options above.
9
+ // Available values: trace, debug, info, warn, error, fatal
10
+ logLevel: "info",
11
+
12
+ transporter: process.env.TRANSPORTER,
13
+
14
+ // Called after broker started.
15
+ started(broker) {
16
+ },
17
+
18
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ require('dotenv-flow').config({});
3
+ const path = require('path');
4
+ const lodash = require('lodash');
5
+
6
+ // Node-Red Configuration
7
+ // https://nodered.org/docs/user-guide/runtime/configuration
8
+ const appName = process.env.NODE_RED_STORAGE_APP_NAME || 'default'
9
+ module.exports = {
10
+ flowFile: path.join(__dirname,'flows', `${appName}.json`),
11
+ flowFilePretty: true,
12
+ credentialSecret: process.env.NODERED_CREDENTIAL_SECRET || 'steedos',
13
+ nodesDir: path.join(__dirname,'nodes'),
14
+ userDir: path.join(__dirname,'.node-red'),
15
+ functionGlobalContext: {
16
+ _: lodash
17
+ } // enables global context
18
+ };
@@ -0,0 +1 @@
1
+ #registry=https://registry.npmmirror.com
@@ -0,0 +1,22 @@
1
+ module.exports = {
2
+ rest: { method: 'GET', path: '/graphql' },
3
+ // 在微服务中查询数据库
4
+ async handler(ctx) {
5
+ return await this.broker.call('api.graphql', {
6
+ query: `
7
+ query {
8
+ space_users(filters: ["user", "=", "${ctx.meta.user.userId}"]) {
9
+ name
10
+ organization__expand {
11
+ name
12
+ }
13
+ }
14
+ }
15
+ `},
16
+ // 如果查询 GraphQL 需要带上当前用户的权限,需要传入 user 属性。
17
+ {
18
+ user: ctx.meta.user
19
+ }
20
+ )
21
+ },
22
+ }
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ rest: { method: 'GET', path: '/objectql' },
3
+ async handler(ctx) {
4
+ return await this.broker.call(
5
+ 'objectql.find',
6
+ {
7
+ objectName: 'space_users',
8
+ query: {
9
+ filters: ['user', '=', ctx.meta.user.userId]
10
+ },
11
+ },
12
+ // 如果查询需要带上当前用户的权限,需要传入 user 属性。
13
+ {
14
+ user: ctx.meta.user
15
+ }
16
+ );
17
+ }
18
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "my-steedos-service",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "package.service.js",
6
+ "dependencies": {
7
+ }
8
+ }
@@ -0,0 +1,31 @@
1
+ const graphqlQuerySpaceUsers = require('./api/graphqlQuerySpaceUsers');
2
+ const objectqlQuerySpaceUsers = require('./api/objectqlQuerySpaceUsers');
3
+
4
+ const spaceUsersBeforeUpdate = require('./triggers/spaceUsersBeforeUpdate');
5
+
6
+ module.exports = {
7
+ name: "example-service",
8
+
9
+ actions: {
10
+ hello: {
11
+ // 使用微服务方式定义 API 接口。
12
+ // 访问地址: GET /service/api/example-service/hello/:name
13
+ rest: { method: 'GET', path: '/hello/:name' },
14
+ handler(ctx) {
15
+ return {
16
+ data: 'Welcome ' + ctx.params.name
17
+ }
18
+ }
19
+ },
20
+ me: {
21
+ rest: { method: 'GET', path: '/me' },
22
+ // 在微服务中获取当前登录的用户信息
23
+ async handler(ctx) {
24
+ return ctx.meta.user
25
+ }
26
+ },
27
+ graphqlQuerySpaceUsers,
28
+ objectqlQuerySpaceUsers,
29
+ spaceUsersBeforeUpdate
30
+ }
31
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ trigger: { objectName: 'space_users', when: ['before.update']},
3
+ async handler(ctx) {
4
+ this.broker.logger.warn('spaceUsersBeforeUpdate', ctx)
5
+ }
6
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "my-steedos-app",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "package.service.js",
6
+ "dependencies": {
7
+ }
8
+ }
@@ -66,4 +66,4 @@ module.exports = {
66
66
  async stopped() {
67
67
 
68
68
  }
69
- };
69
+ };
@@ -1,3 +1,5 @@
1
+ require('dotenv-flow').config();
2
+
1
3
  module.exports = {
2
4
  // Namespace of nodes to segment your nodes on the same network.
3
5
  namespace: "steedos",
@@ -0,0 +1 @@
1
+ #registry "https://registry.npmmirror.com"
package/dist/gitignore CHANGED
@@ -4,8 +4,6 @@
4
4
 
5
5
  **/node_modules
6
6
 
7
- .npmrc
8
- .yarnrc
9
7
  **/npm-error.log
10
8
  **/yarn-error.log
11
9
  **/lerna-debug.log
@@ -16,5 +14,6 @@ logs
16
14
 
17
15
  .env.local
18
16
  .steedos
17
+ .node-red
19
18
 
20
19
  yarn.lock