Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Next »

This are the steps for installing the redeem dashboard.

  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

    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:

    reboot
    pm2 status
  14. Configure environmental variables, go to redeem_dashboard directory and open a editor like nano or similar with the archive ".env.local": .env.local ```

  15. 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:

    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
  16. In this instance you should be able to open the app in your browser at: [your ip]: 3001 Go ahead and log in with your metamask account and you will be able to use the app. if you check the console in the browser, you also will see the message "WebSocket connection established". It means that the two apps are correctly connected. Also, everything should be exactly the same if you perform a reboot of the server.

  17. Configure nginx

     
  18. 17. Now we are goning to configure nginx. cd .. cd /etc/nginx/sites-available ``` create a file in that folder, par example "sites": ``` sudo nano sites ``` paste the following config to redirect the traffic from port 80 (or what you decide to choose) to 3001, in wich the app is running: ``` server { listen 80; listen [::]:80; server_name _; location / { proxy_pass http://localhost:3001 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } ``` type "cat sites", you should see the content of the file execute the following commands: ``` cd .. cd sites-enabled sudo ln -s /etc/nginx/sites-available/sites /etc/nginx/sites-enabled/sites ls ``` You should see two files, default and sites, wich is in sinc with the one in sites-avaiable folder. Open the default file, and change the port it is listening, it has to be diferent than the port you choose in "sites" file. save and close. check if everything is correct: ``` sudo nginx -t ``` if affirmative, then restart the nginx service and check the status: ``` sudo service nginx restart sudo service nginx status ``` At this point, if you enter the ip in the browser, you should see the app running without the :3001 port (it also will work that way too)

  • No labels