Setting issue about openvidu-tutorials/openvidu-recordding-node in my AWS

  1. I made s3-eu-west-1.amazonaws.com/aws.openvidu.io/CF-OpenVidu-latest.yaml in my AWS CloudFormation

  2. I opened rtc.live.world domain and. An OpenVidu Videoconference rooms join page shows. It worked.

  3. I install Node(v16.14.2) and npm(8.5.0).

  4. I cloned “$ git clone …github.com/OpenVidu/openvidu-tutorials.git -b v2.21.0”

  5. I changed the default port(5000) into 5442 in server.js of “OpenVidu-tutorials/openvidu-recordding-node” sample source.

  6. I executed “$ node server.js …localhost:4443 MY_SECRET”

  7. I executed like the below as you guided “Deploy OpenVidu applications - OpenVidu Docs

$ cd /opt/openvidu
$ ./openvidu stop
$ rm docker-compose.override.yml
$ ./openvidu start

  1. I opened rtc.live.world domain again.

Could I get any help what I am missing?

(I am a new OpenVidu user and I edited http into … in the above because of their edit limitation of new user)

Hello @Wann_Lee

Run your app in this way:

node server.js http://localhost:5443 MY_SECRET

OpenVidu service is running at port 5443 in the deployment.

Best Regards

Thanks for Cruizba.

This time I executed “node server.js http://localhost:5443 MY_SECRET”,
but the same 502 Bad Gateway(Nginx) error page shows.

Is there any other check point?

Do you have any response if you executes this in your machine?:

curl http://localhost:5443

Is the tutorial running at port 5442? Try to run this command to check it:

curl http://localhost:5442

What is the output of:

docker ps

Check the logs of the services, maybe something is not running correctly

Did you check that both services (Tutorial and OpenVidu Server) are running at port 5442 and 5443 respectively with:

curl http://localhost:5442
curl http://localhost:5443

Nginx is returning a 502 because it can’t find any service running at port 5442

Make sure that both services are running at these ports without SSL.

$ curl http_localhost:5443

OpenVidu

Welcome to OpenVidu

  • OpenVidu Server URL: (consume REST API in this URL)
  • OpenVidu Dashboard:

$ curl http_localhost:5442

curl: (7) Failed to connect to localhost port 5442: Connection refused

I got the above.

curl: (7) Failed to connect to localhost port 5442: Connection refused

This means that your tutorial is not running correctly.

What is the output when you execute this?:

node server.js http://localhost:5443 qwer1234

ubuntu@ip-172-31-33-162:~/openvidu-tutorials/openvidu-recording-node$ node server.js http://localhost:5443 MY_SECRET

App listening on port 5000

@Wann_Lee

I see that the tutorial is not prepared for production environments (We may need to fix that).

You need to apply these changes at server.js file in the tutorial:

diff --git a/openvidu-js-node/server.js b/openvidu-js-node/server.js
index 8583e28c..5707dfb7 100644
--- a/openvidu-js-node/server.js
+++ b/openvidu-js-node/server.js
@@ -15,7 +15,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
 var express = require('express');
 var fs = require('fs');
 var session = require('express-session');
-var https = require('https');
+var http = require('http');
 var bodyParser = require('body-parser'); // Pull information from HTML POST (express4)
 var app = express(); // Create our app with express
 
@@ -35,11 +35,7 @@ app.use(bodyParser.json({
 })); // Parse application/vnd.api+json as json
 
 // Listen (start app with node server.js)
-var options = {
-    key: fs.readFileSync('openvidukey.pem'),
-    cert: fs.readFileSync('openviducert.pem')
-};
-https.createServer(options, app).listen(5000);
+http.createServer(app).listen(5442);
 
 // Mock database
 var users = [{
@@ -69,7 +65,7 @@ var mapSessions = {};
 // Collection to pair session names with tokens
 var mapSessionNamesTokens = {};
 
-console.log("App listening on port 5000");
+console.log("App listening on port 5442");
 
 /* CONFIGURATION */
 

I have updated server.js

And now which one do I have to launch?

  1. $ node server.js http_localhost:5442 MY_SECRET
  2. $ node server.js http_localhost:5443 MY_SECRET
  1. node server.js http:localhost:5443 MY_SECRET

But put instead of MY_SECRET the value you have configured in /opt/openvidu/.env. I see in your logs that you are using qwer1234. In this case, you should use:

node server.js http://localhost:5443 qwer1234

(post deleted by author)

But this looks like a completely different problem.

Did you remove your certificates or something?

Please follow these steps:

  1. Stop OpenVidu:
    cd /opt/openvidu
    ./openvidu stop
    
  2. Remove the folder /opt/openvidu/certificates
    rm -rf /opt/openvidu/certificates
    
  3. Start OpenVidu:
    ./openvidu start
    
  4. When this is running, go to the tutorial directory, and execute:
    node server.js http://localhost:5443 qwer1234
    

That’s it

Not at all. I selected “letsencrypt” as CertificateType when I created a CloudFormation stack.
I have a domain in AWS and own a Certificate that AWS published.

@Wann_Lee Try to follow the instructions I’ve sent and let me know.

Regards

cd /opt/openvidu
./openvidu stop
rm -rf /opt/openvidu/certificates
node server.js http_localhost:5443 qwer1234

I did all things.

But when I open “https_rtc.emolive.world”, “ERR_CONNECTION_REFUSED” still happens.

The below is the current status of certificate folder.
root:/opt/openvidu/certificates# ll
drwxrwxrwx 3 root root 4096 Apr 4 13:22 accounts/
drwxrwxrwx 2 root root 4096 Apr 4 13:22 csr/
drwxrwxrwx 2 root root 4096 Apr 4 13:22 keys/
drwxrwxrwx 2 root root 4096 Apr 4 13:22 live/
drwxrwxrwx 2 root root 4096 Apr 4 13:22 renewal/
drwxrwxrwx 5 root root 4096 Apr 4 13:22 renewal-hooks/

root:/opt/openvidu/certificates# cd live

root:/opt/openvidu/certificates/live# ll
-rwxrwxrwx 1 root root 30 Apr 4 13:22 certificates.conf*

No, I think the domain name is being blocked by letsencrypt because of lots of reinstallations (It happen when you reinstall with the same domain name multiple times)

Can you show me the output of:

docker logs openvidu_nginx_1 | head -n 50

If you see some kind of error like: too many certificates already issued for exact set of domains, you will need to set a different domain name for the server.

@Wann_Lee You have the error I was talking about:

There were too many requests of a given type :: Error creating new order :: too many certificates (5) already issued for this exact set of domains in the last 168 hours: rtc.emolive.world: see https__letsencrypt.org/docs/rate-limits/

You need to use a different domain name. For example try to use openvidu-rtc.emolive.world

Yes, the tutorial seems to be not working for deployment in production. It is not working because the /api/ path from the tutorial is overriding the /api/ path of OpenVidu Server.

@Wann_Lee, I will update some things of the tutorial and ping you when it is fixed

1 Like

Hello @Wann_Lee , I’ve fixed the problem in this commit:

6e77836

You just need to clone the master branch as it is right now:

git clone https://github.com/OpenVidu/openvidu-tutorials.git

Now you don’t need to change anything in the source code. Just execute:

cd openvidu-tutorials/openvidu-recording-node
npm install
USE_SSL=false PORT=5442 node server.js http://localhost:5443 qwer1234

This fix will be available in tag v2.22.0 (next release), for now you can use it by cloning the master branch.

PS: Remember to use at /opt/openvidu/.env the variable:

OPENVIDU_RECORDING=true
1 Like