Browse Source

feat: added multiple nocodb instance option

pull/8291/head
Rohit T P 8 months ago
parent
commit
e915ee2aea
  1. 19
      docker-compose/setup-script/noco.sh

19
docker-compose/setup-script/noco.sh

@ -77,7 +77,9 @@ read_number() {
# Function to read a number within a range from the user # Function to read a number within a range from the user
read_number_range() { read_number_range() {
local number, min, max local number
local min
local max
# Check if there are 3 arguments # Check if there are 3 arguments
if [ "$#" -ne 3 ]; then if [ "$#" -ne 3 ]; then
@ -251,8 +253,8 @@ read ADVANCED_OPTIONS
if [ -n "$ADVANCED_OPTIONS" ] && { [ "$ADVANCED_OPTIONS" = "Y" ] || [ "$ADVANCED_OPTIONS" = "y" ]; }; then if [ -n "$ADVANCED_OPTIONS" ] && { [ "$ADVANCED_OPTIONS" = "Y" ] || [ "$ADVANCED_OPTIONS" = "y" ]; }; then
NUM_CORES=$(nproc) NUM_CORES=$(nproc)
echo "How many instances of NocoDB do you want to run? (Maximum: ${NUM_CORES} (default: 1): " echo "How many instances of NocoDB do you want to run (Maximum: ${NUM_CORES}) ? (default: 1): "
NUM_INSTANCES=$(read_number_range 1 $NUM_CORE NUM_INSTANCES=$(read_number_range 1 $NUM_CORES)
fi fi
if [ -z "$NUM_INSTANCES" ]; then if [ -z "$NUM_INSTANCES" ]; then
@ -297,8 +299,6 @@ fi
# Write the Docker Compose file with the updated password # Write the Docker Compose file with the updated password
cat <<EOF > docker-compose.yml cat <<EOF > docker-compose.yml
version: '3'
services: services:
nocodb: nocodb:
image: ${IMAGE} image: ${IMAGE}
@ -306,7 +306,6 @@ services:
deploy: deploy:
mode: replicated mode: replicated
replicas: ${NUM_INSTANCES} replicas: ${NUM_INSTANCES}
endpoint_mode: dnsrr
depends_on: depends_on:
- db - db
${DEPENDS_ON} ${DEPENDS_ON}
@ -492,6 +491,12 @@ mkdir -p ./nginx-post-config
# Create nginx config with the provided domain name # Create nginx config with the provided domain name
cat > ./nginx-post-config/default.conf <<EOF cat > ./nginx-post-config/default.conf <<EOF
upstream nocodb_backend {
least_conn;
server nocodb:8080;
}
server { server {
listen 80; listen 80;
server_name $DOMAIN_NAME; server_name $DOMAIN_NAME;
@ -514,7 +519,7 @@ server {
ssl_certificate_key /etc/letsencrypt/live/$DOMAIN_NAME/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/$DOMAIN_NAME/privkey.pem;
location / { location / {
proxy_pass http://nocodb:8080; proxy_pass http://nocodb_backend;
proxy_set_header Host \$host; proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;

Loading…
Cancel
Save