Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Arquisoft/wiq_en2a
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel-Estape-Fernandez committed Apr 29, 2024
2 parents b4ac28b + d85e4df commit daf9fa4
Show file tree
Hide file tree
Showing 41 changed files with 1,906 additions and 346 deletions.
60 changes: 30 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ on:
types: [published]

jobs:
# unit-tests:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# - run: npm --prefix users/authservice ci
# - run: npm --prefix users/userservice ci
# - run: npm --prefix gatewayservice ci
# - run: npm --prefix webapp 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
# - name: Analyze with SonarCloud
# uses: sonarsource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm --prefix users/authservice ci
- run: npm --prefix users/userservice ci
- run: npm --prefix gatewayservice ci
- run: npm --prefix webapp 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
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# e2e-tests:
# # needs: [unit-tests]
# needs: [unit-tests]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
Expand All @@ -38,14 +38,14 @@ jobs:
# - run: npm --prefix gatewayservice install
# - run: npm --prefix webapp install
# - run: npm --prefix webapp run build
#- run: npm --prefix webapp run test:e2e
# - 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]
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -69,7 +69,7 @@ jobs:
permissions:
contents: read
packages: write
#needs: [e2e-tests]
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -87,7 +87,7 @@ jobs:
permissions:
contents: read
packages: write
#needs: [e2e-tests]
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -105,7 +105,7 @@ jobs:
permissions:
contents: read
packages: write
#needs: [e2e-tests]
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -123,7 +123,7 @@ jobs:
permissions:
contents: read
packages: write
#needs: [e2e-tests]
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -141,7 +141,7 @@ jobs:
permissions:
contents: read
packages: write
#needs: [e2e-tests]
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -162,7 +162,7 @@ jobs:
permissions:
contents: read
packages: write
#needs: [e2e-tests]
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -180,7 +180,7 @@ jobs:
permissions:
contents: read
packages: write
#needs: [e2e-tests]
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ services:
- "80:80"

prometheus:
image: prom/prometheus
image: ghcr.io/arquisoft/wiq_en2a/prometheus:latest
container_name: prometheus-${teamname:-defaultASW}
profiles: ["dev", "prod"]
networks:
Expand All @@ -144,7 +144,7 @@ services:
- gatewayservice

grafana:
image: grafana/grafana
image: ghcr.io/arquisoft/wiq_en2a/grafana:latest
container_name: grafana-${teamname:-defaultASW}
profiles: ["dev", "prod"]
networks:
Expand Down
21 changes: 21 additions & 0 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ const axios = require('axios');
const cors = require('cors');
const promBundle = require('express-prom-bundle');

// libraries required for OpenAPI-Swagger
const swaggerUI = require('swagger-ui-express');
const fs = require("fs");
const YAML = require('yaml');

const app = express();
const port = 8000;

Expand Down Expand Up @@ -182,6 +187,22 @@ app.get('/getGroups', async (req, res) => {
}
})

// Read the OpenAPI YAML file synchronously
openapiPath='./openapi.yaml'
if (fs.existsSync(openapiPath)) {
const file = fs.readFileSync(openapiPath, 'utf8');

// Parse the YAML content into a JavaScript object representing the Swagger document
const swaggerDocument = YAML.parse(file);

// Serve the Swagger UI documentation at the '/api-doc' endpoint
// This middleware serves the Swagger UI files and sets up the Swagger UI page
// It takes the parsed Swagger document as input
app.use('/api-doc', swaggerUI.serve, swaggerUI.setup(swaggerDocument));
} else {
console.log("Not configuring OpenAPI. Configuration file not present.")
}


// Start the gateway service
const server = app.listen(port, () => {
Expand Down
10 changes: 10 additions & 0 deletions gatewayservice/monitoring/grafana/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM grafana/grafana

# Copying the provisioning files
COPY ./provisioning /etc/grafana/provisioning

# Exposing Grafana server port
EXPOSE 9091

# Running Grafana server
CMD [ "grafana-server" ]
10 changes: 10 additions & 0 deletions gatewayservice/monitoring/prometheus/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM prom/prometheus

# Copying the configuration file
COPY prometheus.yml /etc/prometheus/prometheus.yml

# Exposing Prometheus server port
EXPOSE 9090

# Running Prometheus
ENTRYPOINT [ "prometheus", "--config.file=/etc/prometheus/prometheus.yml" ]
Loading

0 comments on commit daf9fa4

Please sign in to comment.