From a5a765fb17d5286efaae0947c1d1feb7eac794b7 Mon Sep 17 00:00:00 2001 From: bidof Date: Sat, 24 Feb 2024 00:08:04 +0100 Subject: [PATCH 01/44] arreglar el release.yml para que permita localhost o la ip de la maquina --- .github/workflows/release.yml | 4 +++- webapp/.dockerignore | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8bece02..cdb8332 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,9 @@ jobs: - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 env: - API_URI: http://${{ secrets.DEPLOY_HOST }}:8000 + API_URI: http://${{ secrets.DEPLOY_HOST || 'localhost' }}:8000 + + with: name: arquisoft/wiq_es04c/webapp username: ${{ github.actor }} diff --git a/webapp/.dockerignore b/webapp/.dockerignore index cbb7231..3091757 100644 --- a/webapp/.dockerignore +++ b/webapp/.dockerignore @@ -1,3 +1,2 @@ node_modules -.env coverage \ No newline at end of file From fa0be18bf47a163b428a122e2d96c0026a91b82b Mon Sep 17 00:00:00 2001 From: bidof Date: Sat, 24 Feb 2024 00:32:52 +0100 Subject: [PATCH 02/44] arreglar el despliegue del questionService --- .github/workflows/release.yml | 2 +- webapp/.env | 2 +- webapp/Dockerfile | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cdb8332..b9d92ee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -111,7 +111,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - workdir: gatewayservice + workdir: ./gatewayservice docker-push-questionservice: name: Push question service Docker Image to GitHub Packages runs-on: ubuntu-latest diff --git a/webapp/.env b/webapp/.env index c810bde..11fdc41 100644 --- a/webapp/.env +++ b/webapp/.env @@ -1 +1 @@ -REACT_APP_API_ENDPOINT=http://localhost:8000 \ No newline at end of file +REACT_APP_API_ENDPOINT= \ No newline at end of file diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 3cbad8b..85bd381 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -6,8 +6,9 @@ WORKDIR /app #Install the dependencies RUN npm install -ARG API_URI="http://localhost:8000" -ENV REACT_APP_API_ENDPOINT=$API_URI +ARG API_URI +#recibe la url de releaase.yml o bien localhost si no la proporcionas +ENV REACT_APP_API_ENDPOINT=${API_URI} #Create an optimized version of the webapp RUN npm run build From 145d602a0e5d8eb6645baa49fb82173621127efd Mon Sep 17 00:00:00 2001 From: bidof Date: Sat, 24 Feb 2024 00:42:32 +0100 Subject: [PATCH 03/44] problemas con el directorio del question service --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9d92ee..43ec274 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -128,7 +128,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - workdir: questionservice + workdir: ./questionservice deploy: name: Deploy over SSH From 393acef411e4e1d4fda731d53e2ee8b69710cc25 Mon Sep 17 00:00:00 2001 From: bidof Date: Sat, 24 Feb 2024 01:09:02 +0100 Subject: [PATCH 04/44] modificar el compose --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 44fb37f..be34da5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,6 +59,7 @@ services: questionservice: container_name: questionservice-${teamname:-defaultASW} + image: ghcr.io/arquisoft/wiq_0/userservice:latest build: ./questionservice ports: - "8003:8003" From 6602f1a7194ac7626f8256431dbc3f6b83e6a7fe Mon Sep 17 00:00:00 2001 From: bidof Date: Sat, 24 Feb 2024 01:25:11 +0100 Subject: [PATCH 05/44] agregar que se descargue el repositorio par evitar el error de que no tiene el question service --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 43ec274..e0aee76 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -144,5 +144,6 @@ jobs: command: | wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/master/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/master/.env -O .env + wget https://github.com/Arquisoft/wiq_es04c.git docker compose --profile prod down docker compose --profile prod up -d From 956fbaace945f1b60b17c88ea7887f745da2072a Mon Sep 17 00:00:00 2001 From: bidof Date: Sat, 24 Feb 2024 01:29:23 +0100 Subject: [PATCH 06/44] permitir releases desde diferentes ramas con su codigo --- .github/workflows/release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0aee76..429e26c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -142,8 +142,9 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/master/docker-compose.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/master/.env -O .env - wget https://github.com/Arquisoft/wiq_es04c.git + BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g') + wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/$BRANCH_NAME/docker-compose.yml -O docker-compose.yml + wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/$BRANCH_NAME/.env -O .env + git clone -b $BRANCH_NAME https://github.com/Arquisoft/wiq_es04c.git docker compose --profile prod down docker compose --profile prod up -d From e3afc27ee81cc6e15f7d628ae7fcc6973975a7e6 Mon Sep 17 00:00:00 2001 From: bidof Date: Sat, 24 Feb 2024 01:48:53 +0100 Subject: [PATCH 07/44] probar despliegue --- .github/workflows/release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 429e26c..b35560e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -142,9 +142,8 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g') - wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/$BRANCH_NAME/docker-compose.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/$BRANCH_NAME/.env -O .env - git clone -b $BRANCH_NAME https://github.com/Arquisoft/wiq_es04c.git + wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/releases/docker-compose.yml -O docker-compose.yml + wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/releases/.env -O .env + git clone -b releases https://github.com/Arquisoft/wiq_es04c.git docker compose --profile prod down docker compose --profile prod up -d From 791a5964a86510ff6f8169cf230fe4241f75437e Mon Sep 17 00:00:00 2001 From: bidof Date: Sat, 24 Feb 2024 13:13:32 +0100 Subject: [PATCH 08/44] agregar que webapp no guarde cache para que se cargue bien el secreto --- .github/workflows/release.yml | 43 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b35560e..5f1d3d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,28 +39,33 @@ jobs: - run: npm --prefix webapp install - run: npm --prefix webapp run build - run: npm --prefix webapp run test:e2e + docker-push-webapp: - name: Push webapp Docker Image to GitHub Packages - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - needs: [e2e-tests] - steps: - - uses: actions/checkout@v4 - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@v5 - env: - API_URI: http://${{ secrets.DEPLOY_HOST || 'localhost' }}:8000 - - - with: - name: arquisoft/wiq_es04c/webapp + name: Push webapp Docker Image to GitHub Packages + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + needs: [e2e-tests] + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - registry: ghcr.io - workdir: webapp - buildargs: API_URI + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: ./webapp + push: true + tags: ghcr.io/arquisoft/wiq_es04c/webapp:latest + build-args: API_URI=http://${{ secrets.DEPLOY_HOST || 'localhost' }}:8000 + no-cache: true + docker-push-authservice: name: Push auth service Docker Image to GitHub Packages runs-on: ubuntu-latest From 8aa278ae813f4a44619a827531db585e2871c5b2 Mon Sep 17 00:00:00 2001 From: bidof Date: Mon, 26 Feb 2024 20:49:25 +0100 Subject: [PATCH 09/44] agregar navbar --- webapp/package-lock.json | 39 +++++++++++++++++++++++++++++++++ webapp/package.json | 1 + webapp/src/App.js | 6 +++-- webapp/src/components/NavBar.js | 30 ++++++++++--------------- webapp/src/index.js | 16 ++++++++++++-- 5 files changed, 69 insertions(+), 23 deletions(-) diff --git a/webapp/package-lock.json b/webapp/package-lock.json index 27466ae..10cd8fa 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -17,6 +17,7 @@ "axios": "^1.6.5", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-router-dom": "^6.1.0", "react-scripts": "5.0.1", "web-vitals": "^3.5.1" }, @@ -5005,6 +5006,14 @@ "node": ">=12" } }, + "node_modules/@remix-run/router": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.1.tgz", + "integrity": "sha512-zcU0gM3z+3iqj8UX45AmWY810l3oUmXM7uH4dt5xtzvMhRtYVhKGOmgOd1877dOPPepfCjUv57w+syamWIYe7w==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@rollup/plugin-babel": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", @@ -22009,6 +22018,36 @@ "node": ">=0.10.0" } }, + "node_modules/react-router": { + "version": "6.22.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.1.tgz", + "integrity": "sha512-0pdoRGwLtemnJqn1K0XHUbnKiX0S4X8CgvVVmHGOWmofESj31msHo/1YiqcJWK7Wxfq2a4uvvtS01KAQyWK/CQ==", + "dependencies": { + "@remix-run/router": "1.15.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.22.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.1.tgz", + "integrity": "sha512-iwMyyyrbL7zkKY7MRjOVRy+TMnS/OPusaFVxM2P11x9dzSzGmLsebkCvYirGq0DWB9K9hOspHYYtDz33gE5Duw==", + "dependencies": { + "@remix-run/router": "1.15.1", + "react-router": "6.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/react-scripts": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz", diff --git a/webapp/package.json b/webapp/package.json index 74e31be..73cf3fa 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -13,6 +13,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", + "react-router-dom": "^6.1.0", "web-vitals": "^3.5.1" }, "scripts": { diff --git a/webapp/src/App.js b/webapp/src/App.js index 2432b7e..dd7585d 100644 --- a/webapp/src/App.js +++ b/webapp/src/App.js @@ -18,9 +18,10 @@ function App() { - Welcome to the 2024 edition of the Software Architecture course + Bienvenidos a la edición 2024 del curso de Arquitectura de Software - {showLogin ? : } + + {/*showLogin ? : {showLogin ? ( @@ -32,6 +33,7 @@ function App() { )} + */} ); diff --git a/webapp/src/components/NavBar.js b/webapp/src/components/NavBar.js index c3fc42f..13a9824 100644 --- a/webapp/src/components/NavBar.js +++ b/webapp/src/components/NavBar.js @@ -1,32 +1,25 @@ -// En /src/components/Navbar.js import React from 'react'; -import '../styles/Navbar.css'; // Importa tu archivo de estilos si es necesario +import '../styles/Navbar.css'; +import { Link } from 'react-router-dom'; const Navbar = () => ( -