Skip to content

Feat/usability updates #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"description": "The domains supported for CORS requests. All domains are allowed by default. If there are multiple domains, please separate them with commas.",
"required": false
},
"MONGODB_URI": {
"description": "Your Mongo Database URI.",
"MONGODB_URL": {
"description": "Your Mongo Database URL.",
"required": false
},
"REDIS_URL": {
Expand Down
65 changes: 37 additions & 28 deletions deploy/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,28 @@ DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcod

Image can be configured by setting environment variables.

| Environment variable | Description | Value |
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- |
| `REDIS_ENABLED` | If **true** redis server is started in the container | `true` |
| `MONGODB_ENABLED` | If **true** mongo database is started in the container | `true` |
| `API_SERVICE_ENABLED` | If **true** lowcoder api-service is started in the container | `true` |
| `NODE_SERVICE_ENABLED` | If **true** lowcoder node-service is started in the container | `true` |
| `FRONTEND_ENABLED` | If **true** lowcoder web frontend is started in the container | `true` |
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
| `PGID` | ID of group of the user running services. | `9001` |
| `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
| `REDIS_URL` | Redis server URL | `redis://localhost:6379` |
| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` |
| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` |
| Environment variable | Description | Value |
| --------------------------------| --------------------------------------------------------------------| ----------------------------------------------------- |
| `REDIS_ENABLED` | If **true** redis server is started in the container | `true` |
| `MONGODB_ENABLED` | If **true** mongo database is started in the container | `true` |
| `API_SERVICE_ENABLED` | If **true** lowcoder api-service is started in the container | `true` |
| `NODE_SERVICE_ENABLED` | If **true** lowcoder node-service is started in the container | `true` |
| `FRONTEND_ENABLED` | If **true** lowcoder web frontend is started in the container | `true` |
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
| `PGID` | ID of group of the user running services. | `9001` |
| `MONGODB_URL` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
| `REDIS_URL` | Redis server URL | `redis://localhost:6379` |
| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` |
| `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` |
| `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
| `DEFAULT_ORGS_PER_USER` | Default maximum organizations per user | `100` |
| `DEFAULT_ORG_MEMBER_COUNT` | Default maximum members per organization | `1000` |
| `DEFAULT_ORG_GROUP_COUNT` | Default maximum groups per organization | `100` |
| `DEFAULT_ORG_APP_COUNT` | Default maximum applications per organization | `1000` |
| `DEFAULT_DEVELOPER_COUNT` | Default maximum developers | `100` |


## Building api-service image
Expand All @@ -57,17 +61,22 @@ DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcod

Image can be configured by setting environment variables.

| Environment variable | Description | Value |
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- |
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
| `PGID` | ID of group of the user running services. | `9001` |
| `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
| `REDIS_URL` | Redis server URL | `redis://localhost:6379` |
| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` |
| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` |
| Environment variable | Description | Value |
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------|
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
| `PGID` | ID of group of the user running services. | `9001` |
| `MONGODB_URL` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
| `REDIS_URL` | Redis server URL | `redis://localhost:6379` |
| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` |
| `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` |
| `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
| `DEFAULT_ORGS_PER_USER` | Default maximum organizations per user | `100` |
| `DEFAULT_ORG_MEMBER_COUNT` | Default maximum members per organization | `1000` |
| `DEFAULT_ORG_GROUP_COUNT` | Default maximum groups per organization | `100` |
| `DEFAULT_ORG_APP_COUNT` | Default maximum applications per organization | `1000` |
| `DEFAULT_DEVELOPER_COUNT` | Default maximum developers | `100` |



## Building node-service image
Expand All @@ -90,7 +99,7 @@ Image can be configured by setting environment variables.
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- |
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
| `PGID` | ID of group of the user running services. | `9001` |
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |

## Building web frontend image

Expand All @@ -112,7 +121,7 @@ Image can be configured by setting environment variables.
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- |
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
| `PGID` | ID of group of the user running services. | `9001` |
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |


9 changes: 7 additions & 2 deletions deploy/docker/docker-compose-multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@ services:
environment:
PUID: "9001"
PGID: "9001"
MONGODB_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
REDIS_URL: "redis://redis:6379"
JS_EXECUTOR_URI: "http://lowcoder-node-service:6060"
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
ENABLE_USER_SIGN_UP: "true"
ENCRYPTION_PASSWORD: "lowcoder.org"
ENCRYPTION_SALT: "lowcoder.org"
CORS_ALLOWED_DOMAINS: "*"
DEFAULT_ORGS_PER_USER: 100
DEFAULT_ORG_MEMBER_COUNT: 1000
DEFAULT_ORG_GROUP_COUNT: 100
DEFAULT_ORG_APP_COUNT: 1000
DEFAULT_DEVELOPER_COUNT: 50
restart: unless-stopped
depends_on:
- mongodb
Expand Down
10 changes: 7 additions & 3 deletions deploy/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ services:
PUID: "1000"
PGID: "1000"
# api-service parameters
#MONGODB_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
MONGODB_URI: "mongodb://localhost:27017/lowcoder?authSource=admin"
DEFAULT_ORGS_PER_USER: 100
DEFAULT_ORG_MEMBER_COUNT: 1000
DEFAULT_ORG_GROUP_COUNT: 100
DEFAULT_ORG_APP_COUNT: 1000
DEFAULT_DEVELOPER_COUNT: 50
#MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
MONGODB_URL: "mongodb://localhost:27017/lowcoder?authSource=admin"
REDIS_URL: "redis://localhost:6379"
JS_EXECUTOR_URI: "http://localhost:6060"
ENABLE_USER_SIGN_UP: "true"
ENCRYPTION_PASSWORD: "lowcoder.org"
ENCRYPTION_SALT: "lowcoder.org"
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/templates/api-service/configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ data:
REDIS_URL: {{- .Values.redis.externalUrl | quote }}
{{- end }}
{{- if .Values.apiService.nodeServiceUrl }}
JS_EXECUTOR_URI: {{ .Values.apiService.nodeServiceUrl | quote }}
LOWCODER_NODE_SERVICE_URL: {{ .Values.apiService.nodeServiceUrl | quote }}
{{- else }}
JS_EXECUTOR_URI: "http://{{ $name }}-node-service:{{ .Values.nodeService.service.port }}"
LOWCODER_NODE_SERVICE_URL: "http://{{ $name }}-node-service:{{ .Values.nodeService.service.port }}"
{{- end }}
PUID: {{ .Values.apiService.config.userId | default "9001" | quote }}
PGID: {{ .Values.apiService.config.groupId | default "9001" | quote }}
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/templates/api-service/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ metadata:
{{- end }}
stringData:
{{- if .Values.mongodb.enabled }}
MONGODB_URI: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
{{- else }}
MONGODB_URI: {{- .Values.mongodb.externalUrl | quote }}
MONGODB_URL: {{- .Values.mongodb.externalUrl | quote }}
{{- end }}
ENCRYPTION_PASSWORD: {{ .Values.apiService.config.encryption.password | default "lowcoder.org" | quote }}
ENCRYPTION_SALT: {{ .Values.apiService.config.encryption.salt | default "lowcoder.org" | quote }}
Expand Down
10 changes: 5 additions & 5 deletions docs/self-hosting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ For developers who require stateless containers in a cluster environment, we off

<figure><img src="../.gitbook/assets/docker-compose-multi.jpeg" alt=""><figcaption></figcaption></figure>

* **mongodb**: Start a new MongoDB instance on your host. You can delete this part and modify the environment variable `MONGODB_URI` of **openblocks-api-service** to use your own MongoDB.
* **redis**: Start a new Redis instance on your host. You can delete this part and modify the environment variable `REDIS_URI` of **openblocks-api-service** to use your own Redis.
* **mongodb**: Start a new MongoDB instance on your host. You can delete this part and modify the environment variable `MONGODB_URL` of **openblocks-api-service** to use your own MongoDB.
* **redis**: Start a new Redis instance on your host. You can delete this part and modify the environment variable `REDIS_URL` of **openblocks-api-service** to use your own Redis.
* **openblocks-api-service**: Required.&#x20;
* **openblocks-node-service**: Required.
* **openblocks-frontend**: Required. Can be optional if you deploy frontend on CDN.
Expand Down Expand Up @@ -199,16 +199,16 @@ By default Lowcoder uses the built-in MongoDB and Redis installed inside the con

{% tabs %}
{% tab title="Docker-Compose" %}
Add environment variables `MONGODB_URI` and `REDIS_URI` in `docker-compose.yml` downloaded in your working directory.\
Add environment variables `MONGODB_URL` and `REDIS_URL` in `docker-compose.yml` downloaded in your working directory.\
<img src="../.gitbook/assets/mongodb-redis-uri.png" alt="" data-size="original">
{% endtab %}

{% tab title="Docker" %}
Add environment variables `MONGODB_URI` and `REDIS_URI` to the deployment command, as shown below:
Add environment variables `MONGODB_URL` and `REDIS_URL` to the deployment command, as shown below:

{% code overflow="wrap" %}
```bash
docker run -d --name openblocks -e MONGODB_URI=YOUR_MONGODB_URI REDIS_URI=YOUR_REDIS_URI -p 3000:3000 -v "$PWD/stacks:/openblocks-stacks lowcoderorg/lowcoder-ce
docker run -d --name openblocks -e MONGODB_URL=YOUR_MONGODB_URL REDIS_URL=YOUR_REDIS_URL -p 3000:3000 -v "$PWD/stacks:/openblocks-stacks lowcoderorg/lowcoder-ce
```
{% endcode %}
{% endtab %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Mono<QueryExecutionResult> executeQuery(Datasource datasource, Map<String

return Mono.defer(() -> {
if (datasourceMetaInfoService.isJsDatasourcePlugin(datasource.getType())) {
return executeByNodeJs(datasource, queryConfig, requestParams);
return executeByNodeJs(datasource, queryConfig, requestParams, queryVisitorContext);
}
return executeLocally(datasource, queryConfig, requestParams, queryVisitorContext);
})
Expand Down Expand Up @@ -77,11 +77,19 @@ private Mono<QueryExecutionResult> executeLocally(Datasource datasource, Map<Str
});
}

private Mono<QueryExecutionResult> executeByNodeJs(Datasource datasource, Map<String, Object> queryConfig, Map<String, Object> requestParams) {
private Mono<QueryExecutionResult> executeByNodeJs(Datasource datasource, Map<String, Object> queryConfig, Map<String, Object> requestParams, QueryVisitorContext queryVisitorContext) {
List<Map<String, Object>> context = requestParams.entrySet()
.stream()
.map(entry -> Map.of("key", entry.getKey(), "value", entry.getValue()))
.collect(Collectors.toList());

//forward cookies to js datasource
List<Map<String, Object>> cookies = queryVisitorContext.getCookies().entrySet()
.stream()
.map(entry -> Map.of("key", entry.getKey(), "value", entry.getValue()))
.collect(Collectors.toList());
context.addAll(cookies);

return datasourcePluginClient.executeQuery(datasource.getType(), queryConfig, context, datasource.getDetailConfig());
}
}
Loading