Skip to content

Commit 03d7605

Browse files
committed
feat: make biz thresholds configurable
1 parent 86b990b commit 03d7605

File tree

6 files changed

+82
-31
lines changed

6 files changed

+82
-31
lines changed

‎deploy/docker/README.md

+37-26
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,29 @@ DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcod
2121

2222
Image can be configured by setting environment variables.
2323

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

4348

4449
## Building api-service image
@@ -57,17 +62,23 @@ DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcod
5762

5863
Image can be configured by setting environment variables.
5964

60-
| Environment variable | Description | Value |
61-
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- |
62-
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
63-
| `PGID` | ID of group of the user running services. | `9001` |
65+
| Environment variable | Description | Value |
66+
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------|
67+
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
68+
| `PGID` | ID of group of the user running services. | `9001` |
6469
| `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
65-
| `REDIS_URL` | Redis server URL | `redis://localhost:6379` |
66-
| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` |
67-
| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` |
70+
| `REDIS_URL` | Redis server URL | `redis://localhost:6379` |
71+
| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` |
72+
| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` |
6873
| `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` |
6974
| `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
70-
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
75+
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
76+
| `DEFAULT_ORGS_PER_USER` | Default maximum organizations per user | `100` |
77+
| `DEFAULT_ORG_MEMBER_COUNT` | Default maximum members per organization | `1000` |
78+
| `DEFAULT_ORG_GROUP_COUNT` | Default maximum groups per organization | `100` |
79+
| `DEFAULT_ORG_APP_COUNT` | Default maximum applications per organization | `1000` |
80+
| `DEFAULT_DEVELOPER_COUNT` | Default maximum developers | `100` |
81+
7182

7283

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

95106
## Building web frontend image
96107

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

118129

‎deploy/docker/docker-compose-multi.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ services:
4040
ENCRYPTION_PASSWORD: "lowcoder.org"
4141
ENCRYPTION_SALT: "lowcoder.org"
4242
CORS_ALLOWED_DOMAINS: "*"
43+
DEFAULT_ORGS_PER_USER: 100
44+
DEFAULT_ORG_MEMBER_COUNT: 1000
45+
DEFAULT_ORG_GROUP_COUNT: 100
46+
DEFAULT_ORG_APP_COUNT: 1000
47+
DEFAULT_DEVELOPER_COUNT: 50
4348
restart: unless-stopped
4449
depends_on:
4550
- mongodb

‎deploy/docker/docker-compose.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ services:
2020
PUID: "1000"
2121
PGID: "1000"
2222
# api-service parameters
23+
DEFAULT_ORGS_PER_USER: 100
24+
DEFAULT_ORG_MEMBER_COUNT: 1000
25+
DEFAULT_ORG_GROUP_COUNT: 100
26+
DEFAULT_ORG_APP_COUNT: 1000
27+
DEFAULT_DEVELOPER_COUNT: 50
2328
#MONGODB_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
2429
MONGODB_URI: "mongodb://localhost:27017/lowcoder?authSource=admin"
2530
REDIS_URL: "redis://localhost:6379"

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/bizthreshold/BizThresholdChecker.java

+21-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,29 @@
99
import org.lowcoder.sdk.config.dynamic.ConfigCenter;
1010
import org.lowcoder.sdk.config.dynamic.ConfigInstance;
1111
import org.springframework.beans.factory.annotation.Autowired;
12+
import org.springframework.beans.factory.annotation.Value;
1213
import org.springframework.stereotype.Service;
1314

1415
import reactor.core.publisher.Mono;
1516

1617
@Service
1718
public class BizThresholdChecker extends AbstractBizThresholdChecker {
1819

20+
@Value("${default.orgsPerUser:100}")
21+
private int defaultMaxOrgPerUser;
22+
23+
@Value("${default.maxOrgMemberCount:1000}")
24+
private int defaultMaxOrgMemberCount;
25+
26+
@Value("${default.maxOrgGroupCount:100}")
27+
private int defaultMaxOrgGroupCount;
28+
29+
@Value("${default.maxOrgAppCount:1000}")
30+
private int defaultMaxOrgAppCount;
31+
32+
@Value("${default.maxDeveloperCount:100}")
33+
private int defaultMaxDeveloperCount;
34+
1935
@Autowired
2036
private ConfigCenter configCenter;
2137

@@ -31,14 +47,14 @@ public class BizThresholdChecker extends AbstractBizThresholdChecker {
3147
@PostConstruct
3248
private void init() {
3349
ConfigInstance threshold = configCenter.threshold();
34-
maxOrgPerUser = threshold.ofInteger("maxOrgPerUser", 5);
50+
maxOrgPerUser = threshold.ofInteger("maxOrgPerUser", defaultMaxOrgPerUser);
3551
userOrgCountWhiteList = threshold.ofMap("userOrgCountWhiteList", String.class, Integer.class, Collections.emptyMap());
36-
maxOrgMemberCount = threshold.ofInteger("maxOrgMemberCount", 50);
52+
maxOrgMemberCount = threshold.ofInteger("maxOrgMemberCount", defaultMaxOrgMemberCount);
3753
orgMemberCountWhiteList = threshold.ofMap("orgMemberCountWhiteList", String.class, Integer.class, Collections.emptyMap());
38-
maxOrgGroupCount = threshold.ofInteger("maxOrgGroupCount", 10);
39-
maxOrgAppCount = threshold.ofInteger("maxOrgAppCount", 50);
54+
maxOrgGroupCount = threshold.ofInteger("maxOrgGroupCount", defaultMaxOrgGroupCount);
55+
maxOrgAppCount = threshold.ofInteger("maxOrgAppCount", defaultMaxOrgAppCount);
4056
orgAppCountWhiteList = threshold.ofMap("orgAppCountWhiteList", String.class, Integer.class, Collections.emptyMap());
41-
maxDeveloperCount = threshold.ofInteger("maxDeveloperCount", 50);
57+
maxDeveloperCount = threshold.ofInteger("maxDeveloperCount", defaultMaxDeveloperCount);
4258
}
4359

4460
@Override

‎server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ server:
2323
port: 8080
2424
shutdown: graceful
2525

26+
default:
27+
orgs-per-user: 100
28+
org-member-count: 1000
29+
org-group-count: 100
30+
org-app-count: 1000
31+
developer-count: 50
32+
2633
common:
2734
cookie-name: LOCAL_LOWCODER_TOKEN
2835
product: lowcoder

‎server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ server:
2323
port: 8080
2424
shutdown: graceful
2525

26+
default:
27+
orgs-per-user: 100
28+
org-member-count: 1000
29+
org-group-count: 100
30+
org-app-count: 1000
31+
developer-count: 50
32+
2633
common:
2734
cookie-name: LOWCODER_CE_SELFHOST_TOKEN
2835
product: lowcoder

0 commit comments

Comments
 (0)