From a846bd4952d7ccfa2c7691ac616d99b66b09ce32 Mon Sep 17 00:00:00 2001 From: Sumesh Pradhan Date: Wed, 15 Feb 2023 07:06:02 +0530 Subject: [PATCH] fix: renamed rts port env to APPSMITH_RTS_PORT (#20121) Issue: Nginx and RTS used the same env PORT for binding it's service, while the backend server had the rts port hardcoded on its rts uri. - Renamed env PORT to APPSMITH_RTS_PORT for starting the rts server. - Updated nginx config templates to use env `APPSMITH_RTS_PORT` - Added appsmith.rts.port property in server to use env APPSMITH_RTS_PORT - Updated CommonConfig.java rtsBaseDomain to use appsmith.rts.port --------- Co-authored-by: Shrikant Sharat Kandula --- app/rts/src/server.ts | 6 +++--- .../com/appsmith/server/configurations/CommonConfig.java | 8 ++++++-- .../appsmith/server/configurations/InstanceConfig.java | 2 +- .../com/appsmith/server/services/ce/AstServiceCEImpl.java | 4 ++-- .../src/main/resources/application.properties | 3 +++ .../templates/nginx/nginx-app-http.conf.template.sh | 2 +- .../templates/nginx/nginx-app-https.conf.template.sh | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/rts/src/server.ts b/app/rts/src/server.ts index d87cdd8168..bc7423d1c1 100644 --- a/app/rts/src/server.ts +++ b/app/rts/src/server.ts @@ -35,7 +35,7 @@ if (API_BASE_URL == null || API_BASE_URL === "") { process.exit(1); } -const PORT = process.env.PORT || 8091; +const APPSMITH_RTS_PORT = process.env.APPSMITH_RTS_PORT || 8091; //Disable x-powered-by header to prevent information disclosure const app = express(); @@ -62,8 +62,8 @@ app.use(`${RTS_BASE_API_PATH}`, health_check_routes); server.headersTimeout = 61000; server.keepAliveTimeout = 60000; // Run the server -server.listen(PORT, () => { - log.info(`RTS version ${buildVersion} running at http://localhost:${PORT}`); +server.listen(APPSMITH_RTS_PORT, () => { + log.info(`RTS version ${buildVersion} running at http://localhost:${APPSMITH_RTS_PORT}`); }); export default server; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java index 5994d499a0..a9407b3c64 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java @@ -64,7 +64,8 @@ public class CommonConfig { @Value("${disable.telemetry:true}") private boolean isTelemetryDisabled; - private String rtsBaseDomain = "http://127.0.0.1:8091"; + @Value("${appsmith.rts.port:8091}") + private String rtsPort; private List allowedDomains; @@ -128,5 +129,8 @@ public class CommonConfig { // If `true`, then disable signup. If anything else, including empty string, then signups will be enabled. isSignupDisabled = "true".equalsIgnoreCase(value); } - + + public String getRtsBaseUrl() { + return "http://127.0.0.1:" + rtsPort; + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/InstanceConfig.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/InstanceConfig.java index 63a0705d4b..5258276d62 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/InstanceConfig.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/InstanceConfig.java @@ -149,7 +149,7 @@ public class InstanceConfig implements ApplicationListener