create-steedos-app 2.2.52-beta.6 → 2.2.53-beta.2
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.txt +2 -5
- package/README.md +40 -2
- package/dist/create-app.d.ts +10 -0
- package/dist/default/README-template.md +32 -0
- package/dist/default/docker-compose.yml +29 -0
- package/dist/default/env +32 -0
- package/dist/default/gitignore +17 -0
- package/{templates → dist}/default/steedos-app/main/default/client/analytics.baidu.client.js +0 -0
- package/dist/default/steedos-app/package.json +6 -0
- package/{templates → dist}/default/steedos-app/package.service.js +0 -0
- package/dist/default/steedos.config.js +18 -0
- package/dist/gitignore +17 -0
- package/dist/helpers/examples.d.ts +12 -0
- package/dist/helpers/get-pkg-manager.d.ts +2 -0
- package/dist/helpers/git.d.ts +1 -0
- package/dist/helpers/install.d.ts +22 -0
- package/dist/helpers/is-folder-empty.d.ts +1 -0
- package/dist/helpers/is-online.d.ts +1 -0
- package/dist/helpers/is-writeable.d.ts +1 -0
- package/dist/helpers/make-dir.d.ts +3 -0
- package/dist/helpers/validate-pkg.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +385 -0
- package/package.json +35 -22
- package/createSteedosApp.js +0 -127
- package/index.js +0 -19
- package/templates/default/.scripts/env.sh +0 -7
- package/templates/default/.scripts/flush_cacher_db.js +0 -7
- package/templates/default/.scripts/setup.sh +0 -8
- package/templates/default/.scripts/tailscale.sh +0 -7
- package/templates/default/.scripts/tailscaled.sh +0 -6
- package/templates/default/.steedos/_package.json +0 -11
- package/templates/default/.steedos/steedos-packages.yml +0 -30
- package/templates/default/.steedos/yarn.lock +0 -35
- package/templates/default/.vscode/extensions.json +0 -5
- package/templates/default/.vscode/settings.json +0 -17
- package/templates/default/Dockerfile +0 -21
- package/templates/default/Dockerfile-codeserver +0 -37
- package/templates/default/README.md +0 -99
- package/templates/default/_package.json +0 -60
- package/templates/default/docker-compose.yml +0 -59
- package/templates/default/env +0 -35
- package/templates/default/gitignore +0 -35
- package/templates/default/gitpod.Dockerfile +0 -52
- package/templates/default/gitpod.yml +0 -47
- package/templates/default/index.js +0 -0
- package/templates/default/jsreport-app/_package.json +0 -16
- package/templates/default/jsreport-app/jsreport.config.json +0 -43
- package/templates/default/jsreport-app/server.js +0 -14
- package/templates/default/lerna.json +0 -10
- package/templates/default/moleculer.config.js +0 -268
- package/templates/default/node-red-app/LICENSE.txt +0 -706
- package/templates/default/node-red-app/README.md +0 -78
- package/templates/default/node-red-app/_package.json +0 -26
- package/templates/default/node-red-app/index.js +0 -137
- package/templates/default/node-red-app/public/css/simplegrid.css +0 -145
- package/templates/default/node-red-app/public/css/style.css +0 -482
- package/templates/default/node-red-app/public/favicon.ico +0 -0
- package/templates/default/node-red-app/public/first-run.html +0 -280
- package/templates/default/node-red-app/public/fonts/css.css +0 -224
- package/templates/default/node-red-app/public/images/progress-bar.png +0 -0
- package/templates/default/node-red-app/public/images/progress-left.png +0 -0
- package/templates/default/node-red-app/public/images/progress-middle.png +0 -0
- package/templates/default/node-red-app/public/images/progress-o-bar.png +0 -0
- package/templates/default/node-red-app/public/images/progress-o-left.png +0 -0
- package/templates/default/node-red-app/public/images/progress-o-middle.png +0 -0
- package/templates/default/node-red-app/public/images/progress-o-right.png +0 -0
- package/templates/default/node-red-app/public/images/progress-right.png +0 -0
- package/templates/default/node-red-app/public/images/spin.svg +0 -41
- package/templates/default/node-red-app/public/images/title-wave.png +0 -0
- package/templates/default/node-red-app/public/index.html +0 -220
- package/templates/default/node-red-app/public/scripts/jquery-1.11.2.min.js +0 -4
- package/templates/default/node-red-app/public/scripts/zxcvbn.js +0 -28
- package/templates/default/node-red-app/public/steedos.png +0 -0
- package/templates/default/node-red-app/red.js +0 -294
- package/templates/default/node-red-app/routers/health.js +0 -13
- package/templates/default/node-red-app/settings.js +0 -121
- package/templates/default/services/community.service.js +0 -19
- package/templates/default/services/enterprise.service.js +0 -26
- package/templates/default/services/sidecar-server.service.js +0 -7
- package/templates/default/steedos-app/README.md +0 -5
- package/templates/default/steedos-app/_package.json +0 -9
- package/templates/default/steedos-app/tsconfig.json +0 -74
- package/templates/default/steedos-config.yml +0 -95
- package/templates/default/steedos-packages/README.md +0 -1
- package/templates/default/steedos-packages/my-package/README.md +0 -3
- package/templates/default/steedos-packages/my-package/_package.json +0 -9
- package/templates/default/steedos-packages/my-package/main/default/client/analytics.baidu.client.js +0 -24
- package/templates/default/steedos-packages/my-package/package.service.js +0 -69
package/templates/default/env
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
PORT=5000
|
|
2
|
-
ROOT_URL=http://localhost:5000
|
|
3
|
-
TRANSPORTER=redis://127.0.0.1:6379
|
|
4
|
-
CACHER=redis://127.0.0.1:6379/1
|
|
5
|
-
MONGO_URL=mongodb://127.0.0.1:27017/steedos
|
|
6
|
-
# NODE_ENV=production
|
|
7
|
-
APIKEY=
|
|
8
|
-
DING_LOGPATH=
|
|
9
|
-
QYWX_LOGPATH=
|
|
10
|
-
STEEDOS_CFS_STORE=
|
|
11
|
-
STEEDOS_TENANT_CONFIG_ENABLE_REGISTER=
|
|
12
|
-
STEEDOS_PUSH_APN_DATA=
|
|
13
|
-
STEEDOS_PUSH_XINGE_ACCESSID=
|
|
14
|
-
STEEDOS_PUSH_XINGE_SECRETKEY=
|
|
15
|
-
STEEDOS_PUSH_HUAWEI_APPID=
|
|
16
|
-
STEEDOS_PUSH_HUAWEI_APPSECRET=
|
|
17
|
-
STEEDOS_PUSH_HUAWEI_APPPKGNAME=
|
|
18
|
-
STEEDOS_PUSH_MI_APPSECRET=
|
|
19
|
-
STEEDOS_PUSH_MI_PRODUCTION=
|
|
20
|
-
DEVELOPER_STANDARD_OBJECTS=
|
|
21
|
-
DEFAULT_PACKAGE_PATH=
|
|
22
|
-
STEEDOS_CLOUD_LOGO_URL=
|
|
23
|
-
STEEDOS_CLOUD_LOGO_SQUARE_URL=
|
|
24
|
-
STEEDOS_INSTANCES_STAT_SCHEDULE=
|
|
25
|
-
|
|
26
|
-
# saas初始化工作区信息
|
|
27
|
-
STEEDOS_CLOUD_API_KEY=
|
|
28
|
-
STEEDOS_CLOUD_SPACE_ID=
|
|
29
|
-
|
|
30
|
-
METADATA_SERVER=
|
|
31
|
-
METADATA_APIKEY=
|
|
32
|
-
|
|
33
|
-
STEEDOS_PAGE_RENDER=
|
|
34
|
-
STEEDOS_PUBLIC_PAGE_ASSETURLS=https://unpkg.com/@steedos-ui/builder-widgets@1.1.37/dist/assets.json
|
|
35
|
-
STEEDOS_UNPKG_URL=https://npm.elemecdn.com
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
**/.DS_Store
|
|
2
|
-
**/.idea
|
|
3
|
-
yarn.lock
|
|
4
|
-
**/node_modules
|
|
5
|
-
**/package-lock.json
|
|
6
|
-
|
|
7
|
-
**/npm-error.log
|
|
8
|
-
**/yarn-error.log
|
|
9
|
-
**/lerna-debug.log
|
|
10
|
-
|
|
11
|
-
**/lib
|
|
12
|
-
|
|
13
|
-
.DS_Store
|
|
14
|
-
|
|
15
|
-
storage/**
|
|
16
|
-
|
|
17
|
-
.env.local
|
|
18
|
-
|
|
19
|
-
bin/mongodb
|
|
20
|
-
bin/nodejs
|
|
21
|
-
db
|
|
22
|
-
dist
|
|
23
|
-
docker-volumes
|
|
24
|
-
.ossutil_checkpoint
|
|
25
|
-
# steedos-packages/**/**
|
|
26
|
-
!/steedos-packages/*.package
|
|
27
|
-
server.log
|
|
28
|
-
logs
|
|
29
|
-
|
|
30
|
-
.npmrc
|
|
31
|
-
.yarnrc
|
|
32
|
-
|
|
33
|
-
jsreport-app/data/**
|
|
34
|
-
|
|
35
|
-
yarn.lock
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
FROM gitpod/workspace-base:latest
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Install MongoDB ###
|
|
5
|
-
# Source: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu-tarball/#install-mongodb-community-edition
|
|
6
|
-
USER root
|
|
7
|
-
RUN mkdir -p /tmp/mongodb && \
|
|
8
|
-
cd /tmp/mongodb && \
|
|
9
|
-
wget -qOmongodb.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.17.tgz && \
|
|
10
|
-
tar xf mongodb.tgz && \
|
|
11
|
-
cd mongodb-* && \
|
|
12
|
-
sudo cp bin/* /usr/local/bin/ && \
|
|
13
|
-
rm -rf /tmp/mongodb
|
|
14
|
-
|
|
15
|
-
### Install Redis ###
|
|
16
|
-
USER root
|
|
17
|
-
RUN curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg \
|
|
18
|
-
&& echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list \
|
|
19
|
-
&& sudo apt-get update \
|
|
20
|
-
&& apt-get install -y redis
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### Install Docker ###
|
|
24
|
-
LABEL dazzle/layer=tool-docker
|
|
25
|
-
LABEL dazzle/test=tests/tool-docker.yaml
|
|
26
|
-
USER root
|
|
27
|
-
ENV TRIGGER_REBUILD=3
|
|
28
|
-
# https://docs.docker.com/engine/install/ubuntu/
|
|
29
|
-
RUN curl -o /var/lib/apt/dazzle-marks/docker.gpg -fsSL https://download.docker.com/linux/ubuntu/gpg \
|
|
30
|
-
&& apt-key add /var/lib/apt/dazzle-marks/docker.gpg \
|
|
31
|
-
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
|
|
32
|
-
&& install-packages docker-ce docker-ce-cli containerd.io
|
|
33
|
-
|
|
34
|
-
RUN curl -o /usr/bin/slirp4netns -fsSL https://github.com/rootless-containers/slirp4netns/releases/download/v1.1.12/slirp4netns-$(uname -m) \
|
|
35
|
-
&& chmod +x /usr/bin/slirp4netns
|
|
36
|
-
|
|
37
|
-
RUN curl -o /usr/local/bin/docker-compose -fsSL https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64 \
|
|
38
|
-
&& chmod +x /usr/local/bin/docker-compose
|
|
39
|
-
|
|
40
|
-
### Install Nodejs ###
|
|
41
|
-
USER gitpod
|
|
42
|
-
ENV NODE_VERSION=12.22.7
|
|
43
|
-
ENV TRIGGER_REBUILD=2
|
|
44
|
-
RUN curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | PROFILE=/dev/null bash \
|
|
45
|
-
&& bash -c ". .nvm/nvm.sh \
|
|
46
|
-
&& nvm install $NODE_VERSION \
|
|
47
|
-
&& nvm alias default $NODE_VERSION \
|
|
48
|
-
&& npm install -g typescript yarn node-gyp"
|
|
49
|
-
ENV PATH=$PATH:/home/gitpod/.nvm/versions/node/v${NODE_VERSION}/bin
|
|
50
|
-
|
|
51
|
-
### Install Steedos Cli ###
|
|
52
|
-
RUN npm i steedos-cli --global
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
image: ecr.aws.steedos.cn/dockerhub/steedos/gitpod-workspace-base:2.1.1
|
|
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: open-browser
|
|
7
|
-
visibility: public
|
|
8
|
-
- port: 6379
|
|
9
|
-
onOpen: ignore
|
|
10
|
-
- port: 27017
|
|
11
|
-
onOpen: ignore
|
|
12
|
-
- port: 5488 # jsreport-app
|
|
13
|
-
onOpen: open-browser
|
|
14
|
-
visibility: public
|
|
15
|
-
- port: 1880 # node-red-app
|
|
16
|
-
onOpen: open-browser
|
|
17
|
-
visibility: public
|
|
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: MongoDB
|
|
21
|
-
init: sh ./.scripts/setup.sh
|
|
22
|
-
command: |
|
|
23
|
-
mongod --replSet rs0 --bind_ip_all --dbpath /workspace/mongodb/data/db
|
|
24
|
-
- command: |
|
|
25
|
-
gp await-port 27017
|
|
26
|
-
mongo steedos --eval "rs.initiate();conf = rs.conf();conf.members[0].host=\"127.0.0.1\";rs.reconfig(conf, {force:true});"
|
|
27
|
-
exit
|
|
28
|
-
- name: Redis
|
|
29
|
-
command: |
|
|
30
|
-
redis-server --protected-mode no --save "" --appendonly no --client-output-buffer-limit replica 0 0 0 --client-output-buffer-limit pubsub 0 0 0 --client-output-buffer-limit slave 0 0 0
|
|
31
|
-
- name: Steedos
|
|
32
|
-
init: |
|
|
33
|
-
yarn install
|
|
34
|
-
command: |
|
|
35
|
-
sh ./.scripts/env.sh
|
|
36
|
-
gp await-port 27017
|
|
37
|
-
gp await-port 6379
|
|
38
|
-
yarn start
|
|
39
|
-
|
|
40
|
-
vscode:
|
|
41
|
-
extensions:
|
|
42
|
-
- dbaeumer.vscode-eslint
|
|
43
|
-
- redhat.vscode-yaml
|
|
44
|
-
- steedos.steedosdx-vscode
|
|
45
|
-
- steedos.steedosdx-vscode-core
|
|
46
|
-
- ms-ceintl.vscode-language-pack-zh-hans
|
|
47
|
-
- mongodb.mongodb-vscode
|
|
File without changes
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "jsreport-server",
|
|
3
|
-
"main": "server.js",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"start": "node server",
|
|
7
|
-
"jsreport": "jsreport"
|
|
8
|
-
},
|
|
9
|
-
"jsreport": {
|
|
10
|
-
"entryPoint": "server.js"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"jsreport": "^2.11.0"
|
|
14
|
-
},
|
|
15
|
-
"version": "2.1.60"
|
|
16
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"httpPort": 5488,
|
|
3
|
-
"store": {
|
|
4
|
-
"provider": "fs"
|
|
5
|
-
},
|
|
6
|
-
"blobStorage": {
|
|
7
|
-
"provider": "fs"
|
|
8
|
-
},
|
|
9
|
-
"logger": {
|
|
10
|
-
"console": {
|
|
11
|
-
"transport": "console",
|
|
12
|
-
"level": "debug"
|
|
13
|
-
},
|
|
14
|
-
"file": {
|
|
15
|
-
"transport": "file",
|
|
16
|
-
"level": "info",
|
|
17
|
-
"filename": "logs/reporter.log"
|
|
18
|
-
},
|
|
19
|
-
"error": {
|
|
20
|
-
"transport": "file",
|
|
21
|
-
"level": "error",
|
|
22
|
-
"filename": "logs/error.log"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"allowLocalFilesAccess": true,
|
|
26
|
-
"reportTimeout": 60000,
|
|
27
|
-
"workers": {
|
|
28
|
-
"numberOfWorkers": 2
|
|
29
|
-
},
|
|
30
|
-
"extensions": {
|
|
31
|
-
"authentication": {
|
|
32
|
-
"cookieSession": {},
|
|
33
|
-
"admin": {
|
|
34
|
-
"username": "admin",
|
|
35
|
-
"password": "password"
|
|
36
|
-
},
|
|
37
|
-
"enabled": false
|
|
38
|
-
},
|
|
39
|
-
"sample-template": {
|
|
40
|
-
"createSamples": true
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const jsreport = require('jsreport')()
|
|
2
|
-
|
|
3
|
-
if (process.env.JSREPORT_CLI) {
|
|
4
|
-
// export jsreport instance to make it possible to use jsreport-cli
|
|
5
|
-
module.exports = jsreport
|
|
6
|
-
} else {
|
|
7
|
-
jsreport.init().then(() => {
|
|
8
|
-
// running
|
|
9
|
-
}).catch((e) => {
|
|
10
|
-
// error during startup
|
|
11
|
-
console.error(e.stack)
|
|
12
|
-
process.exit(1)
|
|
13
|
-
})
|
|
14
|
-
}
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require('dotenv-flow').config(process.cwd());
|
|
4
|
-
const LokiTransport = require("winston-loki");
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Moleculer ServiceBroker configuration file
|
|
8
|
-
*
|
|
9
|
-
* More info about options:
|
|
10
|
-
* https://moleculer.services/docs/0.14/configuration.html
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Overwriting options in production:
|
|
14
|
-
* ================================
|
|
15
|
-
* You can overwrite any option with environment variables.
|
|
16
|
-
* For example to overwrite the "logLevel" value, use `LOGLEVEL=warn` env var.
|
|
17
|
-
* To overwrite a nested parameter, e.g. retryPolicy.retries, use `RETRYPOLICY_RETRIES=10` env var.
|
|
18
|
-
*
|
|
19
|
-
* To overwrite broker’s deeply nested default options, which are not presented in "moleculer.config.js",
|
|
20
|
-
* use the `MOL_` prefix and double underscore `__` for nested properties in .env file.
|
|
21
|
-
* For example, to set the cacher prefix to `MYCACHE`, you should declare an env var as `MOL_CACHER__OPTIONS__PREFIX=mycache`.
|
|
22
|
-
* It will set this:
|
|
23
|
-
* {
|
|
24
|
-
* cacher: {
|
|
25
|
-
* options: {
|
|
26
|
-
* prefix: "mycache"
|
|
27
|
-
* }
|
|
28
|
-
* }
|
|
29
|
-
* }
|
|
30
|
-
*/
|
|
31
|
-
module.exports = {
|
|
32
|
-
// Namespace of nodes to segment your nodes on the same network.
|
|
33
|
-
namespace: "steedos-project-template",
|
|
34
|
-
// Unique node identifier. Must be unique in a namespace.
|
|
35
|
-
nodeID: process.env.NODEID,
|
|
36
|
-
// Custom metadata store. Store here what you want. Accessing: `this.broker.metadata`
|
|
37
|
-
metadata: {},
|
|
38
|
-
|
|
39
|
-
// Enable/disable logging or use custom logger. More info: https://moleculer.services/docs/0.14/logging.html
|
|
40
|
-
// Available logger types: "Console", "File", "Pino", "Winston", "Bunyan", "debug", "Log4js", "Datadog"
|
|
41
|
-
logger: [{
|
|
42
|
-
type: "Console",
|
|
43
|
-
options: {
|
|
44
|
-
// Using colors on the output
|
|
45
|
-
colors: true,
|
|
46
|
-
// Print module names with different colors (like docker-compose for containers)
|
|
47
|
-
moduleColors: false,
|
|
48
|
-
// Line formatter. It can be "json", "short", "simple", "full", a `Function` or a template string like "{timestamp} {level} {nodeID}/{mod}: {msg}"
|
|
49
|
-
formatter: "full",
|
|
50
|
-
// Custom object printer. If not defined, it uses the `util.inspect` method.
|
|
51
|
-
objectPrinter: null,
|
|
52
|
-
// Auto-padding the module name in order to messages begin at the same column.
|
|
53
|
-
autoPadding: false
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: "File",
|
|
58
|
-
options: {
|
|
59
|
-
// Logging level
|
|
60
|
-
level: "warn",
|
|
61
|
-
// Folder path to save files. You can use {nodeID} & {namespace} variables.
|
|
62
|
-
folder: "./logs",
|
|
63
|
-
// Filename template. You can use {date}, {nodeID} & {namespace} variables.
|
|
64
|
-
filename: "{nodeID}-{date}.log",
|
|
65
|
-
// Line formatter. It can be "json", "short", "simple", "full", a `Function` or a template string like "{timestamp} {level} {nodeID}/{mod}: {msg}"
|
|
66
|
-
formatter: "json",
|
|
67
|
-
// Custom object printer. If not defined, it uses the `util.inspect` method.
|
|
68
|
-
objectPrinter: null,
|
|
69
|
-
// End of line. Default values comes from the OS settings.
|
|
70
|
-
eol: "\n",
|
|
71
|
-
// File appending interval in milliseconds.
|
|
72
|
-
interval: 1 * 1000
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
process.env.LOKI_URL && {
|
|
76
|
-
type: "Winston",
|
|
77
|
-
options: {
|
|
78
|
-
// Logging level
|
|
79
|
-
level: "info",
|
|
80
|
-
// Folder path to save files. You can use {nodeID} & {namespace} variables.
|
|
81
|
-
winston: {
|
|
82
|
-
// More settings: https://github.com/winstonjs/winston#creating-your-own-logger
|
|
83
|
-
transports: [
|
|
84
|
-
new LokiTransport({
|
|
85
|
-
host: process.env.LOKI_URL,
|
|
86
|
-
labels: { project: 'pcmes' }
|
|
87
|
-
})
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
|
|
94
|
-
// Default log level for built-in console logger. It can be overwritten in logger options above.
|
|
95
|
-
// Available values: trace, debug, info, warn, error, fatal
|
|
96
|
-
logLevel: "warn",
|
|
97
|
-
|
|
98
|
-
// Define transporter.
|
|
99
|
-
// More info: https://moleculer.services/docs/0.14/networking.html
|
|
100
|
-
// Note: During the development, you don't need to define it because all services will be loaded locally.
|
|
101
|
-
// In production you can set it via `TRANSPORTER=nats://localhost:4222` environment variable.
|
|
102
|
-
transporter: process.env.TRANSPORTER, //process.env.STEEDOS_TRANSPORTER,
|
|
103
|
-
|
|
104
|
-
// Define a cacher.
|
|
105
|
-
// More info: https://moleculer.services/docs/0.14/caching.html
|
|
106
|
-
|
|
107
|
-
// Define a serializer.
|
|
108
|
-
// Available values: "JSON", "Avro", "ProtoBuf", "MsgPack", "Notepack", "Thrift".
|
|
109
|
-
// More info: https://moleculer.services/docs/0.14/networking.html#Serialization
|
|
110
|
-
serializer: "JSON",
|
|
111
|
-
|
|
112
|
-
// Number of milliseconds to wait before reject a request with a RequestTimeout error. Disabled: 0
|
|
113
|
-
requestTimeout: 0,
|
|
114
|
-
|
|
115
|
-
// Retry policy settings. More info: https://moleculer.services/docs/0.14/fault-tolerance.html#Retry
|
|
116
|
-
retryPolicy: {
|
|
117
|
-
// Enable feature
|
|
118
|
-
enabled: false,
|
|
119
|
-
// Count of retries
|
|
120
|
-
retries: 5,
|
|
121
|
-
// First delay in milliseconds.
|
|
122
|
-
delay: 100,
|
|
123
|
-
// Maximum delay in milliseconds.
|
|
124
|
-
maxDelay: 1000,
|
|
125
|
-
// Backoff factor for delay. 2 means exponential backoff.
|
|
126
|
-
factor: 2,
|
|
127
|
-
// A function to check failed requests.
|
|
128
|
-
check: err => err && !!err.retryable
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
// Limit of calling level. If it reaches the limit, broker will throw an MaxCallLevelError error. (Infinite loop protection)
|
|
132
|
-
maxCallLevel: 100,
|
|
133
|
-
|
|
134
|
-
// Number of seconds to send heartbeat packet to other nodes.
|
|
135
|
-
heartbeatInterval: 10,
|
|
136
|
-
// Number of seconds to wait before setting node to unavailable status.
|
|
137
|
-
heartbeatTimeout: 30,
|
|
138
|
-
|
|
139
|
-
// Cloning the params of context if enabled. High performance impact, use it with caution!
|
|
140
|
-
contextParamsCloning: false,
|
|
141
|
-
|
|
142
|
-
// Tracking requests and waiting for running requests before shuting down. More info: https://moleculer.services/docs/0.14/context.html#Context-tracking
|
|
143
|
-
tracking: {
|
|
144
|
-
// Enable feature
|
|
145
|
-
enabled: false,
|
|
146
|
-
// Number of milliseconds to wait before shuting down the process.
|
|
147
|
-
shutdownTimeout: 5000,
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
// Disable built-in request & emit balancer. (Transporter must support it, as well.). More info: https://moleculer.services/docs/0.14/networking.html#Disabled-balancer
|
|
151
|
-
disableBalancer: false,
|
|
152
|
-
|
|
153
|
-
// Settings of Service Registry. More info: https://moleculer.services/docs/0.14/registry.html
|
|
154
|
-
registry: {
|
|
155
|
-
// Define balancing strategy. More info: https://moleculer.services/docs/0.14/balancing.html
|
|
156
|
-
// Available values: "RoundRobin", "Random", "CpuUsage", "Latency", "Shard"
|
|
157
|
-
strategy: "RoundRobin",
|
|
158
|
-
// Enable local action call preferring. Always call the local action instance if available.
|
|
159
|
-
preferLocal: true
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
// Settings of Circuit Breaker. More info: https://moleculer.services/docs/0.14/fault-tolerance.html#Circuit-Breaker
|
|
163
|
-
circuitBreaker: {
|
|
164
|
-
// Enable feature
|
|
165
|
-
enabled: false,
|
|
166
|
-
// Threshold value. 0.5 means that 50% should be failed for tripping.
|
|
167
|
-
threshold: 0.5,
|
|
168
|
-
// Minimum request count. Below it, CB does not trip.
|
|
169
|
-
minRequestCount: 20,
|
|
170
|
-
// Number of seconds for time window.
|
|
171
|
-
windowTime: 60,
|
|
172
|
-
// Number of milliseconds to switch from open to half-open state
|
|
173
|
-
halfOpenTime: 10 * 1000,
|
|
174
|
-
// A function to check failed requests.
|
|
175
|
-
check: err => err && err.code >= 500
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
// Settings of bulkhead feature. More info: https://moleculer.services/docs/0.14/fault-tolerance.html#Bulkhead
|
|
179
|
-
bulkhead: {
|
|
180
|
-
// Enable feature.
|
|
181
|
-
enabled: false,
|
|
182
|
-
// Maximum concurrent executions.
|
|
183
|
-
concurrency: 10,
|
|
184
|
-
// Maximum size of queue
|
|
185
|
-
maxQueueSize: 100,
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
// Enable action & event parameter validation. More info: https://moleculer.services/docs/0.14/validating.html
|
|
189
|
-
validator: true,
|
|
190
|
-
|
|
191
|
-
errorHandler: null,
|
|
192
|
-
|
|
193
|
-
// Enable/disable built-in metrics function. More info: https://moleculer.services/docs/0.14/metrics.html
|
|
194
|
-
metrics: {
|
|
195
|
-
enabled: false,
|
|
196
|
-
// Available built-in reporters: "Console", "CSV", "Event", "Prometheus", "Datadog", "StatsD"
|
|
197
|
-
reporter: {
|
|
198
|
-
type: "Prometheus",
|
|
199
|
-
options: {
|
|
200
|
-
// HTTP port
|
|
201
|
-
port: 3030,
|
|
202
|
-
// HTTP URL path
|
|
203
|
-
path: "/metrics",
|
|
204
|
-
// Default labels which are appended to all metrics labels
|
|
205
|
-
defaultLabels: registry => ({
|
|
206
|
-
namespace: registry.broker.namespace,
|
|
207
|
-
nodeID: registry.broker.nodeID
|
|
208
|
-
})
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
// Enable built-in tracing function. More info: https://moleculer.services/docs/0.14/tracing.html
|
|
214
|
-
tracing: {
|
|
215
|
-
enabled: false,
|
|
216
|
-
// Available built-in exporters: "Console", "Datadog", "Event", "EventLegacy", "Jaeger", "Zipkin"
|
|
217
|
-
exporter: {
|
|
218
|
-
type: "Console", // Console exporter is only for development!
|
|
219
|
-
options: {
|
|
220
|
-
// Custom logger
|
|
221
|
-
logger: null,
|
|
222
|
-
// Using colors
|
|
223
|
-
colors: true,
|
|
224
|
-
// Width of row
|
|
225
|
-
width: 100,
|
|
226
|
-
// Gauge width in the row
|
|
227
|
-
gaugeWidth: 40
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
// Register custom middlewares
|
|
233
|
-
middlewares: [],
|
|
234
|
-
|
|
235
|
-
// Register custom REPL commands.
|
|
236
|
-
replCommands: null,
|
|
237
|
-
|
|
238
|
-
// Called after broker created.
|
|
239
|
-
async created(broker) {
|
|
240
|
-
const MongoDBService = require('@steedos/service-mongodb-server');
|
|
241
|
-
const path = require('path');
|
|
242
|
-
let mongodbServerConfig = {
|
|
243
|
-
enabled: !process.env.MONGO_URL,
|
|
244
|
-
debug: true,
|
|
245
|
-
port: process.env.MONGO_PORT || 27018,
|
|
246
|
-
dbPath: process.env.MONGO_DBPATH || path.join(process.cwd(), 'db'),
|
|
247
|
-
};
|
|
248
|
-
if (mongodbServerConfig && mongodbServerConfig.enabled) {
|
|
249
|
-
let mongodbService = broker.createService({
|
|
250
|
-
name: "mongodb-server",
|
|
251
|
-
mixins: [MongoDBService],
|
|
252
|
-
settings: mongodbServerConfig
|
|
253
|
-
});
|
|
254
|
-
await mongodbService.startMongo();
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
// Called after broker started.
|
|
259
|
-
async started(broker) {
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
// Called after broker stopped.
|
|
264
|
-
async stopped(broker) {
|
|
265
|
-
|
|
266
|
-
},
|
|
267
|
-
skipProcessEventRegistration: true
|
|
268
|
-
};
|