diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0520121f..7e47df19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,10 +17,12 @@ jobs: - run: npm --prefix users/userservice ci - run: npm --prefix gatewayservice ci - run: npm --prefix webapp ci + - run: npm --prefix questionservice ci - run: npm --prefix users/authservice test -- --coverage - run: npm --prefix users/userservice test -- --coverage - run: npm --prefix gatewayservice test -- --coverage - run: npm --prefix webapp test -- --coverage + - run: npm --prefix questionservice test -- --coverage - name: Analyze with SonarCloud uses: sonarsource/sonarcloud-github-action@master env: @@ -37,6 +39,7 @@ jobs: - run: npm --prefix users/authservice install - run: npm --prefix users/userservice install - run: npm --prefix gatewayservice install + - run: npm --prefix questionservice install - run: npm --prefix webapp install - run: npm --prefix webapp run build - run: npm --prefix webapp run test:e2e @@ -94,6 +97,23 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io workdir: users/userservice + docker-push-questionservice: + name: Push user service 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 + with: + name: arquisoft/wiq_es1a/questionservice + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: questionservice docker-push-gatewayservice: name: Push gateway service Docker Image to GitHub Packages runs-on: ubuntu-latest @@ -114,7 +134,7 @@ jobs: deploy: name: Deploy over SSH runs-on: ubuntu-latest - needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp] + needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp,docker-push-questionservice] steps: - name: Deploy over SSH uses: fifsky/ssh-action@master diff --git a/docker-compose.yml b/docker-compose.yml index 5ca2a021..fbc8d143 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,16 @@ services: networks: - mynetwork + questionservice: + container_name: questionservice-${teamname:-defaultASW} + image: ghcr.io/arquisoft/wiq_es1a/questionservice:latest + profiles: ["dev", "prod"] + build: ./questionservice + ports: + - "8003:8003" + networks: + - mynetwork + authservice: container_name: authservice-${teamname:-defaultASW} image: ghcr.io/arquisoft/wiq_es1a/authservice:latest @@ -48,11 +58,13 @@ services: - mongodb - userservice - authservice + - questionservice ports: - "8000:8000" networks: - mynetwork environment: + QUESTION_SERVICE_URL: http://questionservice:8003 AUTH_SERVICE_URL: http://authservice:8002 USER_SERVICE_URL: http://userservice:8001 diff --git a/questionservice/.dockerignore b/questionservice/.dockerignore new file mode 100644 index 00000000..3091757a --- /dev/null +++ b/questionservice/.dockerignore @@ -0,0 +1,2 @@ +node_modules +coverage \ No newline at end of file diff --git a/questionservice/Dockerfile b/questionservice/Dockerfile new file mode 100644 index 00000000..ae8f3e41 --- /dev/null +++ b/questionservice/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Node.js runtime as a parent image +FROM node:20 + +# Set the working directory in the container +WORKDIR /usr/src/questionservice + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install app dependencies +RUN npm install + +# Copy the app source code to the working directory +COPY . . + +# Expose the port the app runs on +EXPOSE 8003 + +# Define the command to run your app +CMD ["node", "question-service.js"] diff --git a/questions/data/literatura.json b/questionservice/data/literatura.json similarity index 100% rename from questions/data/literatura.json rename to questionservice/data/literatura.json diff --git a/questions/data/tematicas.json b/questionservice/data/tematicas.json similarity index 100% rename from questions/data/tematicas.json rename to questionservice/data/tematicas.json diff --git a/questions/package-lock.json b/questionservice/package-lock.json similarity index 100% rename from questions/package-lock.json rename to questionservice/package-lock.json diff --git a/questions/package.json b/questionservice/package.json similarity index 100% rename from questions/package.json rename to questionservice/package.json diff --git a/questions/question-service.js b/questionservice/question-service.js similarity index 100% rename from questions/question-service.js rename to questionservice/question-service.js diff --git a/questions/questionGen/GeneratorChooser.js b/questionservice/questionGen/GeneratorChooser.js similarity index 100% rename from questions/questionGen/GeneratorChooser.js rename to questionservice/questionGen/GeneratorChooser.js diff --git a/questions/questionGen/GenericGenerator.js b/questionservice/questionGen/GenericGenerator.js similarity index 100% rename from questions/questionGen/GenericGenerator.js rename to questionservice/questionGen/GenericGenerator.js