502 Bad Gateway Error

I have used the openvidu-call angular app as a base to build a customized app for our company. I am not trying to deploy it to the Openvidu server we have in AWS. I have updated my /opt/openvidu/docker-compose.override.yml file with my image (which was generated using the following command: “docker build -f docker/custom.dockerfile -t bridgeinsure/kottervidu --network host --build-arg BASE_HREF=/ .”

After which i run sudo ./openvidu restart which results in no errors.

However when i browse to the app it gives me the nginx 502 bad gateway error. I suspect the issue is the http vs https issue mentioned "It’s very important expose your application in port 5442 and use the http protocol”? Since my app automatically goes to https when I browse … http://vid.keithgallant.com

Can someone please help explain how i can make this happen?

NOTE: I did post this question as a followup to another topic in the “Issues Developing apps” category … i apologize for the repitition but i am under the gun to get a live demo deployed. Everything works perfectly when running locally.

Thank you.

Keith Gallant

A 502 means that the nginx container is not able to reach your OpenVidu Call App. Is your app running over http in port 5442? What the port 5442 means is that your app should be exposed in OpenVIdu at port 5442 so the nginx container can reach it through http://localhost:5442

Did you try to do a curl request to the app? Something like:

curl localhost:5442

If the App is based in OpenVidu Call, it should return an html. If that does not return something, your app is not running at 5442.

cruizba

Thank you for your reply. the curl request does fail ( Failed to connect to localhost port 5442: Connection refused) … how do i make that happen? Is that a config change needed inside the angular app? Or within the build command or docker?

Keith

After the build, did you configured the image in the docker-compose.override.yml?

version: '3.1'

services:
    # --------------------------------------------------------------
    #
    #   Change this if your want use your own application.
    #   It's very important expose your application in port 5442
    #   and use the http protocol.
    #
    #   Default Application
    #
    #   Openvidu-Call Version: 2.19.0
    #
    # --------------------------------------------------------------
    app:
        image: bridgeinsure/kottervidu         <--------- THIS
        restart: on-failure
        network_mode: host
        environment:
            - SERVER_PORT=5442
            - OPENVIDU_URL=http://localhost:5443
            - OPENVIDU_SECRET=${OPENVIDU_SECRET}
            - CALL_OPENVIDU_CERTTYPE=${CERTIFICATE_TYPE}
        logging:
            options:
                max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"

After that, execute ./openvidu restart

Yes I did do that. And there are no errors showing after that restart.

It is using my image as can be seen in the following excerpt from the restart logs:

ubuntu@ip-172-31-29-87:/opt/openvidu$ sudo ./openvidu restart
Removing network openvidu_default
Creating network “openvidu_default” with the default driver
Pulling app (bridgeinsure/kottervidu:)…
latest: Pulling from bridgeinsure/kottervidu
bbf911997326: Pull complete
fa649ee9f5fb: Pull complete
7928b9611049: Pull complete
351dce8941cd: Pull complete
e5655c8c8f78: Pull complete
0dda11d564f5: Pull complete
2e352c6c52ce: Pull complete
61b5829fd91c: Pull complete
Digest: sha256:a85826ee3474e16835002a5b5b7590c266721499f62f7991d669a0be3a824eb3
Status: Downloaded newer image for bridgeinsure/kottervidu:latest
Creating openvidu_coturn_1 … done
Creating openvidu_redis_1 … done
Creating openvidu_nginx_1 … done
Creating openvidu_kibana_1 … done
Creating openvidu_app_1 … done
Creating openvidu_openvidu-server_1 … done
Creating openvidu_metricbeat_1 … done
Creating openvidu_elasticsearch_1 … done
Creating openvidu_filebeat_1 … done
Attaching to openvidu_openvidu-server_1

What logs do you have in openvidu_app_1 container?

cruizba

I am not sure what you mean? How do I view those?

Keith

In /opt/openvidu execute:

sudo su
docker-compose logs app 

or

sudo su
docker logs openvidu_app_1

There is obviously a problem … this shows:

standard_init_linux.go:228: exec user process caused: exec format error

When I look at the entrypoint.sh file in my app it has the following:

cd /opt/openvidu-call
nodemon openvidu-call-server.js

however this doesnt exist on my AWS server? Is this something generated inside the docker? And should the folder be my new image name? ie kottervidu

Did you modified something of the Dockerfile custom.dockerfile or the entrypoint.sh?

You can forget about the docker image if you want. Instead of building the Docker container, just clone your project into the server and run it at port 5442 with http.

So if you’re able to run your app at port 5442, you can do that in the server.

I ddnt edit the custom.dockerfile or entrypoint.sh file no …

To “run it at port 5442 with http” do you mean run the docker run command from within the AWS server? If doing this … i will have to go to http://vid.keithgallant.com:5442 in order to use the app though right?

  • No, I was talking about running the node server directly in the machine using port 5442.
  • No, you don’t need to access through 5442. Anything running at port 5442 will be redirected to 443 by the nginx proxy