Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Check port availability

    1. Connect to the SSH console.

    2. Run the command: `ss -tuln` to check if ports 3001 and 8081 are available.

  2. Create the redeem folder
    mkdir redeem-dashboard
    cd redeem-dashboard

  3. Clone the redeem respositories
    git clone https://github.com/openvino/redeem_dashboard.git
    git clone https://github.com/openvino/openvino_redeem_notifier.git

  4. Install node.js
    sudo dnf install nodejs -y

  5. Navigate to the notifier folder:
    cd openvino_redeem_notifier

  6. Install dependencies:
    npm install

  7. Run the server with pm2
    pm2 start npm --name "server" -- start

  8. Change to the dashboard folder and install dependencies:
    cd ../redeem_dashboard
    npm install --force

  9. Make a build
    npm run build

  10. Start the app with pm2
    pm2 start npm --name "dashboard" -- start

  11. Check pm2 status, to see both apps running

    Code Block
    redeem_dashboard]$ pm2 status
    ┌─────┬──────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
    │ id  │ name         │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
    ├─────┼──────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
    │ 1   │ dashboard    │ default     │ N/A     │ fork    │ 2291356  │ 6s     │ 0    │ online    │ 0%       │ 67.7mb   │ mtb      │ disabled │
    │ 0   │ server       │ default     │ N/A     │ fork    │ 2291031  │ 4m     │ 0    │ online    │ 0%       │ 87.6mb   │ mtb      │ disabled │
    └─────┴──────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
    
  12. configure pm2 to start when the server boots:
    sudo env PATH=$PATH:/usr/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup systemd -u mtb --hp /home/mtb

  13. Reboot and check pm2 status again:

    Code Block
    reboot
    pm2 status
  14. Configure environmental variables with the file .env.local
    Paste the following and change db credentials if you want to point to the real db and NEXT_PUBLIC_WS_SERVER_URL should be the ip of the current project:

    Code Block
    DB_HOST= containers-us-west-156.railway.app
        DB_PORT= 7131
        DB_USER= postgres
        DB_PASSWORD= OYrwzmuM1ckJlqkhz
        DB_DATABASE= database
        NEXT_PUBLIC_WS_SERVER_URL = 147.12.205.152
        JWT_SECRET = "vY,aM6@^6\_\_rYMeu"
        NEXT_PUBLIC_API_URL = http://147.182.25.152:3001
        NEXT_AUTH_SECRET = "7CxzxhD[rQNr!g"
        NEXTAUTH_URL = http://147.182.205.12:3001
  15. Edit the package.json file to reflect the correct ports:

    Code Block
     "scripts": {
        "dev": "next dev --port 3002",
        "build": "next build",
        "start": "next start --port 3002",
        "lint": "next lint"
      },
  16. Add port 3002 to the firewall

    Code Block
     sudo firewall-cmd --zone=public --add-port=3002/tcp
  17. Configure nginx

    Code Block
    cd /etc/nginx/sites-available
    vi ferment.openvino.org.conf
    
    server {
    
        server_name ferment.openvino.org;
        # maintain the .well-known directory alias for renewals
    
        location /.well-known {
            alias /usr/share/nginx/html/ferment.openvino.org/.well-known;
        }
    
        location /{
             proxy_pass http://64.225.10.229:3002;
             proxy_http_version 1.1;
             proxy_set_header Upgrade $http_upgrade;
             proxy_set_header Host $host;
             proxy_cache_bypass $http_upgrade;
         }
    
    
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/ferment.openvino.org/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/ferment.openvino.org/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    
    
        add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot
    
    
        ssl_trusted_certificate /etc/letsencrypt/live/ferment.openvino.org/chain.pem; # managed by Certbot
        ssl_stapling on; # managed by Certbot
        ssl_stapling_verify on; # managed by Certbot
    
    }
    server {
        if ($host = ferment.openvino.org) {
            return 301 https://$host$request_uri;
        } # managed by Certbot
    
    
        server_name ferment.openvino.org;
        # maintain the .well-known directory alias for renewals
    
        location /.well-known {
            alias /usr/share/nginx/html/ferment.openvino.org/.well-known;
        }
    
        location /{
             proxy_pass http://64.225.10.229:3002;
             proxy_http_version 1.1;
             proxy_set_header Upgrade $http_upgrade;
             proxy_set_header Host $host;
             proxy_cache_bypass $http_upgrade;
    
       }
    
        listen 80; # managed by Certbot
    
    
    
    cd sites-enabled
    sudo ln -s /etc/nginx/sites-available/sites /etc/nginx/sites-enabled/sites
  18. restart nginx

    Code Block
    sudo nginx -t 
    sudo service nginx restart     
    sudo service nginx status
  19. Update the database structure

    Code Block
    ALTER TABLE "public"."wineries"
    ADD COLUMN "email" varchar,
    ADD COLUMN "public_key" char(42),
    ADD COLUMN "isAdmin" bool;