From 5fc66a5c2f9db2318b1413f5ebceff650f389ce1 Mon Sep 17 00:00:00 2001 From: iyanfdezz Date: Sun, 3 Mar 2024 16:49:21 +0100 Subject: [PATCH] Still working on stats service --- .github/workflows/build.yml | 2 ++ .github/workflows/release.yml | 22 +++++++++++++++++-- docker-compose.yml | 4 ++-- {stats => statsservice}/.dockerignore | 0 {stats => statsservice}/Dockerfile | 0 {stats => statsservice}/model/partidas.json | 0 {stats => statsservice}/model/stats-getter.js | 1 + {stats => statsservice}/package-lock.json | 0 {stats => statsservice}/package.json | 0 {stats => statsservice}/stats-service.js | 2 +- 10 files changed, 26 insertions(+), 5 deletions(-) rename {stats => statsservice}/.dockerignore (100%) rename {stats => statsservice}/Dockerfile (100%) rename {stats => statsservice}/model/partidas.json (100%) rename {stats => statsservice}/model/stats-getter.js (99%) rename {stats => statsservice}/package-lock.json (100%) rename {stats => statsservice}/package.json (100%) rename {stats => statsservice}/stats-service.js (96%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9265703..ef1b32d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,8 @@ 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 statsservice ci - run: npm --prefix users/authservice test -- --coverage - run: npm --prefix users/userservice test -- --coverage - run: npm --prefix gatewayservice test -- --coverage diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e47df19..323fa2f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,6 +40,7 @@ jobs: - run: npm --prefix users/userservice install - run: npm --prefix gatewayservice install - run: npm --prefix questionservice install + - run: npm --prefix statsservice install - run: npm --prefix webapp install - run: npm --prefix webapp run build - run: npm --prefix webapp run test:e2e @@ -97,8 +98,25 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io workdir: users/userservice + docker-push-statsservice: + name: Push stats 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/statsservice + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: statsservice docker-push-questionservice: - name: Push user service Docker Image to GitHub Packages + name: Push questions service Docker Image to GitHub Packages runs-on: ubuntu-latest permissions: contents: read @@ -134,7 +152,7 @@ jobs: deploy: name: Deploy over SSH runs-on: ubuntu-latest - needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp,docker-push-questionservice] + needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp,docker-push-questionservice, docker-push-statsservice] steps: - name: Deploy over SSH uses: fifsky/ssh-action@master diff --git a/docker-compose.yml b/docker-compose.yml index 89f7e1dc..f8faa3c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,9 +23,9 @@ services: statsservice: container_name: statsservice-${teamname:-defaultASW} - image: ghcr.io/arquisoft/wiq_es1a/stats:latest + image: ghcr.io/arquisoft/wiq_es1a/statsservice:latest profiles: ["dev", "prod"] - build: ./stats + build: ./statsservice depends_on: - mongodb - userservice diff --git a/stats/.dockerignore b/statsservice/.dockerignore similarity index 100% rename from stats/.dockerignore rename to statsservice/.dockerignore diff --git a/stats/Dockerfile b/statsservice/Dockerfile similarity index 100% rename from stats/Dockerfile rename to statsservice/Dockerfile diff --git a/stats/model/partidas.json b/statsservice/model/partidas.json similarity index 100% rename from stats/model/partidas.json rename to statsservice/model/partidas.json diff --git a/stats/model/stats-getter.js b/statsservice/model/stats-getter.js similarity index 99% rename from stats/model/stats-getter.js rename to statsservice/model/stats-getter.js index 884446cb..45ac0d68 100644 --- a/stats/model/stats-getter.js +++ b/statsservice/model/stats-getter.js @@ -1,5 +1,6 @@ const User = require('../../users/userservice/user-model.js'); + class StatsForUser { async getStatsForUser(username){ diff --git a/stats/package-lock.json b/statsservice/package-lock.json similarity index 100% rename from stats/package-lock.json rename to statsservice/package-lock.json diff --git a/stats/package.json b/statsservice/package.json similarity index 100% rename from stats/package.json rename to statsservice/package.json diff --git a/stats/stats-service.js b/statsservice/stats-service.js similarity index 96% rename from stats/stats-service.js rename to statsservice/stats-service.js index 0b800e64..8798d6f7 100644 --- a/stats/stats-service.js +++ b/statsservice/stats-service.js @@ -1,7 +1,7 @@ // user-service.js const express = require("express"); const bodyParser = require("body-parser"); -const StatsForUser = require("./model/stats-getter"); +const StatsForUser = require("./model/stats-getter.js"); const User = require("../users/user-model.js"); const cors = require('cors');