Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
03777b2
feat: Enable server tests on PRs raised on PG branch
abhvsn May 14, 2024
7256d66
feat: Add postgresql docker image before running the tests
abhvsn May 14, 2024
72c8718
chore: Minor refactor
abhvsn May 14, 2024
15ec4c3
chore: Move the transform script trigger to build.sh
abhvsn May 14, 2024
a7d9ccd
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/e…
abhvsn May 15, 2024
b5c0601
chore: Update the DB URI env variable
abhvsn May 15, 2024
4ba5004
chore: Add verbose comment for postgres URI check
abhvsn May 15, 2024
0c4f065
fix: Updated name for URI in migration
abhvsn May 15, 2024
35800ce
refactor: Remove application-production.properties to avoid the confu…
abhvsn May 15, 2024
99c6e5c
chore: Run transform script to add the cake classes
abhvsn May 16, 2024
68cb893
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/e…
abhvsn May 16, 2024
95c6c05
Merge branch 'feat/enable-server-tests-for-pg' of github.com:appsmith…
abhvsn May 16, 2024
acd841b
feat: Add fallback for DB URI in entrypoint.sh
abhvsn May 16, 2024
25bbced
chore: Remove envs while building the server
abhvsn May 16, 2024
17a659f
fix: DB URI name
abhvsn May 16, 2024
c84744b
chore: Update the DB URL variable
abhvsn May 16, 2024
ea58c43
refactor: Add DB url config in entrypoint.sh
abhvsn May 16, 2024
e34e211
cleanup: Remove un-necessary migration to update db URL name
abhvsn May 16, 2024
285cb37
chore: Remove fallback for DB URL
abhvsn May 16, 2024
bfc372c
feat: Add more context on DB url to initialise the DB from entrypoint.sh
abhvsn May 16, 2024
4ce41e5
fix: Postgres container run command for running the tests
abhvsn May 16, 2024
fab1e9b
chore: Update the check to test for jdbc string at the start of the D…
abhvsn May 16, 2024
30c7cba
chore: Replace the DB name in few other files
abhvsn May 16, 2024
146a224
fix: DB URL name in readme
abhvsn May 16, 2024
1ba2d2e
chore: Add stricter checks for DB URL and don't provide fallback for …
abhvsn May 17, 2024
8ec2ebc
chore: Add Postgres envs for username and password
abhvsn May 17, 2024
2d5a4ab
feat: Handle bean initialisation for DB configs
abhvsn May 17, 2024
382b9ec
chore: Update DB URL name in env and readme files
abhvsn May 17, 2024
d0a0968
Merge branch 'feat/enable-server-tests-for-pg' of github.com:appsmith…
abhvsn May 17, 2024
3373b5d
revert: Nomenclature change for deploy-preview script
abhvsn May 20, 2024
0a1199f
chore: Add `ORing` in config map to support backward compatibility
abhvsn May 20, 2024
f00bdcf
feat: Add fallback for APPSMITH_DB_URL in run_with_env script
abhvsn May 20, 2024
87fe4ca
feat: Add fallback for APPSMITH_DB_URL in index.js within deploy dire…
abhvsn May 20, 2024
1562e3e
revert: EnvManager to use existing APPSMITH_MONGODB_URI, as this will…
abhvsn May 20, 2024
4e837fc
Merge branch 'chore/few-more-updates' of github.com:appsmithorg/appsm…
abhvsn May 20, 2024
ed131f3
Merge branch 'feat/enable-server-tests-for-pg' into chore/few-more-up…
abhvsn May 20, 2024
0e32b6e
chore: Update DB connection url in CI
abhvsn May 20, 2024
22716b4
chore: Keep the fallback DB connection url for local dev till this is…
abhvsn May 20, 2024
8ef7d20
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/e…
abhvsn May 20, 2024
21a8284
Merge branch 'feat/enable-server-tests-for-pg' into chore/few-more-up…
abhvsn May 20, 2024
5357654
chore: Remove the requirement for jdbc prefix for postgres connection…
abhvsn May 20, 2024
fcbc861
Merge branch 'feat/enable-server-tests-for-pg' into chore/few-more-up…
abhvsn May 20, 2024
cfe5a1d
test: Update tests
abhvsn May 20, 2024
2fc22dd
Merge branch 'feat/enable-server-tests-for-pg' into chore/few-more-up…
abhvsn May 20, 2024
047c56c
chore: Remove the step to append jdbc
abhvsn May 20, 2024
7e3a79a
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/e…
abhvsn May 20, 2024
895173d
fix: Add profile check for DB config to configure embedded MongoDB fo…
abhvsn May 20, 2024
3f61efa
chore: Migrate DB name from `APPSMITH_MONGODB_URI` to `APPSMITH_DB_URL`
abhvsn May 20, 2024
7a8b8d0
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/e…
abhvsn May 21, 2024
f1837b5
fix: Tests
abhvsn May 21, 2024
020842c
Merge branch 'feat/enable-server-tests-for-pg' of github.com:appsmith…
abhvsn May 21, 2024
6b0a942
Update deploy/docker/fs/opt/appsmith/utils/bin/backup.js
abhvsn May 21, 2024
1fb63ec
chore: Remove prefix support for Postgres DB URL
abhvsn May 21, 2024
762b425
Merge branch 'feat/enable-server-tests-for-pg' of github.com:appsmith…
abhvsn May 21, 2024
fb96715
revert: Helm changes
abhvsn May 22, 2024
2687595
revert: Unwanted changes from entrypoint
abhvsn May 22, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/quality-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Quality checks

on:
pull_request:
branches: [release, master]
branches: [release, master, pg]

jobs:
path-filter:
Expand Down Expand Up @@ -45,6 +45,7 @@ jobs:
secrets: inherit
with:
pr: ${{ github.event.pull_request.number }}
is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }}

client-build:
name: client-build
Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/server-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
description: "This is the branch to be used for the build."
required: false
type: string
is-pg-build:
description: "This is a boolean value in case the workflow is being called for a PG build"
required: false
type: string
default: "false"

# Change the working directory for all the jobs in this workflow
defaults:
Expand Down Expand Up @@ -133,6 +138,12 @@ jobs:
distribution: "temurin"
java-version: "17"

- name: Conditionally start PostgreSQL
run: |
if [[ inputs.is-pg-build == 'true' ]]; then
docker run --name appsmith-pg -p 5432:5432 -d -e POSTGRES_PASSWORD=password postgres:alpine
fi

# Retrieve maven dependencies from cache. After a successful run, these dependencies are cached again
- name: Cache maven dependencies
if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
Expand All @@ -148,16 +159,6 @@ jobs:
# Build the code
- name: Build
if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
env:
ACTIVE_PROFILE: test
APPSMITH_MONGODB_URI: "mongodb://localhost:27017/mobtools"
APPSMITH_CLOUD_SERVICES_BASE_URL: "https://release-cs.appsmith.com"
APPSMITH_CLOUD_SERVICES_TEMPLATE_UPLOAD_AUTH: ${{ secrets.APPSMITH_CLOUD_SERVICES_TEMPLATE_UPLOAD_AUTH }}
APPSMITH_REDIS_URL: "redis://127.0.0.1:6379"
APPSMITH_ENCRYPTION_PASSWORD: "password"
APPSMITH_ENCRYPTION_SALT: "salt"
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
APPSMITH_VERBOSE_LOGGING_ENABLED: false
run: |
./build.sh -DskipTests

Expand All @@ -166,7 +167,6 @@ jobs:
if: (inputs.skip-tests != 'true' || steps.run_result.outputs.run_result == 'failedtest') && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
env:
ACTIVE_PROFILE: test
APPSMITH_MONGODB_URI: "mongodb://localhost:27017/mobtools"
APPSMITH_CLOUD_SERVICES_BASE_URL: "https://release-cs.appsmith.com"
APPSMITH_CLOUD_SERVICES_TEMPLATE_UPLOAD_AUTH: ${{ secrets.APPSMITH_CLOUD_SERVICES_TEMPLATE_UPLOAD_AUTH }}
APPSMITH_REDIS_URL: "redis://127.0.0.1:6379"
Expand All @@ -175,6 +175,11 @@ jobs:
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
APPSMITH_VERBOSE_LOGGING_ENABLED: false
run: |
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi
args=()
if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
failed_tests="${{ steps.failed_tests.outputs.tests }}"
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"success_url": "/",
"stack": "container",
"env": {
"APPSMITH_MONGODB_URI": {
"APPSMITH_DB_URL": {
"description": "Your Mongo Database URI. Since Heroku doesn't support a managed MongoDB instance, you'll have to create a Mongo DB instance on another service such as https://cloud.mongodb.com",
"value": ""
},
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/pages/AdminSettings/config/advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const config: AdminConfigType = {
canSave: true,
settings: [
{
id: "APPSMITH_MONGODB_URI",
id: "APPSMITH_DB_URL",
category: SettingCategories.ADVANCED,
controlType: SettingTypes.TEXTINPUT,
controlSubType: SettingSubtype.TEXT,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.appsmith.server.configurations;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.autoconfigure.mongo.MongoProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.util.StringUtils;

import java.net.URI;
import java.net.URISyntaxException;

/**
* Class to configure beans based on DB url. This could have been implemented in {@link MongoConfig} or
* {@link DBConfig} but extracted to seperate class as we were facing cyclical dependency issue with the other approach
*/
@Configuration
@Slf4j
public class CommonDBConfig {

@Value("${appsmith.db.url}")
private String appsmithDbUrl;

static final String JDBC_PREFIX = "jdbc:";

@Bean
@Primary
@Profile("!test")
public MongoProperties configureMongoDB() {
if (!appsmithDbUrl.startsWith("mongodb")) {
return null;
}
log.info("Found MongoDB uri configuring now");
MongoProperties mongoProperties = new MongoProperties();
mongoProperties.setUri(appsmithDbUrl);
return mongoProperties;
}

@Bean
@Primary
public DataSourceProperties configurePostgresDB() {
if (!appsmithDbUrl.contains("postgresql")) {
return null;
}
log.info("Found PostgreSQL uri configuring now");
return extractJdbcProperties(appsmithDbUrl);
}

/**
* Method to extract Jdbc props from the given DB URL
* Expected DB URL: postgresql://{username}:{password}@localhost:{port}/{db_name}
*/
public DataSourceProperties extractJdbcProperties(String dbUrl) {
DataSourceProperties ds = new DataSourceProperties();
try {
URI uri = new URI(dbUrl);
if (!StringUtils.hasLength(uri.getHost())) {
String errorString = String.format(
"Malformed DB URL! Expected format: postgresql://{username}:{password}@localhost:{port}/{db_name}, provided url is %s",
dbUrl);
throw new IllegalArgumentException(errorString);
}
String userInfo = uri.getUserInfo();
if (StringUtils.hasLength(userInfo)) {
String[] userDetails = userInfo.split(":");
ds.setUsername(userDetails[0]);
ds.setPassword(userDetails[1]);
}
// If the port is not mentioned default it to standard 5432
int port = uri.getPort() == -1 ? 5432 : uri.getPort();
String updatedUrl =
String.format("%s%s://%s:%s%s", JDBC_PREFIX, uri.getScheme(), uri.getHost(), port, uri.getPath());
ds.setUrl(updatedUrl);
return ds;
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ spring.lifecycle.timeout-per-shutdown-phase=20s

spring.profiles.active=${ACTIVE_PROFILE:production}

appsmith.db.url=${APPSMITH_DB_URL:${APPSMITH_MONGODB_URI}}
# This property allows us to override beans during testing. This is useful when we want to set different configurations
# and different parameters during test as compared to production. If this property is disabled, some tests will fail.
spring.main.allow-bean-definition-overriding=true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.appsmith.server.configurations;

import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;

class CommonDBConfigTest {

@Test
public void testExtractAndSaveJdbcParams_validDbUrlWithUsernameAndPassword() {
CommonDBConfig commonDBConfig = new CommonDBConfig();
String dbUrl = "postgresql://postgres:password@localhost/postgres";
DataSourceProperties ds = commonDBConfig.extractJdbcProperties(dbUrl);
assertEquals("postgres", ds.getUsername());
assertEquals("password", ds.getPassword());
assertEquals("jdbc:postgresql://localhost:5432/postgres", ds.getUrl());

String dbUrlWithPort = "postgresql://postgres:password@localhost:1234/postgres";
ds = commonDBConfig.extractJdbcProperties(dbUrlWithPort);
assertEquals("postgres", ds.getUsername());
assertEquals("password", ds.getPassword());
assertEquals("jdbc:postgresql://localhost:1234/postgres", ds.getUrl());
}

@Test
public void testExtractAndSaveJdbcParams_validDbUrlWithoutUsernameAndPassword() {
CommonDBConfig commonDBConfig = new CommonDBConfig();
String dbUrl = "postgresql://localhost:5432/postgres";
DataSourceProperties ds = commonDBConfig.extractJdbcProperties(dbUrl);
assertNull(ds.getUsername());
assertNull(ds.getPassword());
assertEquals("jdbc:postgresql://localhost:5432/postgres", ds.getUrl());
}

@Test
public void testExtractAndSaveJdbcParams_invalidDbUrl() {
CommonDBConfig commonDBConfig = new CommonDBConfig();
String dbUrl = "jdbc:postgresql://localhost/postgres";
String errorString = String.format(
"Malformed DB URL! Expected format: postgresql://{username}:{password}@localhost:{port}/{db_name}, provided url is %s",
dbUrl);
assertThrows(IllegalArgumentException.class, () -> commonDBConfig.extractJdbcProperties(dbUrl), errorString);
}
}
4 changes: 4 additions & 0 deletions app/server/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ if [[ -f .env ]]; then
source .env
fi

if [[ -f tx/transform.py ]]; then
python3 tx/transform.py
fi

node scripts/check-field-constants.mjs

# Build the code. $@ accepts all the parameters from the input command line and uses it in the maven build command
Expand Down
2 changes: 1 addition & 1 deletion app/server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
env_file: envs/docker.env
environment:
APPSMITH_REDIS_URL: "redis://redis:6379"
APPSMITH_MONGODB_URI: "mongodb://mongo:27017/appsmith"
APPSMITH_DB_URL: "mongodb://mongo:27017/appsmith"
ports:
- "8080:8080"
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion app/server/envs/dev.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

APPSMITH_MONGODB_URI="mongodb://localhost:27017/appsmith?replicaSet=rs0"
APPSMITH_DB_URL="mongodb://localhost:27017/appsmith?replicaSet=rs0"

APPSMITH_REDIS_URL="redis://127.0.0.1:6379"

Expand Down
2 changes: 1 addition & 1 deletion app/server/envs/test.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ACTIVE_PROFILE=test

APPSMITH_MONGODB_URI="mongodb://localhost:27017/appsmith"
APPSMITH_DB_URL="mongodb://localhost:27017/appsmith"

APPSMITH_REDIS_URL="redis://127.0.0.1:6379"

Expand Down
10 changes: 5 additions & 5 deletions contributions/ServerSetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ With the prerequisites met, let's build the code.

This command creates a `.env` file in the `app/server` folder. All run scripts pick up environment configuration from this file.

5. Ensure that the environment variables `APPSMITH_MONGODB_URI` and `APPSMITH_REDIS_URI` in the file `.env` point to your local running instances of MongoDB and Redis.
5. Ensure that the environment variables `APPSMITH_DB_URL` and `APPSMITH_REDIS_URI` in the file `.env` point to your local running instances of MongoDB and Redis.

6. **Update the replica set name with correct value in the mongo connection string in the [.env](#setup-environment-file) file.** The replica name is the same as passed [here](#setting-up-a-local-mongodb-instance)
```bash
APPSMITH_MONGODB_URI="mongodb://localhost:27017/appsmith?replicaSet=<replica-set-name>"
APPSMITH_DB_URL="mongodb://localhost:27017/appsmith?replicaSet=<replica-set-name>"
```

7. Run the following command to create the final JAR for the Appsmith server:
Expand All @@ -152,7 +152,7 @@ With the prerequisites met, let's build the code.
- On Ubuntu Linux environment docker needs root privilege, hence `./build.sh` script needs to be run with root privilege as well.
- On Ubuntu Linux environment, the script may not be able to read `.env` file, so it is advised that you run the cmd like:
```console
sudo APPSMITH_MONGODB_URI="mongodb://localhost:27017/appsmith" APPSMITH_REDIS_URL="redis://127.0.0.1:6379" APPSMITH_MAIL_ENABLED=false APPSMITH_ENCRYPTION_PASSWORD=abcd APPSMITH_ENCRYPTION_SALT=abcd ./build.sh
sudo APPSMITH_DB_URL="mongodb://localhost:27017/appsmith" APPSMITH_REDIS_URL="redis://127.0.0.1:6379" APPSMITH_MAIL_ENABLED=false APPSMITH_ENCRYPTION_PASSWORD=abcd APPSMITH_ENCRYPTION_SALT=abcd ./build.sh
```


Expand Down Expand Up @@ -260,7 +260,7 @@ cp envs/dev.env.example .env

This command creates a `.env` file in the `app/server` folder. All run scripts pick up environment configuration from this file.

5. Ensure that the environment variables `APPSMITH_MONGODB_URI` and `APPSMITH_REDIS_URI` in the file `.env` point to your local running instances of MongoDB and Redis.
5. Ensure that the environment variables `APPSMITH_DB_URL` and `APPSMITH_REDIS_URI` in the file `.env` point to your local running instances of MongoDB and Redis.

6. Run the following command to create the final JAR for the Appsmith server:

Expand All @@ -274,7 +274,7 @@ Note:
- On Ubuntu Linux environment docker needs root privilege, hence ./build.sh script needs to be run with root privilege as well.
- On Ubuntu Linux environment, the script may not be able to read .env file, so it is advised that you run the cmd like:
```console
sudo APPSMITH_MONGODB_URI="mongodb://localhost:27017/appsmith" APPSMITH_REDIS_URL="redis://127.0.0.1:6379" APPSMITH_MAIL_ENABLED=false APPSMITH_ENCRYPTION_PASSWORD=abcd APPSMITH_ENCRYPTION_SALT=abcd ./build.sh
sudo APPSMITH_DB_URL="mongodb://localhost:27017/appsmith" APPSMITH_REDIS_URL="redis://127.0.0.1:6379" APPSMITH_MAIL_ENABLED=false APPSMITH_ENCRYPTION_PASSWORD=abcd APPSMITH_ENCRYPTION_SALT=abcd ./build.sh
```
- If the volume containing docker's data root path (macOS: `~/Library/Containers/com.docker.docker/Data/vms/0/`, Ubuntu: `/var/lib/docker/`) has less than 2 GB of free space, then the script may fail with the following error:
```console
Expand Down
43 changes: 34 additions & 9 deletions deploy/docker/fs/opt/appsmith/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,28 @@ unset_unused_variables() {
fi
}

check_mongodb_uri() {
echo "Checking APPSMITH_MONGODB_URI"
configure_database_connection_url() {
echo "Configuring database connection URL"
isPostgresUrl=0
isMongoUrl=0
# Check if APPSMITH_DB_URL is not set
if [[ -z "${APPSMITH_DB_URL}" ]]; then
# If APPSMITH_DB_URL is not set, fall back to APPSMITH_MONGODB_URI
export APPSMITH_DB_URL="${APPSMITH_MONGODB_URI}"
fi

if [[ "${APPSMITH_DB_URL}" == "postgresql:"* ]]; then
isPostgresUrl=1
elif [[ "${APPSMITH_DB_URL}" == "mongodb"* ]]; then
isMongoUrl=1
fi
}

check_db_uri() {
echo "Checking APPSMITH_DB_URL"
isUriLocal=1
if [[ $APPSMITH_MONGODB_URI == *"localhost"* || $APPSMITH_MONGODB_URI == *"127.0.0.1"* ]]; then
echo "Detected local MongoDB"
if [[ $APPSMITH_DB_URL == *"localhost"* || $APPSMITH_DB_URL == *"127.0.0.1"* ]]; then
echo "Detected local DB"
isUriLocal=0
fi
}
Expand Down Expand Up @@ -239,7 +256,7 @@ init_replica_set() {
mongod --fork --port 27017 --dbpath "$MONGO_DB_PATH" --logpath "$MONGO_LOG_PATH" --replSet mr1 --keyFile "$MONGODB_TMP_KEY_PATH" --bind_ip localhost
echo "Waiting 10s for MongoDB to start with Replica Set"
sleep 10
mongosh "$APPSMITH_MONGODB_URI" --eval 'rs.initiate()'
mongosh "$APPSMITH_DB_URL" --eval 'rs.initiate()'
mongod --dbpath "$MONGO_DB_PATH" --shutdown || true
fi

Expand Down Expand Up @@ -477,11 +494,19 @@ print_appsmith_info
init_loading_pages
unset_unused_variables

check_mongodb_uri
configure_database_connection_url
check_db_uri
# Don't run MongoDB if running in a Heroku dyno.
if [[ -z "${DYNO}" ]]; then
# Don't run MongoDB if running in a Heroku dyno.
init_mongodb
init_replica_set
if [[ $isMongoUrl -eq 1 ]]; then
# Setup MongoDB and initialize replica set
echo "Initializing MongoDB"
init_mongodb
init_replica_set
elif [[ $isPostgresUrl -eq 1 ]]; then
echo "Initializing Postgres"
# init_postgres
fi
else
# These functions are used to limit heap size for Backend process when deployed on Heroku
get_maximum_heap
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker/fs/opt/appsmith/mongodb-fixer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ done
echo "MongoDB is RUNNING"

for _ in {1..60}; do
if mongosh --quiet "$APPSMITH_MONGODB_URI" --eval '
if mongosh --quiet "$APPSMITH_DB_URL" --eval '
parseFloat(db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1}).featureCompatibilityVersion.version) < 5 &&
db.adminCommand({setFeatureCompatibilityVersion: "5.0"})
'; then
Expand Down
Loading