Skip to content

Commit

Permalink
Merge pull request #36 from Arquisoft/Dockerizar-statsservice
Browse files Browse the repository at this point in the history
Servicio de estadísticas dockerizado (errores)
  • Loading branch information
CANCI0 authored Feb 24, 2024
2 parents 6742afb + 35f70e3 commit 40364c7
Show file tree
Hide file tree
Showing 14 changed files with 367 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
- run: npm --prefix users/authservice ci
- run: npm --prefix users/userservice ci
- run: npm --prefix gatewayservice ci
- run: npm --prefix questionservice ci
- run: npm --prefix statsservice ci
- run: npm --prefix webapp ci
- run: npm --prefix users/authservice test -- --coverage
- run: npm --prefix users/userservice test -- --coverage
Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,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
Expand Down Expand Up @@ -134,7 +151,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
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ services:
- "8003:8003"
networks:
- mynetwork

statsservice:
container_name: statsservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_es1a/statsservice:latest
profiles: ["dev", "prod"]
build: ./statsservice
depends_on:
- mongodb
ports:
- "8004:8004"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

authservice:
container_name: authservice-${teamname:-defaultASW}
Expand Down Expand Up @@ -56,6 +70,7 @@ services:
build: ./gatewayservice
depends_on:
- mongodb
- statsservice
- userservice
- authservice
- questionservice
Expand All @@ -64,6 +79,7 @@ services:
networks:
- mynetwork
environment:
STATS_SERVICE_URL: http://questionservice:8004
QUESTION_SERVICE_URL: http://questionservice:8003
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001
Expand Down
2 changes: 2 additions & 0 deletions statsservice/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
coverage
20 changes: 20 additions & 0 deletions statsservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/statsservice

# 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 8004

# Define the command to run your app
CMD ["node", "stats-service.js"]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const User = require('../../users/userservice/user-model.js/User');
const User = require('../../users/userservice/user-model.js');

class StatsForUser {

Expand Down
217 changes: 216 additions & 1 deletion stats/package-lock.json → statsservice/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 40364c7

Please sign in to comment.