From 5821d593bc162a87c1c8febd760652b1e5663fca Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 8 Nov 2024 15:26:00 +0530 Subject: [PATCH 01/25] added docker check to workflow --- .github/workflows/pull-request.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 75588cc4df..9d91c367b6 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -241,6 +241,35 @@ jobs: - name: Validate Documents run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' + Docker-Start-Check: + name: Check if Talawa Admin app starts in Docker + runs-on: ubuntu-latest + steps: + - name: Checkout the Repository + uses: actions/checkout@v4 + + - name: Set up Docker + run: | + sudo apt-get update + sudo apt-get install -y docker.io + + - name: Run Docker Container + run: | + docker run -d --name talawa-admin-container -p 8080:8080 talawa-admin-app + + - name: Check if Talawa Admin App is running + run: | + nc -z localhost 8080 + + curl --fail --silent http://localhost:8080/index.html || exit 1 + + - name: Stop Docker Container + if: always() + run: | + docker stop talawa-admin-app-container + docker rm talawa-admin-app-container + + Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} name: Check Target Branch From 81bbb3e9cf976e37352ae524f886a5ff3f5027f9 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 8 Nov 2024 16:52:39 +0530 Subject: [PATCH 02/25] made recommended changes to docker check in workflow --- .github/workflows/pull-request.yml | 43 +++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 9d91c367b6..099440bfb1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -244,27 +244,46 @@ jobs: Docker-Start-Check: name: Check if Talawa Admin app starts in Docker runs-on: ubuntu-latest + needs: [Code-Quality-Checks] steps: - name: Checkout the Repository uses: actions/checkout@v4 - name: Set up Docker - run: | - sudo apt-get update - sudo apt-get install -y docker.io + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + run: | + docker build -t talawa-admin-app . - - name: Run Docker Container + - name: Run Docker Container run: | - docker run -d --name talawa-admin-container -p 8080:8080 talawa-admin-app - - - name: Check if Talawa Admin App is running + docker run -d --name talawa-admin-app-container -p 8080:8080 talawa-admin-app + + - name: Check if Talawa Admin App is running run: | - nc -z localhost 8080 - - curl --fail --silent http://localhost:8080/index.html || exit 1 + timeout=60 + while ! nc -z localhost 8080 && [ $timeout -gt 0 ]; do + sleep 1 + timeout=$((timeout-1)) + done + + if [ $timeout -eq 0 ]; then + echo "Timeout waiting for application to start" + exit 1 + fi + + # Retry curl up to 3 times with 5s delay + for i in {1..3}; do + if curl --fail --silent http://localhost:8080/index.html; then + exit 0 + fi + sleep 5 + done + exit 1 - - name: Stop Docker Container - if: always() + - name: Stop Docker Container + if: always() run: | docker stop talawa-admin-app-container docker rm talawa-admin-app-container From f8389f61abefdb2edb6c43f9b32759b07ff70283 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 8 Nov 2024 17:31:39 +0530 Subject: [PATCH 03/25] added changes to docker check inn workflow as recommended --- .github/workflows/pull-request.yml | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index df6fda018c..5ce2e16899 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -272,27 +272,12 @@ jobs: run: | docker run -d --name talawa-admin-app-container -p 8080:8080 talawa-admin-app - - name: Check if Talawa Admin App is running - run: | - timeout=60 - while ! nc -z localhost 8080 && [ $timeout -gt 0 ]; do - sleep 1 - timeout=$((timeout-1)) - done - - if [ $timeout -eq 0 ]; then - echo "Timeout waiting for application to start" - exit 1 - fi - - # Retry curl up to 3 times with 5s delay - for i in {1..3}; do - if curl --fail --silent http://localhost:8080/index.html; then - exit 0 - fi - sleep 5 - done - exit 1 + - name: Check if Talawa Admin app starts in Docker + runs-on: ubuntu-latest + needs: [Code-Quality-Checks] + steps: + - name: Checkout the Repository + uses: actions/checkout@v4 - name: Stop Docker Container if: always() From f54dcf2a6e7c520ca91b7870d6309702689818a1 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 8 Nov 2024 17:52:51 +0530 Subject: [PATCH 04/25] added changes --- .github/workflows/pull-request.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5ce2e16899..738e47ad53 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -272,12 +272,18 @@ jobs: run: | docker run -d --name talawa-admin-app-container -p 8080:8080 talawa-admin-app - - name: Check if Talawa Admin app starts in Docker - runs-on: ubuntu-latest - needs: [Code-Quality-Checks] - steps: - - name: Checkout the Repository - uses: actions/checkout@v4 + - name: Check if Talawa Admin App is running + run: | + timeout=60 + while ! nc -z localhost 8080 && [ $timeout -gt 0 ]; do + sleep 1 + timeout=$((timeout-1)) + done + if [ $timeout -eq 0 ]; then + echo "Timeout waiting for application to start" + exit 1 + fi + curl --fail --silent http://localhost:8080/index.html || exit 1 - name: Stop Docker Container if: always() From b93aed69118b9c246aaa5cf2c0ce1333e55fd6ce Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 8 Nov 2024 22:14:02 +0530 Subject: [PATCH 05/25] updated indentation in pull-request.yml file --- .github/workflows/pull-request.yml | 74 +++++++++++++++--------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 738e47ad53..f89fb61dc3 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -254,43 +254,43 @@ jobs: run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' Docker-Start-Check: - name: Check if Talawa Admin app starts in Docker - runs-on: ubuntu-latest - needs: [Code-Quality-Checks] - steps: - - name: Checkout the Repository - uses: actions/checkout@v4 - - - name: Set up Docker - uses: docker/setup-buildx-action@v3 - - - name: Build Docker image - run: | - docker build -t talawa-admin-app . - - - name: Run Docker Container - run: | - docker run -d --name talawa-admin-app-container -p 8080:8080 talawa-admin-app - - - name: Check if Talawa Admin App is running - run: | - timeout=60 - while ! nc -z localhost 8080 && [ $timeout -gt 0 ]; do - sleep 1 - timeout=$((timeout-1)) - done - if [ $timeout -eq 0 ]; then - echo "Timeout waiting for application to start" - exit 1 - fi - curl --fail --silent http://localhost:8080/index.html || exit 1 - - - name: Stop Docker Container - if: always() - run: | - docker stop talawa-admin-app-container - docker rm talawa-admin-app-container + name: Check if Talawa Admin app starts in Docker + runs-on: ubuntu-latest + needs: [Code-Quality-Checks] + steps: + - name: Checkout the Repository + uses: actions/checkout@v4 + + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + - name: Build Docker image + run: | + docker build -t talawa-admin-app . + + - name: Run Docker Container + run: | + docker run -d --name talawa-admin-app-container -p 8080:8080 talawa-admin-app + + - name: Check if Talawa Admin App is running + run: | + timeout=60 + while ! nc -z localhost 8080 && [ $timeout -gt 0 ]; do + sleep 1 + timeout=$((timeout-1)) + done + if [ $timeout -eq 0 ]; then + echo "Timeout waiting for application to start" + exit 1 + fi + curl --fail --silent http://localhost:8080/index.html || exit 1 + + - name: Stop Docker Container + if: always() + run: | + docker stop talawa-admin-app-container + docker rm talawa-admin-app-container + Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} @@ -301,4 +301,4 @@ jobs: if: github.event.pull_request.base.ref != 'develop' run: | echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md" - exit 1 + exit 1 \ No newline at end of file From a0ee51150aa3ab8f4f8b2ec7de9e110d0bb07b4d Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 8 Nov 2024 22:21:58 +0530 Subject: [PATCH 06/25] updated indentation in pull-request.yml file --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index f89fb61dc3..e7e1dda87c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -256,7 +256,7 @@ jobs: Docker-Start-Check: name: Check if Talawa Admin app starts in Docker runs-on: ubuntu-latest - needs: [Code-Quality-Checks] + needs: [Code-Quality-Checks, Test-Application] steps: - name: Checkout the Repository uses: actions/checkout@v4 From 235d1631b475af29f9f6c7d3c33bac47fa2a5247 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Sun, 10 Nov 2024 19:29:42 +0530 Subject: [PATCH 07/25] added Dockerfile and Docker-compose.yml file --- .dockerignore | 9 +++++++++ Dockerfile | 15 +++++++++++++++ config/vite.config.ts | 5 +++-- docker-compose.yaml | 11 +++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..d0adaf2671 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +node_modules +videos +images +data +.env +.git +.gitignore +.github +.dockerignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..fef086f72d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:20.10.0 AS build + +WORKDIR /usr/src/app + +COPY . . + +RUN npm install -g typescript + +RUN npm install + +RUN npm run build + +EXPOSE 4321 + +CMD ["npm", "run", "serve"] \ No newline at end of file diff --git a/config/vite.config.ts b/config/vite.config.ts index 71ce6c6f47..28cd47ae5a 100644 --- a/config/vite.config.ts +++ b/config/vite.config.ts @@ -23,8 +23,9 @@ export default defineConfig({ ], server: { // this ensures that the browser opens upon server start - open: true, - // this sets a default port to 3000 + open: false, + host: '0.0.0.0', + // this sets a default port to 4321 port: 4321, }, }); diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000000..5936109b22 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +services: + app: + build: + context: . + dockerfile: Dockerfile + environment: + - REACT_APP_TALAWA_URL=${REACT_APP_TALAWA_URL} + # volumes: + # - .:/usr/src/app + ports: + - 4321:4321 From 66f48432ee30c0db8ca5941271df5bdd4b4c6bfa Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Sun, 10 Nov 2024 20:54:14 +0530 Subject: [PATCH 08/25] added Dockerfile and Docker-compose.yml file --- .github/workflows/pull-request.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index e7e1dda87c..0950c572c9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -270,12 +270,12 @@ jobs: - name: Run Docker Container run: | - docker run -d --name talawa-admin-app-container -p 8080:8080 talawa-admin-app + docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app - name: Check if Talawa Admin App is running run: | timeout=60 - while ! nc -z localhost 8080 && [ $timeout -gt 0 ]; do + while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do sleep 1 timeout=$((timeout-1)) done @@ -283,7 +283,7 @@ jobs: echo "Timeout waiting for application to start" exit 1 fi - curl --fail --silent http://localhost:8080/index.html || exit 1 + curl --fail --silent http://localhost:4321/ || exit 1 - name: Stop Docker Container if: always() From 0fa9fe5f66b2d4c2a47e35b6962b33537783c812 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Sun, 10 Nov 2024 21:15:05 +0530 Subject: [PATCH 09/25] updated .docker-ignore file --- .dockerignore | 19 ++++++++++++++----- .github/workflows/pull-request.yml | 4 ++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index d0adaf2671..466682cc09 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,18 @@ node_modules -videos -images -data -.env +npm-debug.log +Dockerfile +.dockerignore .git .gitignore +README.md +.env +.env.* +dist +coverage +.nyc_output +*.md .github -.dockerignore \ No newline at end of file +tests +__tests__ +*.test.* +*.spec.* \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0950c572c9..a3e478e5d4 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -274,7 +274,7 @@ jobs: - name: Check if Talawa Admin App is running run: | - timeout=60 + timeout=${HEALTH_CHECK_TIMEOUT:-60} while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do sleep 1 timeout=$((timeout-1)) @@ -283,7 +283,7 @@ jobs: echo "Timeout waiting for application to start" exit 1 fi - curl --fail --silent http://localhost:4321/ || exit 1 + curl --fail --silent http://localhost:4321/health || exit 1 - name: Stop Docker Container if: always() From cfdeff50de91354869a5f7ed05dcc4faf440168b Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Mon, 11 Nov 2024 11:45:24 +0530 Subject: [PATCH 10/25] added recommended changes by code rabbit --- Dockerfile | 6 +++--- docker-compose.yaml | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index fef086f72d..6b13a712b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,12 @@ FROM node:20.10.0 AS build WORKDIR /usr/src/app -COPY . . - -RUN npm install -g typescript +COPY package*.json ./ RUN npm install +COPY . . + RUN npm run build EXPOSE 4321 diff --git a/docker-compose.yaml b/docker-compose.yaml index 5936109b22..069c63bb01 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,7 +5,17 @@ services: dockerfile: Dockerfile environment: - REACT_APP_TALAWA_URL=${REACT_APP_TALAWA_URL} - # volumes: - # - .:/usr/src/app ports: - 4321:4321 + user: node + healthcheck: + test: ['CMD', 'curl', '-f', 'http://localhost:4321'] + interval: 30s + timeout: 10s + retries: 3 + restart: unless-stopped + deploy: + resources: + limits: + cpus: '1' + memory: 1G From e188853def90c0bc0ee26f835684e942329edb7d Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Mon, 11 Nov 2024 11:50:33 +0530 Subject: [PATCH 11/25] added recommended changes by code rabbit --- .github/workflows/pull-request.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index a3e478e5d4..ec9efc486f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -263,14 +263,26 @@ jobs: - name: Set up Docker uses: docker/setup-buildx-action@v3 - + with: + buildkitd-flags: --debug + driver-opts: | + image=moby/buildkit:latest + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Build Docker image run: | + set -e + echo "Building Docker image..." docker build -t talawa-admin-app . + echo "Docker image built successfully" - name: Run Docker Container run: | + set -e + echo "Started Docker container..." docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app + echo "Docker container started successfully" - name: Check if Talawa Admin App is running run: | @@ -290,6 +302,7 @@ jobs: run: | docker stop talawa-admin-app-container docker rm talawa-admin-app-container + exit 1 Check-Target-Branch: From 9a2b42854a4e66fdc3fb8cf86ab89a05aad32b6c Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Mon, 11 Nov 2024 11:57:20 +0530 Subject: [PATCH 12/25] added recommended changes by code rabbit --- .github/workflows/pull-request.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index ec9efc486f..18609bdb16 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -286,7 +286,8 @@ jobs: - name: Check if Talawa Admin App is running run: | - timeout=${HEALTH_CHECK_TIMEOUT:-60} + echo "Starting health check for application on localhost:4321" + timeout=${HEALTH_CHECK_TIMEOUT:-120} while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do sleep 1 timeout=$((timeout-1)) From 12e5474795fa3884ef1855f6db5ddef71975d37c Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Mon, 11 Nov 2024 12:08:34 +0530 Subject: [PATCH 13/25] added recommended changes by code rabbit --- .dockerignore | 13 ++++++++++--- .env.example | 2 ++ .github/workflows/pull-request.yml | 12 +++++++++--- docker-compose.yaml | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 466682cc09..0ef78f43dc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,10 +1,8 @@ node_modules npm-debug.log Dockerfile -.dockerignore .git .gitignore -README.md .env .env.* dist @@ -15,4 +13,13 @@ coverage tests __tests__ *.test.* -*.spec.* \ No newline at end of file +*.spec.* +# Development files +*.log +*.lock +.DS_Store +.idea +.vscode +# Build artifacts +build +out \ No newline at end of file diff --git a/.env.example b/.env.example index de7cff92ec..a4a5137959 100644 --- a/.env.example +++ b/.env.example @@ -29,3 +29,5 @@ REACT_APP_BACKEND_WEBSOCKET_URL=ws://localhost:4000/graphql/ # If you want to logs Compiletime and Runtime error , warning and info write YES or if u want to # keep the console clean leave it blank ALLOW_LOGS= + +REACT_APP_TALAWA_URL=http://localhost:4000 \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 18609bdb16..fb596c3fa8 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -286,24 +286,30 @@ jobs: - name: Check if Talawa Admin App is running run: | - echo "Starting health check for application on localhost:4321" - timeout=${HEALTH_CHECK_TIMEOUT:-120} + timeout="${HEALTH_CHECK_TIMEOUT:-120}" + echo "Starting health check with ${timeout}s timeout" while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do sleep 1 + timeout=$((timeout-1)) + if [ $((timeout % 10)) -eq 0]; then + echo "Still waiting for app to start... ${timeout}s remaining" + fi done if [ $timeout -eq 0 ]; then echo "Timeout waiting for application to start" exit 1 fi + echo "Port check passed, verifying health endpoint..." curl --fail --silent http://localhost:4321/health || exit 1 + echo "Health check passed successfully" - name: Stop Docker Container if: always() run: | docker stop talawa-admin-app-container docker rm talawa-admin-app-container - exit 1 + Check-Target-Branch: diff --git a/docker-compose.yaml b/docker-compose.yaml index 069c63bb01..a852ceddc1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,7 +4,7 @@ services: context: . dockerfile: Dockerfile environment: - - REACT_APP_TALAWA_URL=${REACT_APP_TALAWA_URL} + - REACT_APP_TALAWA_URL=${REACT_APP_TALAWA_URL:?Error: REACT_APP_TALAWA_URL is required} ports: - 4321:4321 user: node From 17a12f7d92f3570792fedc4cc74dbfb4cdf1c11c Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Mon, 11 Nov 2024 12:13:32 +0530 Subject: [PATCH 14/25] added recommended changes by code rabbit --- docker-compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index a852ceddc1..41d3a4dd65 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,7 +12,8 @@ services: test: ['CMD', 'curl', '-f', 'http://localhost:4321'] interval: 30s timeout: 10s - retries: 3 + retries: 5 + start_period: 40s restart: unless-stopped deploy: resources: From a44ecdbdee50619456ccb909244b84ab92ed3020 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Mon, 11 Nov 2024 12:24:49 +0530 Subject: [PATCH 15/25] added recommended changes by code rabbit --- .env.example | 2 -- .github/workflows/pull-request.yml | 4 +++- docker-compose.yaml | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index a4a5137959..de7cff92ec 100644 --- a/.env.example +++ b/.env.example @@ -29,5 +29,3 @@ REACT_APP_BACKEND_WEBSOCKET_URL=ws://localhost:4000/graphql/ # If you want to logs Compiletime and Runtime error , warning and info write YES or if u want to # keep the console clean leave it blank ALLOW_LOGS= - -REACT_APP_TALAWA_URL=http://localhost:4000 \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index fb596c3fa8..ffc815153a 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -292,12 +292,14 @@ jobs: sleep 1 timeout=$((timeout-1)) - if [ $((timeout % 10)) -eq 0]; then + if [ $((timeout % 10)) -eq 0 ]; then echo "Still waiting for app to start... ${timeout}s remaining" fi done if [ $timeout -eq 0 ]; then echo "Timeout waiting for application to start" + echo "Container logs:" + docker logs talawa-admin-app-container exit 1 fi echo "Port check passed, verifying health endpoint..." diff --git a/docker-compose.yaml b/docker-compose.yaml index 41d3a4dd65..ea273ac632 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,7 +9,8 @@ services: - 4321:4321 user: node healthcheck: - test: ['CMD', 'curl', '-f', 'http://localhost:4321'] + test: + ['CMD-SHELL', 'wget --spider -q http://localhost:4321/health || exit 1'] interval: 30s timeout: 10s retries: 5 From 526a2cf76e4f2c850628490a51ae3ccd507acd19 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Mon, 11 Nov 2024 17:22:37 +0530 Subject: [PATCH 16/25] properly formatted code --- .github/workflows/pull-request.yml | 59 ++++++++++++++---------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index ffc815153a..4f8aabfc2f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -46,7 +46,7 @@ jobs: - name: Check formatting if: steps.changed-files.outputs.only_changed != 'true' run: npm run format:check - + - name: Run formatting if check fails if: failure() run: npm run format @@ -57,10 +57,10 @@ jobs: - name: Check for linting errors in modified files if: steps.changed-files.outputs.only_changed != 'true' - env: + env: CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }} run: npx eslint ${CHANGED_FILES} && python .github/workflows/eslint_disable_check.py - + - name: Check for TSDoc comments run: npm run check-tsdoc # Run the TSDoc check script @@ -89,7 +89,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Get Changed Unauthorized files id: changed-unauth-files uses: tj-actions/changed-files@v40 @@ -123,10 +123,10 @@ jobs: ISSUE_GUIDELINES.md PR_GUIDELINES.md README.md - + - name: List all changed unauthorized files if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' - env: + env: CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} run: | for file in ${CHANGED_UNAUTH_FILES}; do @@ -147,14 +147,14 @@ jobs: uses: tj-actions/changed-files@v40 - name: Echo number of changed files - env: + env: CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} run: | echo "Number of files changed: $CHANGED_FILES_COUNT" - name: Check if the number of changed files is less than 100 if: steps.changed-files.outputs.all_changed_files_count > 100 - env: + env: CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} run: | echo "Error: Too many files (greater than 100) changed in the pull request." @@ -194,15 +194,15 @@ jobs: - name: Install Dependencies run: npm install - + - name: Get changed TypeScript files id: changed-files uses: tj-actions/changed-files@v40 - + - name: Run tests if: steps.changed-files.outputs.only_changed != 'true' - run: npm run test -- --watchAll=false --coverage - + run: npm run test -- --watchAll=false --coverage + - name: TypeScript compilation for changed files run: | for file in ${{ steps.changed-files.outputs.all_files }}; do @@ -210,7 +210,7 @@ jobs: npx tsc --noEmit "$file" fi done - + - name: Present and Upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}} uses: codecov/codecov-action@v4 with: @@ -222,7 +222,7 @@ jobs: - name: Test acceptable level of code coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: - path: "./coverage/lcov.info" + path: './coverage/lcov.info' min_coverage: 95.0 Graphql-Inspector: @@ -240,15 +240,15 @@ jobs: - name: resolve dependency run: npm install -g @graphql-inspector/cli - + - name: Clone API Repository run: | # Retrieve the complete branch name directly from the GitHub context FULL_BRANCH_NAME=${{ github.base_ref }} echo "FULL_Branch_NAME: $FULL_BRANCH_NAME" - + # Clone the specified repository using the extracted branch name - git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a + git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a - name: Validate Documents run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' @@ -260,15 +260,14 @@ jobs: steps: - name: Checkout the Repository uses: actions/checkout@v4 - + - name: Set up Docker uses: docker/setup-buildx-action@v3 - with: - buildkitd-flags: --debug - driver-opts: | - image=moby/buildkit:latest - cache-from: type=gha - cache-to: type=gha,mode=max + with: + driver-opts: | + image=moby/buildkit:latest + cache-from: type=gha + cache-to: type=gha,mode=max - name: Build Docker image run: | @@ -276,7 +275,7 @@ jobs: echo "Building Docker image..." docker build -t talawa-admin-app . echo "Docker image built successfully" - + - name: Run Docker Container run: | set -e @@ -303,17 +302,15 @@ jobs: exit 1 fi echo "Port check passed, verifying health endpoint..." - curl --fail --silent http://localhost:4321/health || exit 1 + curl --fail --silent http://localhost:4321/ || exit 1 echo "Health check passed successfully" - - - name: Stop Docker Container + + - name: Stop Docker Container if: always() run: | docker stop talawa-admin-app-container docker rm talawa-admin-app-container - - Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} name: Check Target Branch @@ -323,4 +320,4 @@ jobs: if: github.event.pull_request.base.ref != 'develop' run: | echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md" - exit 1 \ No newline at end of file + exit 1 From d4fca6ff955079d439d4084382480d35910f6a47 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 15 Nov 2024 10:06:49 +0530 Subject: [PATCH 17/25] trying to make docker check pass --- .github/workflows/pull-request.yml | 107 +++++++++++++++-------------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4f8aabfc2f..af6cb6f778 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -254,62 +254,63 @@ jobs: run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' Docker-Start-Check: - name: Check if Talawa Admin app starts in Docker - runs-on: ubuntu-latest - needs: [Code-Quality-Checks, Test-Application] - steps: - - name: Checkout the Repository - uses: actions/checkout@v4 - - - name: Set up Docker - uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - image=moby/buildkit:latest - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Build Docker image - run: | - set -e - echo "Building Docker image..." - docker build -t talawa-admin-app . - echo "Docker image built successfully" + name: Check if Talawa Admin app starts in Docker + runs-on: ubuntu-latest + needs: [Code-Quality-Checks, Test-Application] + steps: + - name: Checkout the Repository + uses: actions/checkout@v4 + + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + image=moby/buildkit:latest + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build Docker image + run: | + set -e + echo "Building Docker image..." + docker build -t talawa-admin-app . + echo "Docker image built successfully" + + - name: Run Docker Container + run: | + set -e + echo "Started Docker container..." + docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app + echo "Docker container started successfully" + + - name: Check if Talawa Admin App is running on port 4321 + run: | + timeout="${HEALTH_CHECK_TIMEOUT:-120}" + echo "Starting health check with ${timeout}s timeout" + + # Wait for the app to open the port 4321 + while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do + sleep 1 + timeout=$((timeout-1)) + if [ $((timeout % 10)) -eq 0 ]; then + echo "Still waiting for app to start... ${timeout}s remaining" + fi + done - - name: Run Docker Container - run: | - set -e - echo "Started Docker container..." - docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app - echo "Docker container started successfully" + if [ $timeout -eq 0 ]; then + echo "Timeout waiting for application to start" + echo "Container logs:" + docker logs talawa-admin-app-container + exit 1 + fi - - name: Check if Talawa Admin App is running - run: | - timeout="${HEALTH_CHECK_TIMEOUT:-120}" - echo "Starting health check with ${timeout}s timeout" - while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do - sleep 1 - - timeout=$((timeout-1)) - if [ $((timeout % 10)) -eq 0 ]; then - echo "Still waiting for app to start... ${timeout}s remaining" - fi - done - if [ $timeout -eq 0 ]; then - echo "Timeout waiting for application to start" - echo "Container logs:" - docker logs talawa-admin-app-container - exit 1 - fi - echo "Port check passed, verifying health endpoint..." - curl --fail --silent http://localhost:4321/ || exit 1 - echo "Health check passed successfully" + echo "Port check passed successfully" - - name: Stop Docker Container - if: always() - run: | - docker stop talawa-admin-app-container - docker rm talawa-admin-app-container + - name: Stop Docker Container + if: always() + run: | + docker stop talawa-admin-app-container + docker rm talawa-admin-app-container Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} From 7966dda7572dc8df715148d5a892f25656da5cfa Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 15 Nov 2024 10:17:21 +0530 Subject: [PATCH 18/25] trying to make docker check pass --- .github/workflows/pull-request.yml | 106 ++++++++++++++--------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index af6cb6f778..f12f363e3e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -254,63 +254,61 @@ jobs: run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' Docker-Start-Check: - name: Check if Talawa Admin app starts in Docker - runs-on: ubuntu-latest - needs: [Code-Quality-Checks, Test-Application] - steps: - - name: Checkout the Repository - uses: actions/checkout@v4 - - - name: Set up Docker - uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - image=moby/buildkit:latest - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Build Docker image - run: | - set -e - echo "Building Docker image..." - docker build -t talawa-admin-app . - echo "Docker image built successfully" - - - name: Run Docker Container - run: | - set -e - echo "Started Docker container..." - docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app - echo "Docker container started successfully" - - - name: Check if Talawa Admin App is running on port 4321 - run: | - timeout="${HEALTH_CHECK_TIMEOUT:-120}" - echo "Starting health check with ${timeout}s timeout" - - # Wait for the app to open the port 4321 - while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do - sleep 1 - timeout=$((timeout-1)) - if [ $((timeout % 10)) -eq 0 ]; then - echo "Still waiting for app to start... ${timeout}s remaining" - fi - done + name: Check if Talawa Admin app starts in Docker + runs-on: ubuntu-latest + needs: [Code-Quality-Checks, Test-Application] + steps: + - name: Checkout the Repository + uses: actions/checkout@v4 - if [ $timeout -eq 0 ]; then - echo "Timeout waiting for application to start" - echo "Container logs:" - docker logs talawa-admin-app-container - exit 1 - fi + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + image=moby/buildkit:latest + cache-from: type=gha + cache-to: type=gha,mode=max - echo "Port check passed successfully" + - name: Build Docker image + run: | + set -e + echo "Building Docker image..." + docker build -t talawa-admin-app . + echo "Docker image built successfully" - - name: Stop Docker Container - if: always() - run: | - docker stop talawa-admin-app-container - docker rm talawa-admin-app-container + - name: Run Docker Container + run: | + set -e + echo "Started Docker container..." + docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app + echo "Docker container started successfully" + + - name: Check if Talawa Admin App is running + run: | + timeout="${HEALTH_CHECK_TIMEOUT:-120}" + echo "Starting health check with ${timeout}s timeout" + while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do + sleep 1 + + timeout=$((timeout-1)) + if [ $((timeout % 10)) -eq 0 ]; then + echo "Still waiting for app to start... ${timeout}s remaining" + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout waiting for application to start" + echo "Container logs:" + docker logs talawa-admin-app-container + exit 1 + fi + echo "Port check passed, verifying health endpoint..." + + - name: Stop Docker Container + if: always() + run: | + docker stop talawa-admin-app-container + docker rm talawa-admin-app-container Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} From 96d5e9aeaf0d942579933cbfd52f06d473236a9b Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 15 Nov 2024 11:40:48 +0530 Subject: [PATCH 19/25] updated INSTALLATION.md --- .github/workflows/pull-request.yml | 2 +- INSTALLATION.md | 25 +++++++++++++++++++++++++ docker-compose.yaml | 23 ----------------------- 3 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 docker-compose.yaml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3500ddf8ad..799cba8ab8 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -287,7 +287,7 @@ jobs: run: | timeout="${HEALTH_CHECK_TIMEOUT:-120}" echo "Starting health check with ${timeout}s timeout" - while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do + while ! nc -z localhost 4321 && [ "$timeout" -gt 0 ]; do sleep 1 timeout=$((timeout-1)) diff --git a/INSTALLATION.md b/INSTALLATION.md index 5813b7d1cb..10c818fa4b 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -13,6 +13,9 @@ This document provides instructions on how to set up and start a running instanc - [Install node.js](#install-nodejs) - [Install TypeScript](#install-typescript) - [Install Required Packages](#install-required-packages) +- [Installation using Docker](#installation-using-docker) + - [Build the Docker Image:](#build-the-docker-image) + - [Run the Docker container:](#run-the-docker-container) - [Configuration](#configuration) - [Creating .env file](#creating-env-file) - [Setting up PORT in .env file](#setting-up-port-in-env-file) @@ -145,6 +148,28 @@ npm install The prerequisites are now installed. The next step will be to get the app up and running. +# Installation using Docker + +If you prefer to use Docker, you can install the app using the following command: + +## Build the Docker Image: + +Run the following command to build the Docker image: + +``` +docker build -t talawa-admin . +``` + +## Run the Docker container: + +After the build is complete, run the Docker container using this command: + +``` +docker run -p 4321:4321 talawa-admin +``` + +This will expose the container's port 4321 on your local machine, making the application accessible at http://localhost:4321. + # Configuration It's important to configure Talawa-Admin. Here's how to do it. diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index ea273ac632..0000000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,23 +0,0 @@ -services: - app: - build: - context: . - dockerfile: Dockerfile - environment: - - REACT_APP_TALAWA_URL=${REACT_APP_TALAWA_URL:?Error: REACT_APP_TALAWA_URL is required} - ports: - - 4321:4321 - user: node - healthcheck: - test: - ['CMD-SHELL', 'wget --spider -q http://localhost:4321/health || exit 1'] - interval: 30s - timeout: 10s - retries: 5 - start_period: 40s - restart: unless-stopped - deploy: - resources: - limits: - cpus: '1' - memory: 1G From ef0894452ffd3fa01152a2cc3c951d65c5668e43 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 15 Nov 2024 11:44:00 +0530 Subject: [PATCH 20/25] updated INSTALLATION.md --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 799cba8ab8..3500ddf8ad 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -287,7 +287,7 @@ jobs: run: | timeout="${HEALTH_CHECK_TIMEOUT:-120}" echo "Starting health check with ${timeout}s timeout" - while ! nc -z localhost 4321 && [ "$timeout" -gt 0 ]; do + while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do sleep 1 timeout=$((timeout-1)) From 8236c9a9f495630df92ce14635aa0b1b77713518 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 15 Nov 2024 12:35:30 +0530 Subject: [PATCH 21/25] added recommended changes to INSTALLATION.md --- INSTALLATION.md | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/INSTALLATION.md b/INSTALLATION.md index 10c818fa4b..22b9af3bd3 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -14,8 +14,8 @@ This document provides instructions on how to set up and start a running instanc - [Install TypeScript](#install-typescript) - [Install Required Packages](#install-required-packages) - [Installation using Docker](#installation-using-docker) - - [Build the Docker Image:](#build-the-docker-image) - - [Run the Docker container:](#run-the-docker-container) + - [Development Setup](#development-setup) + - [Production Setup](#production-setup) - [Configuration](#configuration) - [Creating .env file](#creating-env-file) - [Setting up PORT in .env file](#setting-up-port-in-env-file) @@ -150,9 +150,17 @@ The prerequisites are now installed. The next step will be to get the app up and # Installation using Docker +1. Install Docker on your system: + - [Docker Desktop for Windows/Mac](https://www.docker.com/products/docker-desktop) + - [Docker Engine for Linux](https://docs.docker.com/engine/install/) + +## Development Setup + If you prefer to use Docker, you can install the app using the following command: -## Build the Docker Image: +1. Create a `.env` file as described in the Configuration section + +2. Build the Docker Image: Run the following command to build the Docker image: @@ -160,7 +168,7 @@ Run the following command to build the Docker image: docker build -t talawa-admin . ``` -## Run the Docker container: +3. Run the Docker container: After the build is complete, run the Docker container using this command: @@ -168,7 +176,23 @@ After the build is complete, run the Docker container using this command: docker run -p 4321:4321 talawa-admin ``` -This will expose the container's port 4321 on your local machine, making the application accessible at http://localhost:4321. +The application will be accessible at `http://localhost:4321` + +## Production Setup + +1. Build the Docker image: + + ```bash + docker build -t talawa-admin . + ``` + +2. Run the container: + ```bash + docker run -p 4321:4321 \ + -e REACT_APP_TALAWA_URL=http://your-api-url:4000/graphql/ \ + -e REACT_APP_BACKEND_WEBSOCKET_URL=ws://your-api-url:4000/graphql/ \ + talawa-admin + ``` # Configuration From b09c6966d59929b13e14ab6a0cca36a49d78b675 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 15 Nov 2024 12:38:36 +0530 Subject: [PATCH 22/25] added recommended changes to INSTALLATION.md --- INSTALLATION.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/INSTALLATION.md b/INSTALLATION.md index 22b9af3bd3..3f94f16bdc 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -14,6 +14,7 @@ This document provides instructions on how to set up and start a running instanc - [Install TypeScript](#install-typescript) - [Install Required Packages](#install-required-packages) - [Installation using Docker](#installation-using-docker) + - [Prerequisites](#prerequisites-1) - [Development Setup](#development-setup) - [Production Setup](#production-setup) - [Configuration](#configuration) @@ -150,6 +151,8 @@ The prerequisites are now installed. The next step will be to get the app up and # Installation using Docker +## Prerequisites + 1. Install Docker on your system: - [Docker Desktop for Windows/Mac](https://www.docker.com/products/docker-desktop) - [Docker Engine for Linux](https://docs.docker.com/engine/install/) From c8c42a4326b7668c160aea61935048c173abe554 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Fri, 15 Nov 2024 13:04:24 +0530 Subject: [PATCH 23/25] added recommended changes to INSTALLATION.md --- INSTALLATION.md | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/INSTALLATION.md b/INSTALLATION.md index 3f94f16bdc..c4badf8ec7 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -15,8 +15,7 @@ This document provides instructions on how to set up and start a running instanc - [Install Required Packages](#install-required-packages) - [Installation using Docker](#installation-using-docker) - [Prerequisites](#prerequisites-1) - - [Development Setup](#development-setup) - - [Production Setup](#production-setup) + - [Development Setup](#development-setup) - [Configuration](#configuration) - [Creating .env file](#creating-env-file) - [Setting up PORT in .env file](#setting-up-port-in-env-file) @@ -157,7 +156,7 @@ The prerequisites are now installed. The next step will be to get the app up and - [Docker Desktop for Windows/Mac](https://www.docker.com/products/docker-desktop) - [Docker Engine for Linux](https://docs.docker.com/engine/install/) -## Development Setup +### Development Setup If you prefer to use Docker, you can install the app using the following command: @@ -181,22 +180,6 @@ docker run -p 4321:4321 talawa-admin The application will be accessible at `http://localhost:4321` -## Production Setup - -1. Build the Docker image: - - ```bash - docker build -t talawa-admin . - ``` - -2. Run the container: - ```bash - docker run -p 4321:4321 \ - -e REACT_APP_TALAWA_URL=http://your-api-url:4000/graphql/ \ - -e REACT_APP_BACKEND_WEBSOCKET_URL=ws://your-api-url:4000/graphql/ \ - talawa-admin - ``` - # Configuration It's important to configure Talawa-Admin. Here's how to do it. From aa1cb0541bf3466c8212676a208ec4a3a12b9bdf Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Sun, 17 Nov 2024 10:18:48 +0530 Subject: [PATCH 24/25] updated docker workflow --- .github/workflows/pull-request.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3500ddf8ad..bee9bb3722 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -257,6 +257,7 @@ jobs: name: Check if Talawa Admin app starts in Docker runs-on: ubuntu-latest needs: [Code-Quality-Checks, Test-Application] + if: github.actor != 'dependabot' steps: - name: Checkout the Repository uses: actions/checkout@v4 From 97bb5e6c369058f9a50edd86a8f72d837d5dadd4 Mon Sep 17 00:00:00 2001 From: VanshikaSabharwal Date: Sun, 17 Nov 2024 10:32:42 +0530 Subject: [PATCH 25/25] updated INSTALLATION.md --- .github/workflows/pull-request.yml | 2 - INSTALLATION.md | 62 +++++++++++++++++------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index bee9bb3722..7eb62357c1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -267,8 +267,6 @@ jobs: with: driver-opts: | image=moby/buildkit:latest - cache-from: type=gha - cache-to: type=gha,mode=max - name: Build Docker image run: | diff --git a/INSTALLATION.md b/INSTALLATION.md index c4badf8ec7..3c09f69e33 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -16,25 +16,6 @@ This document provides instructions on how to set up and start a running instanc - [Installation using Docker](#installation-using-docker) - [Prerequisites](#prerequisites-1) - [Development Setup](#development-setup) -- [Configuration](#configuration) - - [Creating .env file](#creating-env-file) - - [Setting up PORT in .env file](#setting-up-port-in-env-file) - - [Setting up REACT_APP_TALAWA_URL in .env file](#setting-up-react_app_talawa_url-in-env-file) - - [Setting up REACT_APP_BACKEND_WEBSOCKET_URL in .env file](#setting-up-react_app_backend_websocket_url-in-env-file) - - [Setting up REACT_APP_RECAPTCHA_SITE_KEY in .env file](#setting-up-react_app_recaptcha_site_key-in-env-file) - - [Setting up Compiletime and Runtime logs](#setting-up-compiletime-and-runtime-logs) -- [Post Configuration Steps](#post-configuration-steps) - - [Running Talawa-Admin](#running-talawa-admin) - - [Accessing Talawa-Admin](#accessing-talawa-admin) - - [Talawa-Admin Registration](#talawa-admin-registration) - - [Talawa-Admin Login](#talawa-admin-login) -- [Testing](#testing) - - [Running tests](#running-tests) - - [Debugging tests](#debugging-tests) - - [Linting code files](#linting-code-files) - - [Husky for Git Hooks](#husky-for-git-hooks) - - [pre-commit hook](#pre-commit-hook) - - [post-merge hook](#post-merge-hook) @@ -166,17 +147,17 @@ If you prefer to use Docker, you can install the app using the following command Run the following command to build the Docker image: -``` +````bash docker build -t talawa-admin . -``` +```bash 3. Run the Docker container: After the build is complete, run the Docker container using this command: -``` +```bash docker run -p 4321:4321 talawa-admin -``` +```bash The application will be accessible at `http://localhost:4321` @@ -186,9 +167,9 @@ It's important to configure Talawa-Admin. Here's how to do it. You can use our interactive setup script for the configuration. Use the following command for the same. -``` +```bash npm run setup -``` +```bash All the options in "setup" can be done manually as well and here's how to do it. - [Creating .env file](#creating-env-file) @@ -196,8 +177,10 @@ All the options in "setup" can be done manually as well and here's how to do it. A file named .env is required in the root directory of talawa-admin for storing environment variables used at runtime. It is not a part of the repo and you will have to create it. For a sample of `.env` file there is a file named `.env.example` in the root directory. Create a new `.env` file by copying the contents of the `.env.example` into `.env` file. Use this command: -``` +```` + cp .env.example .env + ``` This `.env` file must be populated with the following environment variables for `talawa-admin` to work: @@ -221,19 +204,25 @@ Add a custom port number for Talawa-Admin development purposes to the variable n Add the endpoint for accessing talawa-api graphql service to the variable named `REACT_APP_TALAWA_URL` in the `.env` file. ``` + REACT_APP_TALAWA_URL="http://API-IP-ADRESS:4000/graphql/" + ``` If you are a software developer working on your local system, then the URL would be: ``` + REACT_APP_TALAWA_URL="http://localhost:4000/graphql/" + ``` If you are trying to access Talawa Admin from a remote host with the API URL containing "localhost", You will have to change the API URL to ``` + REACT_APP_TALAWA_URL="http://YOUR-REMOTE-ADDRESS:4000/graphql/" + ``` ## Setting up REACT_APP_BACKEND_WEBSOCKET_URL in .env file @@ -241,19 +230,25 @@ REACT_APP_TALAWA_URL="http://YOUR-REMOTE-ADDRESS:4000/graphql/" The endpoint for accessing talawa-api WebSocket graphql service for handling subscriptions is automatically added to the variable named `REACT_APP_BACKEND_WEBSOCKET_URL` in the `.env` file. ``` + REACT_APP_BACKEND_WEBSOCKET_URL="ws://API-IP-ADRESS:4000/graphql/" + ``` If you are a software developer working on your local system, then the URL would be: ``` + REACT_APP_BACKEND_WEBSOCKET_URL="ws://localhost:4000/graphql/" + ``` If you are trying to access Talawa Admin from a remote host with the API URL containing "localhost", You will have to change the API URL to ``` + REACT_APP_BACKEND_WEBSOCKET_URL="ws://YOUR-REMOTE-ADDRESS:4000/graphql/" + ``` For additional details, please refer the `How to Access the Talawa-API URL` section in the INSTALLATION.md file found in the [Talawa-API repo](https://github.com/PalisadoesFoundation/talawa-api). @@ -273,7 +268,9 @@ If you want to setup Google reCAPTCHA now, you may refer to the `RECAPTCHA` sect Copy/paste this `reCAPTCHA site key` to the variable named `REACT_APP_RECAPTCHA_SITE_KEY` in `.env` file. ``` + REACT_APP_RECAPTCHA_SITE_KEY="this_is_the_recaptcha_key" + ``` ## Setting up Compiletime and Runtime logs @@ -289,7 +286,9 @@ It's now time to start Talawa-Admin and get it running Run the following command to start `talawa-admin` development server: ``` + npm run serve + ``` ## Accessing Talawa-Admin @@ -297,13 +296,17 @@ npm run serve By default `talawa-admin` runs on port `4321` on your system's localhost. It is available on the following endpoint: ``` + http://localhost:4321/ + ``` If you have specified a custom port number in your `.env` file, Talawa-Admin will run on the following endpoint: ``` + http://localhost:${{customPort}}/ + ``` Replace `${{customPort}}` with the actual custom port number you have configured in your `.env` file. @@ -325,7 +328,9 @@ It is important to test our code. If you are a contributor, please follow these You can run the tests for `talawa-admin` using this command: ``` + npm run test + ``` ## Debugging tests @@ -333,8 +338,10 @@ npm run test You can see the output of failing tests in broswer by running `jest-preview` package before running your tests ``` + npm run jest-preview npm run test + ``` You don't need to re-run the `npm run jest-preview` command each time, simply run the `npm run test` command if the Jest Preview server is already running in the background, it'll automatically detect any failing tests and show the preview at `http://localhost:3336` as shown in this screenshot - @@ -346,7 +353,9 @@ You don't need to re-run the `npm run jest-preview` command each time, simply ru You can lint your code files using this command: ``` + npm run lint:fix + ``` ## Husky for Git Hooks @@ -370,3 +379,4 @@ If you don't want this hook to run, you can manually opt out of this using the ` git pull --no-verify
+```