mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 13:37:28 +00:00
Fix customer deployment issue - Docker (Contributors)
This commit is contained in:
parent
114e9acf74
commit
40f1254d71
6 changed files with 206 additions and 6 deletions
|
|
@ -78,5 +78,22 @@ services:
|
|||
- POSTGRES_USER=${PG_USER}
|
||||
- POSTGRES_PASSWORD=${PG_PASS}
|
||||
|
||||
redis:
|
||||
container_name: redis
|
||||
image: redis:6.2
|
||||
restart: always
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.5'
|
||||
memory: 1G
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- MASTER=redis
|
||||
- REDIS_USER=${REDIS_USER}
|
||||
- REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
|
||||
volumes:
|
||||
postgres:
|
||||
redis:
|
||||
|
|
|
|||
82
docker/.env.internal.example
Normal file
82
docker/.env.internal.example
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# Create .env from this example file and replace values for the environment.
|
||||
# The application expects a separate .env.test for test environment configuration
|
||||
# Get detailed information about each variable here: https://docs.tooljet.com/docs/setup/env-vars
|
||||
|
||||
TOOLJET_HOST=http://localhost:8082
|
||||
LOCKBOX_MASTER_KEY= # replace_with_lockbox_master_key
|
||||
SECRET_KEY_BASE= # replace_with_secret_key_base
|
||||
|
||||
# DATABASE CONFIG
|
||||
ORM_LOGGING=all
|
||||
PG_DB=tooljet_production
|
||||
PG_USER=postgres
|
||||
PG_HOST=postgresql
|
||||
PG_PASS= # postgres database password
|
||||
|
||||
# The above postgres values is set to its default state. If necessary, kindly modify it according to your personal preference.
|
||||
|
||||
# TOOLJET DATABASE
|
||||
TOOLJET_DB=tooljet_db
|
||||
TOOLJET_DB_USER=postgres
|
||||
TOOLJET_DB_HOST=postgresql
|
||||
TOOLJET_DB_PASS=
|
||||
|
||||
PGRST_DB_URI= # postgres://<postgres_username>:<postgres_password><@postgres_hostname>/<database_name>
|
||||
PGRST_HOST=postgrest:3002
|
||||
PGRST_JWT_SECRET= # If you have openssl installed, you can run the following command openssl rand -hex 32 to generate the value for PGRST_JWT_SECRET.
|
||||
PGRST_SERVER_PORT=3002
|
||||
PGRST_DB_PRE_CONFIG=postgrest.pre_config
|
||||
|
||||
# Redis configuration
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
REDIS_USER=default
|
||||
REDIS_PASSWORD=
|
||||
# Checks every 24 hours to see if a new version of ToolJet is available
|
||||
# (Enabled by default. Set false to disable)
|
||||
CHECK_FOR_UPDATES=true
|
||||
|
||||
# Checks every 24 hours to update app telemetry data to ToolJet hub.
|
||||
# (Telemetry is enabled by default. Set value to true to disable.)
|
||||
# DISABLE_TOOLJET_TELEMETRY=false
|
||||
|
||||
GOOGLE_CLIENT_ID=
|
||||
GOOGLE_CLIENT_SECRET=
|
||||
|
||||
# EMAIL CONFIGURATION
|
||||
DEFAULT_FROM_EMAIL=hello@tooljet.io
|
||||
SMTP_USERNAME=
|
||||
SMTP_PASSWORD=
|
||||
SMTP_DOMAIN=
|
||||
SMTP_PORT=
|
||||
|
||||
# DISABLE USER SIGNUPS (true or false). only applicable if Multi-Workspace feature is enabled
|
||||
DISABLE_SIGNUPS=
|
||||
|
||||
|
||||
# OBSERVABILITY
|
||||
APM_VENDOR=
|
||||
SENTRY_DNS=
|
||||
SENTRY_DEBUG=
|
||||
|
||||
# FEATURE TOGGLE
|
||||
COMMENT_FEATURE_ENABLE=
|
||||
ENABLE_MULTIPLAYER_EDITING=true
|
||||
|
||||
|
||||
# SSO (Applicable only for Multi-Workspace)
|
||||
SSO_GOOGLE_OAUTH2_CLIENT_ID=
|
||||
SSO_GIT_OAUTH2_CLIENT_ID=
|
||||
SSO_GIT_OAUTH2_CLIENT_SECRET=
|
||||
SSO_GIT_OAUTH2_HOST=
|
||||
SSO_ACCEPTED_DOMAINS=
|
||||
SSO_DISABLE_SIGNUPS=
|
||||
|
||||
#ONBOARDING
|
||||
ENABLE_ONBOARDING_QUESTIONS_FOR_ALL_SIGN_UPS=
|
||||
|
||||
#session expiry in minutes
|
||||
USER_SESSION_EXPIRY=2880
|
||||
|
||||
#TELEMETRY
|
||||
DEPLOYMENT_PLATFORM=docker
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
# pull official base image
|
||||
FROM node:18.18.2-bullseye
|
||||
FROM node:22.15.1-bullseye
|
||||
|
||||
ENV NODE_ENV=development
|
||||
|
||||
RUN npm i -g npm@9.8.1
|
||||
RUN npm i -g npm@10.9.2
|
||||
|
||||
# set working directory
|
||||
WORKDIR /app
|
||||
|
|
|
|||
101
docker/internal.sh
Executable file
101
docker/internal.sh
Executable file
|
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Load the .env file
|
||||
source .env
|
||||
|
||||
# Check if LOCKBOX_MASTER_KEY is present or empty
|
||||
if [[ -z "$LOCKBOX_MASTER_KEY" ]]; then
|
||||
# Generate LOCKBOX_MASTER_KEY
|
||||
LOCKBOX_MASTER_KEY=$(openssl rand -hex 32)
|
||||
|
||||
# Update .env file
|
||||
awk -v key="$LOCKBOX_MASTER_KEY" '
|
||||
BEGIN { FS=OFS="=" }
|
||||
/^LOCKBOX_MASTER_KEY=/ { $2=key; found=1 }
|
||||
1
|
||||
END { if (!found) print "LOCKBOX_MASTER_KEY="key }
|
||||
' .env > temp.env && mv temp.env .env
|
||||
|
||||
echo "Generated a secure master key for the lockbox"
|
||||
else
|
||||
echo "The lockbox master key already exists."
|
||||
fi
|
||||
|
||||
# Check if SECRET_KEY_BASE is present or empty
|
||||
if [[ -z "$SECRET_KEY_BASE" ]]; then
|
||||
# Generate SECRET_KEY_BASE
|
||||
SECRET_KEY_BASE=$(openssl rand -hex 64)
|
||||
|
||||
# Update .env file
|
||||
awk -v key="$SECRET_KEY_BASE" '
|
||||
BEGIN { FS=OFS="=" }
|
||||
/^SECRET_KEY_BASE=/ { $2=key; found=1 }
|
||||
1
|
||||
END { if (!found) print "SECRET_KEY_BASE="key }
|
||||
' .env > temp.env && mv temp.env .env
|
||||
|
||||
echo "Created a secret key for secure operations."
|
||||
else
|
||||
echo "The secret key base is already in place."
|
||||
fi
|
||||
|
||||
# Check if PGRST_JWT_SECRET is present or empty
|
||||
if [[ -z "$PGRST_JWT_SECRET" ]]; then
|
||||
# Generate PGRST_JWT_SECRET
|
||||
PGRST_JWT_SECRET=$(openssl rand -hex 32)
|
||||
|
||||
# Update .env file
|
||||
awk -v key="$PGRST_JWT_SECRET" '
|
||||
BEGIN { FS=OFS="=" }
|
||||
/^PGRST_JWT_SECRET=/ { $2=key; found=1 }
|
||||
1
|
||||
END { if (!found) print "PGRST_JWT_SECRET="key }
|
||||
' .env > temp.env && mv temp.env .env
|
||||
|
||||
echo "Generated a unique secret for PGRST authentication."
|
||||
else
|
||||
echo "The PGRST JWT secret is already generated and in place."
|
||||
fi
|
||||
|
||||
# Function to generate a random password
|
||||
generate_password() {
|
||||
openssl rand -base64 12 | tr -d '/+' | cut -c1-16
|
||||
}
|
||||
|
||||
# Check if PG_PASS and TOOLJET_DB_PASS are present or empty
|
||||
if [[ -z "$PG_PASS" ]] && [[ -z "$TOOLJET_DB_PASS" ]]; then
|
||||
# Generate random passwords
|
||||
PASSWORD=$(generate_password)
|
||||
|
||||
# Update .env file
|
||||
awk -v pass="$PASSWORD" '
|
||||
BEGIN { FS=OFS="=" }
|
||||
/^(PG_PASS|TOOLJET_DB_PASS)=/ { $2=pass; found=1 }
|
||||
1
|
||||
END { if (!found) print "PG_PASS="pass ORS "TOOLJET_DB_PASS="pass }
|
||||
' .env > temp.env && mv temp.env .env
|
||||
|
||||
echo "Successfully generated a secure password for the PostgreSQL database."
|
||||
else
|
||||
echo "Postgres password already exist"
|
||||
fi
|
||||
|
||||
# Check if PGRST_DB_URI is present or empty
|
||||
if [[ -z "$PGRST_DB_URI" ]]; then
|
||||
# Construct PGRST_DB_URI with PG_PASS
|
||||
PGRST_DB_URI="postgres://postgres:$PASSWORD@postgresql/tooljet_db"
|
||||
|
||||
# Update .env file for PGRST_DB_URI
|
||||
awk -v uri="$PGRST_DB_URI" '
|
||||
BEGIN { FS=OFS="=" }
|
||||
/^PGRST_DB_URI=/ { $2=uri; found=1 }
|
||||
1
|
||||
END { if (!found) print "PGRST_DB_URI="uri }
|
||||
' .env > temp.env && mv temp.env .env
|
||||
|
||||
echo "Successfully updated PGRST database URI"
|
||||
else
|
||||
echo "The PGRST DB URI is already configured and in use."
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# pull official base image
|
||||
FROM node:18.18.2-bullseye
|
||||
FROM node:22.15.1-bullseye
|
||||
|
||||
RUN npm i -g npm@9.8.1
|
||||
RUN npm i -g npm@10.9.2
|
||||
|
||||
# set working directory
|
||||
WORKDIR /app
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# pull official base image
|
||||
FROM node:18.18.2-bullseye
|
||||
FROM node:22.15.1-bullseye
|
||||
RUN apt-get update && apt-get install -y postgresql-client freetds-dev libaio1 wget
|
||||
|
||||
# Install Instantclient Basic Light Oracle and Dependencies
|
||||
|
|
@ -19,7 +19,7 @@ WORKDIR /
|
|||
ENV NODE_ENV=development
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
|
||||
RUN npm i -g npm@9.8.1
|
||||
RUN npm i -g npm@10.9.2
|
||||
RUN mkdir -p /app
|
||||
WORKDIR /app
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue