From 6a20f3f0c1aeb86162044ce31ba4708e90e04750 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Mon, 23 Sep 2024 17:31:30 +0530 Subject: [PATCH] feat: add sqlite support in the upstall script --- docker-compose/1_Auto_Upstall/noco.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docker-compose/1_Auto_Upstall/noco.sh b/docker-compose/1_Auto_Upstall/noco.sh index 9df4b7c783..e5b3b0d482 100755 --- a/docker-compose/1_Auto_Upstall/noco.sh +++ b/docker-compose/1_Auto_Upstall/noco.sh @@ -34,6 +34,7 @@ CONFIG_REDIS_PASSWORD="" CONFIG_MINIO_ACCESS_KEY="" CONFIG_MINIO_ACCESS_SECRET="" CONFIG_DOCKER_COMMAND="" +CONFIG_POSTGRES_SQLITE="" declare -a message_arr @@ -451,6 +452,8 @@ get_advanced_options() { if [ "$CONFIG_EDITION" = "EE" ] || [ "$CONFIG_EDITION" = "ee" ]; then CONFIG_LICENSE_KEY=$(prompt_required "Enter the NocoDB license key") + else + CONFIG_POSTGRES_SQLITE=$(prompt "Select PostgreSQL or SQLite as your database [P/S]" "P") fi CONFIG_REDIS_ENABLED=$(confirm "Do you want to enable Redis for caching?" "Y" && echo "Y" || echo "N" "Y") @@ -479,6 +482,7 @@ get_advanced_options() { set_default_options() { CONFIG_EDITION="CE" + CONFIG_POSTGRES_SQLITE="P" CONFIG_REDIS_ENABLED="Y" CONFIG_MINIO_ENABLED="Y" CONFIG_MINIO_DOMAIN_NAME=$(get_public_ip) @@ -510,6 +514,9 @@ create_docker_compose_file() { if [ "${CONFIG_MINIO_ENABLED}" = "Y" ]; then gen_minio=1 fi + if [ "${CONFIG_POSTGRES_SQLITE}" = "P" ] || [ "${CONFIG_POSTGRES_SQLITE}" = "p" ]; then + gen_postgres=1 + fi local compose_file="docker-compose.yml" @@ -521,10 +528,18 @@ services: deploy: mode: replicated replicas: ${CONFIG_NUM_INSTANCES} +EOF + + if [ -n "$gen_postgres" ] || [ -n "$gen_redis" ] || [ "$gen_redis" ]; then + cat >> "$compose_file" <> "$compose_file" <> "$compose_file" <> "$compose_file" <> "$compose_file" <> "$env_file" echo "NC_LICENSE_KEY=${CONFIG_LICENSE_KEY}" >> "$env_file" - else + elif [ "${CONFIG_POSTGRES_SQLITE}" = "P" ]; then echo "NC_DB=pg://db:5432?d=nocodb&user=postgres&password=${encoded_password}" >> "$env_file" fi