Skip to content

Env variables cleanup #641

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 2 commits into from
Jan 16, 2024
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
10 changes: 5 additions & 5 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@
}
},
"env": {
"ENCRYPTION_PASSWORD": {
"LOWCODER_DB_ENCRYPTION_PASSWORD": {
"description": "The encryption password used to encrypt all sensitive credentials in the database. You can use any random string (eg abcd).",
"required": false
},
"ENCRYPTION_SALT": {
"LOWCODER_DB_ENCRYPTION_SALT": {
"description": "The encryption salt used to encrypt all sensitive credentials in the database. You can use any random string (eg abcd).",
"required": false
},
"CORS_ALLOWED_DOMAINS": {
"LOWCODER_CORS_DOMAINS": {
"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_URL": {
"LOWCODER_MONGODB_URL": {
"description": "Your Mongo Database URL.",
"required": false
},
"REDIS_URL": {
"LOWCODER_REDIS_URL": {
"description": "Your Redis Database URL.",
"required": false
}
Expand Down
1 change: 1 addition & 0 deletions deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ COPY --chown=lowcoder:lowcoder deploy/docker/all-in-one/etc /lowcoder/etc
# Add startup script
COPY --chown=lowcoder:lowcoder deploy/docker/all-in-one/entrypoint.sh /lowcoder/entrypoint.sh

EXPOSE 27017
EXPOSE 3000
EXPOSE 3443

Expand Down
79 changes: 39 additions & 40 deletions deploy/docker/README.md

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions deploy/docker/all-in-one/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

export USER_ID=${PUID:=9001}
export GROUP_ID=${PGID:=9001}
export USER_ID=${LOWCODER_PUID:=9001}
export GROUP_ID=${LOWCODER_PGID:=9001}

# Update ID of lowcoder user if required
if [ ! `id --user lowcoder` -eq ${USER_ID} ]; then
Expand All @@ -17,6 +17,14 @@ if [ ! `id --group lowcoder` -eq ${GROUP_ID} ]; then
echo "ID for lowcoder group changed to: ${GROUP_ID}"
fi;

# Update host on which mongo is supposed to listen
# If LOWCODER_MONGODB_EXPOSED is true, it will isten on all interfaces
if [ "${LOWCODER_MONGODB_EXPOSED}" = "true" ]; then
export MONGO_LISTEN_HOST="0.0.0.0"
else
export MONGO_LISTEN_HOST="127.0.0.1"
fi;

LOGS="/lowcoder-stacks/logs"
DATA="/lowcoder-stacks/data"
CERT="/lowcoder-stacks/ssl"
Expand Down Expand Up @@ -44,27 +52,27 @@ mkdir -p ${SUPERVISOR_ENABLED}
rm -f ${SUPERVISOR_ENABLED}/*.conf

# Enable redis if configured to run
if [ "${REDIS_ENABLED:=true}" = "true" ]; then
if [ "${LOWCODER_REDIS_ENABLED:=true}" = "true" ]; then
ln ${SUPERVISOR_AVAILABLE}/01-redis.conf ${SUPERVISOR_ENABLED}/01-redis.conf
fi;

# Enable mongodb if configured to run
if [ "${MONGODB_ENABLED:=true}" = "true" ]; then
if [ "${LOWCODER_MONGODB_ENABLED:=true}" = "true" ]; then
ln ${SUPERVISOR_AVAILABLE}/02-mongodb.conf ${SUPERVISOR_ENABLED}/02-mongodb.conf
fi;

# Enable api-service if configured to run
if [ "${API_SERVICE_ENABLED:=true}" = "true" ]; then
if [ "${LOWCODER_API_SERVICE_ENABLED:=true}" = "true" ]; then
ln ${SUPERVISOR_AVAILABLE}/10-api-service.conf ${SUPERVISOR_ENABLED}/10-api-service.conf
fi;

# Enable node-service if configured to run
if [ "${NODE_SERVICE_ENABLED:=true}" = "true" ]; then
if [ "${LOWCODER_NODE_SERVICE_ENABLED:=true}" = "true" ]; then
ln ${SUPERVISOR_AVAILABLE}/11-node-service.conf ${SUPERVISOR_ENABLED}/11-node-service.conf
fi;

# Enable frontend if configured to run
if [ "${FRONTEND_ENABLED:=true}" = "true" ]; then
if [ "${LOWCODER_FRONTEND_ENABLED:=true}" = "true" ]; then
ln ${SUPERVISOR_AVAILABLE}/20-frontend.conf ${SUPERVISOR_ENABLED}/20-frontend.conf
fi;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[program:mongodb]
user=lowcoder
directory=/lowcoder-stacks/data/mongodb
command=mongod --port 27017 --dbpath /lowcoder-stacks/data/mongodb --logpath log --bind_ip localhost
command=mongod --port 27017 --dbpath /lowcoder-stacks/data/mongodb --logpath log --bind_ip %(ENV_MONGO_LISTEN_HOST)s
priority=10
autostart=true
autorestart=true
Expand Down
4 changes: 2 additions & 2 deletions deploy/docker/api-service/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

export USER_ID="${PUID:=9001}"
export GROUP_ID="${PGID:=9001}"
export USER_ID="${LOWCODER_PUID:=9001}"
export GROUP_ID="${LOWCODER_PGID:=9001}"

# Run init script
echo "Initializing api-service..."
Expand Down
42 changes: 22 additions & 20 deletions deploy/docker/docker-compose-multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,35 @@ services:
# ports:
# - "8080:8080"
environment:
PUID: "9001"
PGID: "9001"
MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
REDIS_URL: "redis://redis:6379"
LOWCODER_PUID: "9001"
LOWCODER_PGID: "9001"
LOWCODER_MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
LOWCODER_REDIS_URL: "redis://redis:6379"
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
LOWCODER_MAX_QUERY_TIMEOUT: 120
ENABLE_USER_SIGN_UP: "true"
LOWCODER_EMAIL_AUTH_ENABLED: "true"
LOWCODER_EMAIL_SIGNUP_ENABLED: "true"
LOWCODER_CREATE_WORKSPACE_ON_SIGNUP: "true"
#
# ! PLEASE CHANGE THESE TO SOMETHING UNIQUE !
#
# ENCRYPTION_PASSWORD and ENCRYPTION_SALT is used to encrypt sensitive
# data in database so it is important to change the defaults
# LOWCODER_DB_ENCRYPTION_PASSWORD and LOWCODER_DB_ENCRYPTION_SALT is used
# to encrypt sensitive data in database so it is important to change the defaults
#
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
LOWCODER_DB_ENCRYPTION_PASSWORD: "lowcoder.org"
LOWCODER_DB_ENCRYPTION_SALT: "lowcoder.org"
LOWCODER_CORS_DOMAINS: "*"
LOWCODER_MAX_ORGS_PER_USER: 100
LOWCODER_MAX_MEMBERS_PER_ORG: 1000
LOWCODER_MAX_GROUPS_PER_ORG: 100
LOWCODER_MAX_APPS_PER_ORG: 1000
LOWCODER_MAX_DEVELOPERS: 50
#
# API-KEY secret - should be a string of at least 32 random characters
# - on linux/mac, generate one eg. with: head /dev/urandom | head -c 30 | shasum -a 256
#
LOWCODER_API_KEY_SECRET: "5a41b090758b39b226603177ef48d73ae9839dd458ccb7e66f7e7cc028d5a50b"
COMMON_WORKSPACE_MODE: SAAS
LOWCODER_WORKSPACE_MODE: SAAS
restart: unless-stopped
depends_on:
- mongodb
Expand All @@ -70,8 +72,8 @@ services:
# ports:
# - "6060:6060"
environment:
PUID: "9001"
PGID: "9001"
LOWCODER_PUID: "9001"
LOWCODER_PGID: "9001"
LOWCODER_API_SERVICE_URL: "http://lowcoder-api-service:8080"
restart: unless-stopped
depends_on:
Expand All @@ -86,8 +88,8 @@ services:
ports:
- "3000:3000"
environment:
PUID: "9001"
PGID: "9001"
LOWCODER_PUID: "9001"
LOWCODER_PGID: "9001"
LOWCODER_MAX_REQUEST_SIZE: 20m
LOWCODER_MAX_QUERY_TIMEOUT: 120
LOWCODER_API_SERVICE_URL: "http://lowcoder-api-service:8080"
Expand Down
52 changes: 30 additions & 22 deletions deploy/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,43 @@ services:
ports:
- "3000:3000"
- "3443:3443"
# - "27017:27017"
environment:
# enable services
REDIS_ENABLED: "true"
MONGODB_ENABLED: "true"
API_SERVICE_ENABLED: "true"
NODE_SERVICE_ENABLED: "true"
FRONTEND_ENABLED: "true"
LOWCODER_REDIS_ENABLED: "true"
LOWCODER_MONGODB_ENABLED: "true"
#
# Set LOWCODER_MONGODB_EXPOSED to "true" and uncomment mongodb port
# to make internal mongo database accessible from host
#
LOWCODER_MONGODB_EXPOSED: "false"
LOWCODER_API_SERVICE_ENABLED: "true"
LOWCODER_NODE_SERVICE_ENABLED: "true"
LOWCODER_FRONTEND_ENABLED: "true"
# generic parameters
PUID: "1000"
PGID: "1000"
LOWCODER_PUID: "1000"
LOWCODER_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_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
MONGODB_URL: "mongodb://localhost:27017/lowcoder?authSource=admin"
REDIS_URL: "redis://localhost:6379"
ENABLE_USER_SIGN_UP: "true"
LOWCODER_MAX_ORGS_PER_USER: 100
LOWCODER_MAX_MEMBERS_PER_ORG: 1000
LOWCODER_MAX_GROUPS_PER_ORG: 100
LOWCODER_MAX_APPS_PER_ORG: 1000
LOWCODER_MAX_DEVELOPERS: 50
#LOWCODER_MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
LOWCODER_MONGODB_URL: "mongodb://localhost:27017/lowcoder?authSource=admin"
LOWCODER_REDIS_URL: "redis://localhost:6379"
LOWCODER_EMAIL_SIGNUP_ENABLED: "true"
LOWCODER_EMAIL_AUTH_ENABLED: "true"
LOWCODER_CREATE_WORKSPACE_ON_SIGNUP: "true"
#
# ! PLEASE CHANGE THESE TO SOMETHING UNIQUE !
#
# ENCRYPTION_PASSWORD and ENCRYPTION_SALT is used to encrypt sensitive
# data in database so it is important to change the defaults
# LOWCODER_DB_ENCRYPTION_PASSWORD and LOWCODER_DB_ENCRYPTION_SALT is used
# to encrypt sensitive data in database so it is important to change the defaults
#
ENCRYPTION_PASSWORD: "lowcoder.org"
ENCRYPTION_SALT: "lowcoder.org"
CORS_ALLOWED_DOMAINS: "*"
LOWCODER_DB_ENCRYPTION_PASSWORD: "lowcoder.org"
LOWCODER_DB_ENCRYPTION_SALT: "lowcoder.org"
LOWCODER_CORS_DOMAINS: "*"
#
# API-KEY secret - should be a string of at least 32 random characters
# - on linux/mac, generate one eg. with: head /dev/urandom | head -c 30 | shasum -a 256
Expand All @@ -50,7 +58,7 @@ services:
# frontend parameters
LOWCODER_MAX_REQUEST_SIZE: 20m
LOWCODER_MAX_QUERY_TIMEOUT: 120
COMMON_WORKSPACE_MODE: SAAS
LOWCODER_WORKSPACE_MODE: SAAS
volumes:
- ./lowcoder-stacks:/lowcoder-stacks
- ./lowcoder-stacks/assets:/lowcoder/assets
Expand Down
4 changes: 2 additions & 2 deletions deploy/docker/frontend/00-change-nginx-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

USER_ID=${PUID:=9001}
GROUP_ID=${PGID:=9001}
USER_ID=${LOWCODER_PUID:=9001}
GROUP_ID=${LOWCODER_PGID:=9001}
CLIENT_ROOT=/lowcoder/client

# Update ID of lowcoder user if required
Expand Down
4 changes: 2 additions & 2 deletions deploy/docker/node-service/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

export USER_ID=${PUID:=9001}
export GROUP_ID=${PGID:=9001}
export USER_ID=${LOWCODER_PUID:=9001}
export GROUP_ID=${LOWCODER_PGID:=9001}
export API_HOST="${LOWCODER_API_SERVICE_URL:=http://localhost:8080}"

# Run init script
Expand Down
26 changes: 14 additions & 12 deletions deploy/helm/templates/api-service/configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,25 @@ metadata:
{{- end }}
data:
{{- if .Values.redis.enabled }}
REDIS_URL: "redis://{{ $name }}-redis-master.{{ $nameSpace }}.svc.cluster.local:6379"
LOWCODER_REDIS_URL: "redis://{{ $name }}-redis-master.{{ $nameSpace }}.svc.cluster.local:6379"
{{- else }}
REDIS_URL: {{ .Values.redis.externalUrl | quote }}
LOWCODER_REDIS_URL: {{ .Values.redis.externalUrl | quote }}
{{- end }}
{{- if .Values.global.config.nodeServiceUrl }}
LOWCODER_NODE_SERVICE_URL: {{ .Values.global.config.nodeServiceUrl | quote }}
{{- else }}
LOWCODER_NODE_SERVICE_URL: "http://{{ $name }}-node-service:{{ .Values.nodeService.service.port }}"
{{- end }}
PUID: {{ .Values.global.config.userId | default "9001" | quote }}
PGID: {{ .Values.global.config.groupId | default "9001" | quote }}
CORS_ALLOWED_DOMAINS: {{ .Values.global.config.corsAllowedDomains | default "*" | quote }}
ENABLE_USER_SIGN_UP: {{ .Values.global.config.enableUserSignUp | default "true" | quote }}
LOWCODER_PUID: {{ .Values.global.config.userId | default "9001" | quote }}
LOWCODER_PGID: {{ .Values.global.config.groupId | default "9001" | quote }}
LOWCODER_CORS_DOMAINS: {{ .Values.global.config.corsAllowedDomains | default "*" | quote }}
LOWCODER_EMAIL_AUTH_ENABLED: {{ .Values.global.config.enableEmailAuth | default "true" | quote }}
LOWCODER_EMAIL_SIGNUP_ENABLED: {{ .Values.global.config.enableUserSignUp | default "true" | quote }}
LOWCODER_MAX_QUERY_TIMEOUT: {{ .Values.global.config.maxQueryTimeout | default "120" | quote }}
DEFAULT_ORGS_PER_USER: {{ .Values.global.defaults.maxOrgsPerUser | default "100" | quote }}
DEFAULT_ORG_MEMBER_COUNT: {{ .Values.global.defaults.maxMembersPerOrg | default "1000" | quote }}
DEFAULT_ORG_GROUP_COUNT: {{ .Values.global.defaults.maxGroupsPerOrg | default "100" | quote }}
DEFAULT_ORG_APP_COUNT: {{ .Values.global.defaults.maxAppsPerOrg | default "1000" | quote }}
DEFAULT_DEVELOPER_COUNT: {{ .Values.global.defaults.maxDevelopers | default "50" | quote }}
COMMON_WORKSPACE_MODE: {{ .Values.global.config.workspaceMode | default "SAAS" | quote }}
LOWCODER_MAX_ORGS_PER_USER: {{ .Values.global.defaults.maxOrgsPerUser | default "100" | quote }}
LOWCODER_MAX_MEMBERS_PER_ORG: {{ .Values.global.defaults.maxMembersPerOrg | default "1000" | quote }}
LOWCODER_MAX_GROUPS_PER_ORG: {{ .Values.global.defaults.maxGroupsPerOrg | default "100" | quote }}
LOWCODER_MAX_APPS_PER_ORG: {{ .Values.global.defaults.maxAppsPerOrg | default "1000" | quote }}
LOWCODER_MAX_DEVELOPERS: {{ .Values.global.defaults.maxDevelopers | default "50" | quote }}
LOWCODER_WORKSPACE_MODE: {{ .Values.global.config.workspaceMode | default "SAAS" | quote }}
LOWCODER_CREATE_WORKSPACE_ON_SIGNUP: {{ .Values.global.config.createWorkspaceOnSignup | default "true" | quote }}
8 changes: 4 additions & 4 deletions deploy/helm/templates/api-service/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ metadata:
{{- end }}
stringData:
{{- if .Values.mongodb.enabled }}
MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
LOWCODER_MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
{{- else }}
MONGODB_URL: {{ .Values.mongodb.externalUrl | quote }}
LOWCODER_MONGODB_URL: {{ .Values.mongodb.externalUrl | quote }}
{{- end }}
ENCRYPTION_PASSWORD: {{ .Values.global.config.encryption.password | default "lowcoder.org" | quote }}
ENCRYPTION_SALT: {{ .Values.global.config.encryption.salt | default "lowcoder.org" | quote }}
ELOWCODER_DB_NCRYPTION_PASSWORD: {{ .Values.global.config.encryption.password | default "lowcoder.org" | quote }}
ELOWCODER_DB_NCRYPTION_SALT: {{ .Values.global.config.encryption.salt | default "lowcoder.org" | quote }}
LOWCODER_API_KEY_SECRET: "{{ .Values.global.config.apiKeySecret }}"
4 changes: 2 additions & 2 deletions deploy/helm/templates/frontend/configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
PUID: {{ .Values.global.config.userId | default "9001" | quote }}
PGID: {{ .Values.global.config.groupId | default "9001" | quote }}
LOWCODER_PUID: {{ .Values.global.config.userId | default "9001" | quote }}
LOWCODER_PGID: {{ .Values.global.config.groupId | default "9001" | quote }}
{{- if .Values.global.config.apiServiceUrl }}
LOWCODER_API_SERVICE_URL: {{ .Values.global.config.apiServiceUrl | trimSuffix "/" | quote }}
{{- else }}
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/templates/node-service/configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
PUID: {{ .Values.global.config.userId | default "9001" | quote }}
PGID: {{ .Values.global.config.groupId | default "9001" | quote }}
LOWCODER_PUID: {{ .Values.global.config.userId | default "9001" | quote }}
LOWCODER_PGID: {{ .Values.global.config.groupId | default "9001" | quote }}
{{- if .Values.global.config.apiServiceUrl }}
LOWCODER_API_SERVICE_URL: {{ .Values.global.config.apiServiceUrl | quote }}
{{- else }}
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ global:
config:
# This setting sets workspace mode. Possible values: SAAS, ENTERPRISE
workspaceMode: SAAS
createWorkspaceOnSignup: true
# ID of user and group runnning the service within the container
userId: 9001
groupId: 9001
corsAllowedDomains: "*"
enableEmailAuth: true
enableUserSignUp: true
encryption:
password: "lowcoder.org"
Expand Down
Loading