From 1af752cdcb7c5e634874041a3d55b72c6cf6af7e Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:09:19 +0530 Subject: [PATCH 01/26] refactor: move isProduction variable --- server/src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/server.ts b/server/src/server.ts index e6fee5f2..87f334d2 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -18,6 +18,7 @@ import { fork } from 'child_process'; import { capture } from "./utils/analytics"; import swaggerUi from 'swagger-ui-express'; import swaggerSpec from './swagger/config'; +const isProduction = process.env.NODE_ENV === 'production'; const app = express(); app.use(cors({ @@ -62,7 +63,6 @@ readdirSync(path.join(__dirname, 'api')).forEach((r) => { } }); -const isProduction = process.env.NODE_ENV === 'production'; const workerPath = path.resolve(__dirname, isProduction ? './worker.js' : './worker.ts'); let workerProcess: any; From 45c34196533a508e0170a6e1c05282b59a093a76 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:10:32 +0530 Subject: [PATCH 02/26] feat: allow origins based on node env --- server/src/server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/server.ts b/server/src/server.ts index 87f334d2..26263f3a 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -19,6 +19,7 @@ import { capture } from "./utils/analytics"; import swaggerUi from 'swagger-ui-express'; import swaggerSpec from './swagger/config'; const isProduction = process.env.NODE_ENV === 'production'; +const allowedOrigin = isProduction ? process.env.ALLOWED_ORIGIN : '*'; const app = express(); app.use(cors({ From 52d9869b84bfde48cc2f62d31036249e11f53fd0 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:14:38 +0530 Subject: [PATCH 03/26] feat: rename to ALLOWED_PUBLIC_URL --- server/src/server.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/src/server.ts b/server/src/server.ts index 26263f3a..e69a9b1f 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -19,12 +19,18 @@ import { capture } from "./utils/analytics"; import swaggerUi from 'swagger-ui-express'; import swaggerSpec from './swagger/config'; const isProduction = process.env.NODE_ENV === 'production'; -const allowedOrigin = isProduction ? process.env.ALLOWED_ORIGIN : '*'; +const allowedOrigin = isProduction ? process.env.ALLOWED_PUBLIC_URL : '*'; const app = express(); app.use(cors({ - origin: 'http://localhost:5173', - credentials: true, + origin: (origin, callback) => { + if (!isProduction || origin === allowedOrigin || allowedOrigin === '*') { + callback(null, true); // Allow all in development or match production origin + } else { + callback(new Error('Not allowed by CORS')); // Block unexpected origins in production + } + }, + credentials: true, // Include credentials if needed })); app.use(express.json()); From ed7690cb290a591749b05e0c65f7232454afdb4f Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:24:50 +0530 Subject: [PATCH 04/26] feat: dynamically set origin --- server/src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/server.ts b/server/src/server.ts index e69a9b1f..832b84da 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -99,7 +99,7 @@ app.get('/', function (req, res) { // Add CORS headers app.use((req, res, next) => { - res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Origin', allowedOrigin); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); if (req.method === 'OPTIONS') { From c60612124915038bb83b32dba0a10f44ecfd9746 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:25:25 +0530 Subject: [PATCH 05/26] feat: include credentials if needed --- server/src/server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/server.ts b/server/src/server.ts index 832b84da..135542bd 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -102,6 +102,7 @@ app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', allowedOrigin); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); + res.header('Access-Control-Allow-Credentials', 'true'); if (req.method === 'OPTIONS') { return res.sendStatus(200); } From 011eee4593411da89a799dd0c4b4c89e11eb10da Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:27:16 +0530 Subject: [PATCH 06/26] feat: handle only preflight & additional headers --- server/src/server.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/src/server.ts b/server/src/server.ts index 135542bd..1467e0c7 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -99,10 +99,8 @@ app.get('/', function (req, res) { // Add CORS headers app.use((req, res, next) => { - res.header('Access-Control-Allow-Origin', allowedOrigin); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); - res.header('Access-Control-Allow-Credentials', 'true'); if (req.method === 'OPTIONS') { return res.sendStatus(200); } From accd0332a354ab9d6226ddec78a403b6d4384c1f Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:39:56 +0530 Subject: [PATCH 07/26] feat: simplify to use process.env.PUBLIC_URL --- server/src/server.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/server/src/server.ts b/server/src/server.ts index 1467e0c7..7965d6bd 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -18,19 +18,11 @@ import { fork } from 'child_process'; import { capture } from "./utils/analytics"; import swaggerUi from 'swagger-ui-express'; import swaggerSpec from './swagger/config'; -const isProduction = process.env.NODE_ENV === 'production'; -const allowedOrigin = isProduction ? process.env.ALLOWED_PUBLIC_URL : '*'; const app = express(); app.use(cors({ - origin: (origin, callback) => { - if (!isProduction || origin === allowedOrigin || allowedOrigin === '*') { - callback(null, true); // Allow all in development or match production origin - } else { - callback(new Error('Not allowed by CORS')); // Block unexpected origins in production - } - }, - credentials: true, // Include credentials if needed + origin: process.env.PUBLIC_URL ? process.env.PUBLIC_URL : 'http://localhost:5173', + credentials: true, })); app.use(express.json()); @@ -70,6 +62,7 @@ readdirSync(path.join(__dirname, 'api')).forEach((r) => { } }); +const isProduction = process.env.NODE_ENV === 'production'; const workerPath = path.resolve(__dirname, isProduction ? './worker.js' : './worker.ts'); let workerProcess: any; @@ -99,6 +92,7 @@ app.get('/', function (req, res) { // Add CORS headers app.use((req, res, next) => { + res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); if (req.method === 'OPTIONS') { From b97df3522af773a76b689aab9865aa9977eb92bb Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:40:36 +0530 Subject: [PATCH 08/26] feat: ensure access-control-allow-origin matches public url --- server/src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/server.ts b/server/src/server.ts index 7965d6bd..20ef14e7 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -92,7 +92,7 @@ app.get('/', function (req, res) { // Add CORS headers app.use((req, res, next) => { - res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Origin', process.env.PUBLIC_URL || 'http://localhost:5173'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); if (req.method === 'OPTIONS') { From 27148072dcf1b25627b6691768eea60e55675c1c Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:41:21 +0530 Subject: [PATCH 09/26] feat: set credentials to true --- server/src/server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/server.ts b/server/src/server.ts index 20ef14e7..8c28c2d2 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -95,6 +95,7 @@ app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', process.env.PUBLIC_URL || 'http://localhost:5173'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); + res.header('Access-Control-Allow-Credentials', 'true'); if (req.method === 'OPTIONS') { return res.sendStatus(200); } From 6b664a00d1a801cd6e83173b1763e284dfb3b35f Mon Sep 17 00:00:00 2001 From: Karishma Shukla Date: Tue, 3 Dec 2024 21:49:43 +0530 Subject: [PATCH 10/26] feat: add PUBLIC_URL variable --- ENVEXAMPLE | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ENVEXAMPLE b/ENVEXAMPLE index a387785f..0153f820 100644 --- a/ENVEXAMPLE +++ b/ENVEXAMPLE @@ -14,9 +14,10 @@ MINIO_SECRET_KEY=minio_secret_key # MinIO secret key REDIS_HOST=redis # Redis host in Docker REDIS_PORT=6379 # Redis port (default: 6379) -# Backend URLs -BACKEND_URL=http://localhost:8080 # Internal URL for backend service -VITE_BACKEND_URL=http://localhost:8080 # URL used by frontend to connect to backend +# Backend and Frontend URLs +BACKEND_URL=http://localhost:8080 # URL on which the backend runs. You can change it based on your needs. +VITE_BACKEND_URL=http://localhost:8080 # URL used by frontend to connect to backend. It should always have the same value as BACKEND_URL +PUBLIC_URL=http://localhost:5173 # URL used by backend to connect to frontend. You can change it based on your needs. # Optional Google OAuth settings for Google Sheet Integration GOOGLE_CLIENT_ID=your_google_client_id From 064318ea92196d4ef6f87a3f363c049fd1976eb9 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 21:55:02 +0530 Subject: [PATCH 11/26] feat: redirect based on PUBLIC_URL --- server/src/routes/auth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/routes/auth.ts b/server/src/routes/auth.ts index 692add99..cc3d879b 100644 --- a/server/src/routes/auth.ts +++ b/server/src/routes/auth.ts @@ -384,7 +384,7 @@ router.get( httpOnly: false, maxAge: 60000, }); - res.redirect(`http://localhost:5173`); + res.redirect(process.env.PUBLIC_URL as string || "http://localhost:5173"); } catch (error: any) { res.status(500).json({ message: `Google OAuth error: ${error.message}` }); } From bf80c41e19efe7f23fad91ed7ea42b88a8887103 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Tue, 3 Dec 2024 23:52:55 +0530 Subject: [PATCH 12/26] feat: handle VITE_PUBLIC_URL --- vite.config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vite.config.js b/vite.config.js index 59f495a1..9ca574eb 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,11 +1,20 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; +import dotenv from 'dotenv'; +dotenv.config(); export default defineConfig(() => { + const publicUrl = process.env.VITE_PUBLIC_URL || 'http://localhost:5173'; + return { define: { 'import.meta.env.VITE_BACKEND_URL': JSON.stringify(process.env.VITE_BACKEND_URL), + 'import.meta.env.VITE_PUBLIC_URL': JSON.stringify(publicUrl), }, + server: { + host: new URL(publicUrl).hostname, + port: parseInt(new URL(publicUrl).port), + }, build: { outDir: 'build', manifest: true, From 0299d90657939cebc8328e82ade9d3a3bab5405d Mon Sep 17 00:00:00 2001 From: Karishma Shukla Date: Tue, 3 Dec 2024 23:56:09 +0530 Subject: [PATCH 13/26] feat: add VITE_PUBLIC_URL variable --- ENVEXAMPLE | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ENVEXAMPLE b/ENVEXAMPLE index 0153f820..3de361d6 100644 --- a/ENVEXAMPLE +++ b/ENVEXAMPLE @@ -17,7 +17,9 @@ REDIS_PORT=6379 # Redis port (default: 6379) # Backend and Frontend URLs BACKEND_URL=http://localhost:8080 # URL on which the backend runs. You can change it based on your needs. VITE_BACKEND_URL=http://localhost:8080 # URL used by frontend to connect to backend. It should always have the same value as BACKEND_URL -PUBLIC_URL=http://localhost:5173 # URL used by backend to connect to frontend. You can change it based on your needs. + +PUBLIC_URL=http://localhost:5173 # URL on which the frontend runs. You can change it based on your needs. +VITE_PUBLIC_URL=http://localhost:5173 # URL used by backend to connect to frontend. It should always have the same value as PUBLIC_URL # Optional Google OAuth settings for Google Sheet Integration GOOGLE_CLIENT_ID=your_google_client_id From 4ba9a08973684432e34728d2d200f579a502eec5 Mon Sep 17 00:00:00 2001 From: Karishma Shukla Date: Tue, 3 Dec 2024 23:58:09 +0530 Subject: [PATCH 14/26] docs: VITE_PUBLIC_URL & PUBLIC_URL --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dd562422..b0f44e08 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ You can access the frontend at http://localhost:5173/ and backend at http://loca |-----------------------|-----------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------| | `BACKEND_URL` | Yes | URL to run backend on. | Default value: http://localhost:8080 | | `VITE_BACKEND_URL` | Yes | URL used by frontend to connect to backend | Default value: http://localhost:8080 | +| `PUBLIC_URL` | Yes | URL to run frontend on. | Default value: http://localhost:5173 | +| `VITE_PUBLIC_URL` | Yes | URL used by backend to connect to frontend | Default value: http://localhost:5173 | | `JWT_SECRET` | Yes | Secret key used to sign and verify JSON Web Tokens (JWTs) for authentication. | JWT authentication will not work. | | `DB_NAME` | Yes | Name of the Postgres database to connect to. | Database connection will fail. | | `DB_USER` | Yes | Username for Postgres database authentication. | Database connection will fail. | From 597ac392643a27469cf00a5ff321618f15514cdb Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 18:08:18 +0530 Subject: [PATCH 15/26] feat: use DB_PORT --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8b26973b..6b38f634 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: ${DB_NAME} ports: - - "5432:5432" + - "${DB_PORT}:${DB_PORT}" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: From 76b2d5ad2d4683107954347cff6c561d754f0f75 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 18:09:04 +0530 Subject: [PATCH 16/26] feat: use REDIS_PORT --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6b38f634..805473c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: REDIS_HOST: ${REDIS_HOST} REDIS_PORT: ${REDIS_PORT} ports: - - "6379:6379" + - "${REDIS_PORT}:${REDIS_PORT}" volumes: - redis_data:/data From 72fbc483f07a188ad565fbe5b99dd04a0e379559 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 18:14:24 +0530 Subject: [PATCH 17/26] feat: use MINIO_PORT --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 805473c2..6d221ce8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,7 @@ services: MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY} command: server /data --console-address :9001 ports: - - "9000:9000" # API port + - "${MINIO_PORT}:${MINIO_PORT}" # API port - "9001:9001" # WebUI port volumes: - minio_data:/data From 3bacc7aad51229283e776a3c166ef7da5ed6d7f4 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 19:51:29 +0530 Subject: [PATCH 18/26] feat: use FRONTEND_PORT and BACKEND_PORT --- docker-compose.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6d221ce8..4b0d59f1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,9 +45,10 @@ services: #dockerfile: server/Dockerfile image: getmaxun/maxun-backend:v0.0.2 ports: - - "8080:8080" + - "${BACKEND_PORT}:${BACKEND_PORT}" env_file: .env environment: + BACKEND_URL: ${BACKEND_URL} # to ensure Playwright works in Docker PLAYWRIGHT_BROWSERS_PATH: /ms-playwright PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 0 @@ -74,8 +75,11 @@ services: #dockerfile: Dockerfile image: getmaxun/maxun-frontend:v0.0.1 ports: - - "5173:5173" + - "${FRONTEND_PORT}:${FRONTEND_PORT}" env_file: .env + environment: + PUBLIC_URL: ${PUBLIC_URL} + BACKEND_URL: ${BACKEND_URL} volumes: - ./:/app # Mount entire frontend app directory for hot reloading - /app/node_modules # Anonymous volume to prevent overwriting node_modules From abdcb36c44bfa081a28d4a625abfa052e45973df Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 19:52:17 +0530 Subject: [PATCH 19/26] chore: format --- docker-compose.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4b0d59f1..41372cf2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,9 +57,8 @@ services: CHROMIUM_FLAGS: '--disable-gpu --no-sandbox --headless=new' security_opt: - seccomp=unconfined # This might help with browser sandbox issues - # Increase shared memory size for Chromium - shm_size: '2gb' - mem_limit: 2g # Set a 2GB memory limit + shm_size: '2gb' # Increase shared memory size for Chromium + mem_limit: 2g # Set a 2GB memory limit depends_on: - postgres - redis @@ -82,7 +81,7 @@ services: BACKEND_URL: ${BACKEND_URL} volumes: - ./:/app # Mount entire frontend app directory for hot reloading - - /app/node_modules # Anonymous volume to prevent overwriting node_modules + - /app/node_modules # Anonymous volume to prevent overwriting node_modules depends_on: - backend From e9517d67d4d7631b38394890e8716baa084cf2e5 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 20:17:12 +0530 Subject: [PATCH 20/26] fix: use process.env.BACKEND_PORT --- server/src/constants/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/constants/config.ts b/server/src/constants/config.ts index 74d9de4c..1943fbe4 100644 --- a/server/src/constants/config.ts +++ b/server/src/constants/config.ts @@ -1,4 +1,4 @@ -export const SERVER_PORT = process.env.SERVER_PORT ? Number(process.env.SERVER_PORT) : 8080 +export const SERVER_PORT = process.env.BACKEND_PORT ? Number(process.env.BACKEND_PORT) : 8080 export const DEBUG = process.env.DEBUG === 'true' export const LOGS_PATH = process.env.LOGS_PATH ?? 'server/logs' export const ANALYTICS_ID = 'oss' \ No newline at end of file From 7f7221e4e41f268ebc6e48bc1d4ebfc915fd8986 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 20:20:42 +0530 Subject: [PATCH 21/26] feat: use MINIO_CONSOLE_PORT --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 41372cf2..9308a563 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,10 +32,10 @@ services: environment: MINIO_ROOT_USER: ${MINIO_ACCESS_KEY} MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY} - command: server /data --console-address :9001 + command: server /data --console-address :${MINIO_CONSOLE_PORT} ports: - "${MINIO_PORT}:${MINIO_PORT}" # API port - - "9001:9001" # WebUI port + - "${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT}" # WebUI port volumes: - minio_data:/data From 6f8d976c9fd9687c07bb2aa0f5a8411711e77356 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 20:24:37 +0530 Subject: [PATCH 22/26] feat: set default ports --- docker-compose.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9308a563..a80b7328 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: ${DB_NAME} ports: - - "${DB_PORT}:${DB_PORT}" + - "${DB_PORT:-5432}:${DB_PORT:-5432}" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: @@ -23,7 +23,7 @@ services: REDIS_HOST: ${REDIS_HOST} REDIS_PORT: ${REDIS_PORT} ports: - - "${REDIS_PORT}:${REDIS_PORT}" + - "${REDIS_PORT:-6379}:${REDIS_PORT:-6379}" volumes: - redis_data:/data @@ -34,8 +34,8 @@ services: MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY} command: server /data --console-address :${MINIO_CONSOLE_PORT} ports: - - "${MINIO_PORT}:${MINIO_PORT}" # API port - - "${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT}" # WebUI port + - "${MINIO_PORT:-9000}:${MINIO_PORT:-9000}" # API port + - "${MINIO_CONSOLE_PORT:-9001}:${MINIO_CONSOLE_PORT:-9001}" # WebUI port volumes: - minio_data:/data @@ -45,7 +45,7 @@ services: #dockerfile: server/Dockerfile image: getmaxun/maxun-backend:v0.0.2 ports: - - "${BACKEND_PORT}:${BACKEND_PORT}" + - "${BACKEND_PORT:-8080}:${BACKEND_PORT:-8080}" env_file: .env environment: BACKEND_URL: ${BACKEND_URL} @@ -74,7 +74,7 @@ services: #dockerfile: Dockerfile image: getmaxun/maxun-frontend:v0.0.1 ports: - - "${FRONTEND_PORT}:${FRONTEND_PORT}" + - "${FRONTEND_PORT:-5173}:${FRONTEND_PORT:-5173}" env_file: .env environment: PUBLIC_URL: ${PUBLIC_URL} From d41481b0b73be2428b32ef73306d91eb41d78828 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Wed, 4 Dec 2024 20:34:01 +0530 Subject: [PATCH 23/26] fix: pass default minio port --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a80b7328..dcab91a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: environment: MINIO_ROOT_USER: ${MINIO_ACCESS_KEY} MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY} - command: server /data --console-address :${MINIO_CONSOLE_PORT} + command: server /data --console-address :${MINIO_CONSOLE_PORT:-9001} ports: - "${MINIO_PORT:-9000}:${MINIO_PORT:-9000}" # API port - "${MINIO_CONSOLE_PORT:-9001}:${MINIO_CONSOLE_PORT:-9001}" # WebUI port From ca194cd9de50f157faf6a5520a731af8d925b4e8 Mon Sep 17 00:00:00 2001 From: Karishma Shukla Date: Wed, 4 Dec 2024 20:58:31 +0530 Subject: [PATCH 24/26] feat: add v0.0.3 env variables --- ENVEXAMPLE | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ENVEXAMPLE b/ENVEXAMPLE index 3de361d6..650c7027 100644 --- a/ENVEXAMPLE +++ b/ENVEXAMPLE @@ -9,16 +9,18 @@ DB_PORT=5432 # Port for PostgreSQL (default: 5432) ENCRYPTION_KEY=f4d5e6a7b8c9d0e1f23456789abcdef01234567890abcdef123456789abcdef0 # Key for encrypting sensitive data (passwords and proxies) MINIO_ENDPOINT=minio # MinIO endpoint in Docker MINIO_PORT=9000 # Port for MinIO (default: 9000) +MINIO_CONSOLE_PORT=9001 # Web UI Port for MinIO (default: 9001) MINIO_ACCESS_KEY=minio_access_key # MinIO access key MINIO_SECRET_KEY=minio_secret_key # MinIO secret key REDIS_HOST=redis # Redis host in Docker REDIS_PORT=6379 # Redis port (default: 6379) -# Backend and Frontend URLs +# Backend and Frontend URLs and Ports +BACKEND_PORT=8080 # Port to run backend on. Needed for Docker setup +FRONTEND_PORT=5173 # Port to run frontend on. Needed for Docker setup BACKEND_URL=http://localhost:8080 # URL on which the backend runs. You can change it based on your needs. -VITE_BACKEND_URL=http://localhost:8080 # URL used by frontend to connect to backend. It should always have the same value as BACKEND_URL - PUBLIC_URL=http://localhost:5173 # URL on which the frontend runs. You can change it based on your needs. +VITE_BACKEND_URL=http://localhost:8080 # URL used by frontend to connect to backend. It should always have the same value as BACKEND_URL VITE_PUBLIC_URL=http://localhost:5173 # URL used by backend to connect to frontend. It should always have the same value as PUBLIC_URL # Optional Google OAuth settings for Google Sheet Integration From e62239f5245dc53a7e11b2edd87b92984d105640 Mon Sep 17 00:00:00 2001 From: Karishma Shukla Date: Wed, 4 Dec 2024 21:01:37 +0530 Subject: [PATCH 25/26] docs: BACKEND_PORT and FRONTEND_PORT --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b0f44e08..f7b5977b 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,8 @@ You can access the frontend at http://localhost:5173/ and backend at http://loca | Variable | Mandatory | Description | If Not Set | |-----------------------|-----------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `BACKEND_PORT` | Yes | Port to run backend on. Needed for Docker setup | Default value: 8080 | +| `FRONTEND_PORT` | Yes | Port to run frontend on. Needed for Docker setup | Default value: 5173 | | `BACKEND_URL` | Yes | URL to run backend on. | Default value: http://localhost:8080 | | `VITE_BACKEND_URL` | Yes | URL used by frontend to connect to backend | Default value: http://localhost:8080 | | `PUBLIC_URL` | Yes | URL to run frontend on. | Default value: http://localhost:5173 | From 6e3266ea045e07784bfece857f54b6827af8025d Mon Sep 17 00:00:00 2001 From: Karishma Shukla Date: Wed, 4 Dec 2024 21:03:37 +0530 Subject: [PATCH 26/26] docs: add MINIO_CONSOLE_PORT --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f7b5977b..fb2c4845 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ You can access the frontend at http://localhost:5173/ and backend at http://loca | `ENCRYPTION_KEY` | Yes | Key used for encrypting sensitive data (proxies, passwords). | Encryption functionality will not work. | | `MINIO_ENDPOINT` | Yes | Endpoint URL for MinIO, to store Robot Run Screenshots. | Connection to MinIO storage will fail. | | `MINIO_PORT` | Yes | Port number for MinIO service. | Connection to MinIO storage will fail. | +| `MINIO_CONSOLE_PORT` | No | Port number for MinIO WebUI service. Needed for Docker setup. | Cannot access MinIO Web UI. | | `MINIO_ACCESS_KEY` | Yes | Access key for authenticating with MinIO. | MinIO authentication will fail. | | `GOOGLE_CLIENT_ID` | No | Client ID for Google OAuth, used for Google Sheet integration authentication. | Google login will not work. | | `GOOGLE_CLIENT_SECRET`| No | Client Secret for Google OAuth. | Google login will not work. |