diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c73331ab..01ddafad 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -172,13 +172,6 @@ jobs: - name: Check out the repo uses: actions/checkout@v4 - - name: Create SSL certificates - run: | - echo "${{ secrets.DEPLOY_SSL_CERT }}" > gatewayservice/certificate.crt - echo "${{ secrets.DEPLOY_SSL_CA_BUNDLE }}" > gatewayservice/ca_bundle.crt - echo "${{ secrets.DEPLOY_SSL_KEY }}" > gatewayservice/private.key - shell: bash - - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 with: diff --git a/docker-compose.yml b/docker-compose.yml index a5f927b3..63ad5862 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,7 +72,6 @@ services: - jordi-think - ranking ports: - - "7999:7999" - "8000:8000" networks: - mynetwork diff --git a/gatewayservice/Dockerfile b/gatewayservice/Dockerfile index a49ad986..9c84384b 100644 --- a/gatewayservice/Dockerfile +++ b/gatewayservice/Dockerfile @@ -13,7 +13,6 @@ RUN npm install # Copy the app source code to the working directory COPY . . -EXPOSE 7999 EXPOSE 8000 # Define the command to run your app diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index f3fb7b89..e174e96e 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -3,22 +3,8 @@ const cors = require('cors'); const promBundle = require('express-prom-bundle'); const axios = require('axios'); -const https = require('https'); -const fs = require('fs'); - const app = express(); -const httpPort = 8000; -const httpsPort = 7999; - -const sslServerKey = fs.readFileSync('./private.key'); -const sslServerCert = fs.readFileSync('./certificate.crt'); -const sslCaBundle = fs.readFileSync('./ca_bundle.crt'); - -const httpsServer = https.createServer({ - key: sslServerKey, - cert: sslServerCert, - ca: sslCaBundle -}, app) +const port = 8000; app.use(cors()); app.use(express.json()); @@ -46,10 +32,7 @@ require("./routes/authRoutes")(app, axios, errorHandler) require("./routes/historyRoutes")(app, axios, errorHandler, authTokenMiddleware) // Start the gateway service -const server = app.listen(httpPort, () => - console.log(`Gateway Service (HTTP) listening at port ${httpPort}`)); - -httpsServer.listen(httpsPort, () => - console.log(`Gateway Service (HTTPS) listening at port ${httpsPort}`)); +const server = app.listen(port, () => + console.log(`Gateway Service listening at port ${port}`)); -module.exports = server + module.exports = server diff --git a/proxy/default.conf b/proxy/default.conf index b3a4461e..a82095dd 100644 --- a/proxy/default.conf +++ b/proxy/default.conf @@ -1,25 +1,12 @@ server { listen 80; - listen [::]:80; - server_name _; - - location / { - proxy_pass http://webapp:3000; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /api/ { - proxy_pass http://gatewayservice:8000/; - proxy_set_header X-Forwarded-Proto $scheme; - } -} - -server { listen 443 ssl; + + listen [::]:80; listen [::]:443 ssl; + server_name _; - # SSL configuration ssl_certificate /etc/nginx/ssl/certificate.crt; ssl_certificate_key /etc/nginx/ssl/private.key; ssl_trusted_certificate /etc/nginx/ssl/ca_bundle.crt; @@ -30,7 +17,7 @@ server { } location /api/ { - proxy_pass https://gatewayservice:7999/; + proxy_pass http://gatewayservice:8000/; proxy_set_header X-Forwarded-Proto $scheme; } }