Initial commit

This commit is contained in:
Orwa Diraneyya 2025-05-25 19:35:51 +02:00
commit d6be51bf19
6 changed files with 291 additions and 0 deletions

84
.env.empty Normal file
View file

@ -0,0 +1,84 @@
# 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=
LOCKBOX_MASTER_KEY=
SECRET_KEY_BASE=
# DATABASE CONFIG
ORM_LOGGING=
PG_DB=
PG_USER=
PG_HOST=
PG_PASS=
# 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_USER=
TOOLJET_DB_HOST=
TOOLJET_DB_PASS=
PGRST_DB_URI=
PGRST_HOST=
PGRST_JWT_SECRET=
PGRST_SERVER_PORT=
# Redis
REDIS_HOST=
REDIS_PORT=
REDIS_USER=
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=
# 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=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# EMAIL CONFIGURATION
DEFAULT_FROM_EMAIL=
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=
ENABLE_MARKETPLACE_FEATURE=
# 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=
#TELEMETRY
DEPLOYMENT_PLATFORM=

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.env
postgres_data/

13
README.md Normal file
View file

@ -0,0 +1,13 @@
## Tags I tried
- "ee-lts-latest" worked, but had many anti features
- "ce-latest" did not work
- "ce-lts-latest" did not work
- "v3.0.28-ce-lts" did not work
- "v3.0.27-ce-lts" did not work
- "latest" did not work
## Issues I filed
https://github.com/ToolJet/ToolJet/issues/12931

37
backup-restore.sh Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
# Source the .env file to get PG_HOST
source .env
# Function to perform backup
perform_backup() {
echo "Enter the file name for the backup:"
read backup_file_name
docker exec -t --user postgres "$PG_HOST" pg_dumpall -c -U postgres > "$backup_file_name.sql"
echo "Backup complete. File saved as: $backup_file_name.sql"
}
# Function to perform restore
perform_restore() {
echo "Enter the name of the backup file to restore:"
read restore_file_name
cat "$restore_file_name" | docker exec -i --user postgres "$PG_HOST" psql -U postgres
}
# Main script
echo "Choose an operation:"
echo "1. Backup"
echo "2. Restore"
read choice
case $choice in
1)
perform_backup
;;
2)
perform_restore
;;
*)
echo "Invalid choice. Please choose 1 or 2."
;;
esac

48
compose.yaml Normal file
View file

@ -0,0 +1,48 @@
services:
tooljet:
tty: true
stdin_open: true
container_name: Tooljet-app
image: tooljet/tooljet-ce:latest
restart: always
env_file: .env
ports:
- 8001:80
deploy: # Please adjust the resource according to your usecase
# resources:
# limits:
# cpus: '1'
# memory: 2G
depends_on:
- postgres
environment:
SERVE_CLIENT: "true"
PORT: "80"
command: npm run start:prod
postgres:
container_name: ${PG_HOST}
image: postgres:13
restart: always
deploy: # Please adjust the resource according to your usecase
resources:
limits:
cpus: '2'
memory: 3G
volumes:
- postgres:/var/lib/postgresql/data
env_file: .env
environment:
- POSTGRES_USER=${PG_USER}
- POSTGRES_PASSWORD=${PG_PASS}
volumes:
postgres:
driver: local
driver_opts:
o: bind
type: none
device: ${PWD}/postgres_data
certs:
logs:
fallbackcerts:

107
internal.sh Executable file
View file

@ -0,0 +1,107 @@
#!/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 "Generated 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 JWT secret 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
read -p "Enter password for Postgresql database (Press Enter to generate a random password): " user_input
if [[ -z "$user_input" ]]; then
# Generate random password
PASSWORD=$(generate_password)
echo "Auto-generated password for Postgresql database: $PASSWORD"
else
PASSWORD=$user_input
echo "Password for Postgresql database successfully added"
fi
# 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
else
echo "Postgres password already exists"
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 "$@"