From bbf0484e943bf8f9222d9e2a64c1b04626fae565 Mon Sep 17 00:00:00 2001 From: prasadhonrao Date: Sat, 26 Oct 2024 17:47:01 +0100 Subject: [PATCH] Update k8s YAMLs and remove console stmt --- deploy/docker/docker-compose-mongo.yml | 16 ---------------- deploy/k8s/emptydir-volume/webapp/configmap.yaml | 5 ++++- .../k8s/emptydir-volume/webapp/deployment.yaml | 14 ++++++++------ src/webapp/src/App.js | 3 --- 4 files changed, 12 insertions(+), 26 deletions(-) delete mode 100644 deploy/docker/docker-compose-mongo.yml diff --git a/deploy/docker/docker-compose-mongo.yml b/deploy/docker/docker-compose-mongo.yml deleted file mode 100644 index 998e91a..0000000 --- a/deploy/docker/docker-compose-mongo.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: '3.8' - -services: - mongo: - image: mongo - container_name: devcamper-db - ports: - - 27017:27017 - environment: - - MONGO_INITDB_ROOT_USERNAME=admin - - MONGO_INITDB_ROOT_PASSWORD=password - volumes: - - mongo-data:/data/db - -volumes: - mongo-data: diff --git a/deploy/k8s/emptydir-volume/webapp/configmap.yaml b/deploy/k8s/emptydir-volume/webapp/configmap.yaml index 7e330eb..65b1826 100644 --- a/deploy/k8s/emptydir-volume/webapp/configmap.yaml +++ b/deploy/k8s/emptydir-volume/webapp/configmap.yaml @@ -4,4 +4,7 @@ metadata: name: devcamper-webapp-configmap namespace: devcamper-namespace data: - react_app_devcamper_base_api_uri: 'http://devcamper.webapi/api/v1' + config.json: | + { + "react_app_devcamper_base_api_uri": "http://devcamper.webapi/api/v1" + } diff --git a/deploy/k8s/emptydir-volume/webapp/deployment.yaml b/deploy/k8s/emptydir-volume/webapp/deployment.yaml index df86638..97a2886 100644 --- a/deploy/k8s/emptydir-volume/webapp/deployment.yaml +++ b/deploy/k8s/emptydir-volume/webapp/deployment.yaml @@ -18,12 +18,10 @@ spec: image: prasadhonrao/devcamper-webapp:latest ports: - containerPort: 3000 - env: - - name: REACT_APP_DEVCAMPER_BASE_API_URI - valueFrom: - configMapKeyRef: - name: devcamper-webapp-configmap - key: react_app_devcamper_base_api_uri + volumeMounts: + - name: config-volume + mountPath: /app/build/config/config.json + subPath: config.json resources: limits: memory: '2Gi' @@ -31,3 +29,7 @@ spec: requests: memory: '1Gi' cpu: '1' + volumes: + - name: config-volume + configMap: + name: devcamper-webapp-configmap diff --git a/src/webapp/src/App.js b/src/webapp/src/App.js index 915e50f..2023056 100644 --- a/src/webapp/src/App.js +++ b/src/webapp/src/App.js @@ -19,9 +19,6 @@ import { AuthProvider } from './contexts/AuthContext'; import Layout from './components/Layout'; function App() { - // Log environment variables - console.log('REACT_APP_DEVCAMPER_BASE_API_URI:', process.env.REACT_APP_DEVCAMPER_BASE_API_URI); - return (