idrinth-api-bench / issues

This is the issue repository for a typescript framework meant to performance test anything even remotely rest-like and related tools
https://idrinth-api-ben.ch/
MIT License
49 stars 52 forks source link

lighhouse check has to use nginx for more resonable performance scores #953

Open Idrinth opened 4 months ago

Idrinth commented 4 months ago

Context

Right now nodjs is used, leading to way worse performance scores than we really have.

Project

Files:

itsmacr8 commented 4 months ago

After 2 hours of reading, I got to this position. Am I heading towards the right dir, @Idrinth?

name: documentation-website lighthouse check
on:
  push:
    branches:
    - the-one
    paths:
      - 'documentation-website/**.ts'
      - 'documentation-website/**.tsx'
      - 'documentation-website/**.js'
      - 'documentation-website/**.cjs'
      - 'documentation-website/package-lock.json'
      - '.github/workflows/documentation-website.lighthouse-check.yml'
  pull_request:
    branches:
    - the-one
    paths:
      - 'documentation-website/**.ts'
      - 'documentation-website/**.tsx'
      - 'documentation-website/**.js'
      - 'documentation-website/**.cjs'
      - 'documentation-website/package-lock.json'
      - '.github/workflows/documentation-website.lighthouse-check.yml'
jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest
    timeout-minutes: 360
    permissions:
      security-events: write
    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v3
      with:
        languages: javascript-typescript
        queries: security-and-quality
        source-root: documentation-website
    - name: Install Nginx
      run: sudo apt-get update && sudo apt-get install -y nginx
    - name: Configure Nginx
      run: |
        # Replace the default Nginx configuration with your own
        sudo cp ./nginx.conf /etc/nginx/sites-available/default
        sudo systemctl restart nginx
    - name: Run Lighthouse Check
      run: |
        cd documentation-website && npm install
        cd documentation-website && npm run lighthouse

NGinx

# User and worker settings
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

# Events block for handling connections
events {
    worker_connections 768;
    # multi_accept on;
}

# HTTP block for handling HTTP requests
http {
    # Basic Settings
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    server_tokens off;

    # Include MIME types
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    # SSL Settings
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    # Logging Settings
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    # Gzip Settings
    gzip on;
    gzip_disable "msie6";

    # Virtual Host Configs
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    # Reverse proxy configuration
    server {
        listen 80;
        # Server name can be domain or IP
        server_name idrinth-api-ben.ch;

        location / {
            # Proxy pass to the Node.js application
            proxy_pass http://localhost:8080;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
        }
    }
}
Idrinth commented 4 months ago

I think the default would be enough, you'd just need to move the disy folder there. Very good looking solution.

itsmacr8 commented 4 months ago

I have never worked with nginx and am new to it. I don't know very much about it. I have come to this solution after reading articles and posts about it for hours. I don't understand what you meant by you'd just need to move the disy folder there. If you want me to make some changes then can you copy and paste it in the comment. For example, change the below code to something else with the change you want me to make, @Idrinth.

replace

      run: |
        # Replace the default Nginx configuration with your own
        sudo cp ./nginx.conf /etc/nginx/sites-available/default
        sudo systemctl restart nginx

with

suggested update
github-actions[bot] commented 3 months ago

Due to inactivity you will be unassigned soon and the issue be freed.

github-actions[bot] commented 3 months ago

Due to longer inactivity, this issue has been unassigned automatically.

github-actions[bot] commented 3 months ago

Due to inactivity you will be unassigned soon and the issue be freed.

github-actions[bot] commented 2 months ago

Due to longer inactivity, this issue has been unassigned automatically.