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 1 commit
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
Next Next commit
feat: make biz thresholds configurable
  • Loading branch information
ludomikula committed Jun 18, 2023
commit dae3ee17050d0717156513c72172d365373351c5
63 changes: 37 additions & 26 deletions deploy/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,29 @@ 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` |
| 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` |
| `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` |
| `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 +62,23 @@ 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` |
| 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` |
| `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` |
| `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 +101,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 +123,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` |


5 changes: 5 additions & 0 deletions deploy/docker/docker-compose-multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ services:
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
5 changes: 5 additions & 0 deletions deploy/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ services:
PUID: "1000"
PGID: "1000"
# api-service parameters
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_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
MONGODB_URI: "mongodb://localhost:27017/lowcoder?authSource=admin"
REDIS_URL: "redis://localhost:6379"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,29 @@
import org.lowcoder.sdk.config.dynamic.ConfigCenter;
import org.lowcoder.sdk.config.dynamic.ConfigInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import reactor.core.publisher.Mono;

@Service
public class BizThresholdChecker extends AbstractBizThresholdChecker {

@Value("${default.orgsPerUser:100}")
private int defaultMaxOrgPerUser;

@Value("${default.maxOrgMemberCount:1000}")
private int defaultMaxOrgMemberCount;

@Value("${default.maxOrgGroupCount:100}")
private int defaultMaxOrgGroupCount;

@Value("${default.maxOrgAppCount:1000}")
private int defaultMaxOrgAppCount;

@Value("${default.maxDeveloperCount:100}")
private int defaultMaxDeveloperCount;

@Autowired
private ConfigCenter configCenter;

Expand All @@ -31,14 +47,14 @@ public class BizThresholdChecker extends AbstractBizThresholdChecker {
@PostConstruct
private void init() {
ConfigInstance threshold = configCenter.threshold();
maxOrgPerUser = threshold.ofInteger("maxOrgPerUser", 5);
maxOrgPerUser = threshold.ofInteger("maxOrgPerUser", defaultMaxOrgPerUser);
userOrgCountWhiteList = threshold.ofMap("userOrgCountWhiteList", String.class, Integer.class, Collections.emptyMap());
maxOrgMemberCount = threshold.ofInteger("maxOrgMemberCount", 50);
maxOrgMemberCount = threshold.ofInteger("maxOrgMemberCount", defaultMaxOrgMemberCount);
orgMemberCountWhiteList = threshold.ofMap("orgMemberCountWhiteList", String.class, Integer.class, Collections.emptyMap());
maxOrgGroupCount = threshold.ofInteger("maxOrgGroupCount", 10);
maxOrgAppCount = threshold.ofInteger("maxOrgAppCount", 50);
maxOrgGroupCount = threshold.ofInteger("maxOrgGroupCount", defaultMaxOrgGroupCount);
maxOrgAppCount = threshold.ofInteger("maxOrgAppCount", defaultMaxOrgAppCount);
orgAppCountWhiteList = threshold.ofMap("orgAppCountWhiteList", String.class, Integer.class, Collections.emptyMap());
maxDeveloperCount = threshold.ofInteger("maxDeveloperCount", 50);
maxDeveloperCount = threshold.ofInteger("maxDeveloperCount", defaultMaxDeveloperCount);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ server:
port: 8080
shutdown: graceful

default:
orgs-per-user: 100
org-member-count: 1000
org-group-count: 100
org-app-count: 1000
developer-count: 50

common:
cookie-name: LOCAL_LOWCODER_TOKEN
product: lowcoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ server:
port: 8080
shutdown: graceful

default:
orgs-per-user: 100
org-member-count: 1000
org-group-count: 100
org-app-count: 1000
developer-count: 50

common:
cookie-name: LOWCODER_CE_SELFHOST_TOKEN
product: lowcoder
Expand Down