Objective
Setting up a test proxy server for use with the Vonage Video API SDK.
Applies To
- Video API SDK
- Proxy Server
Procedure
The IP proxy feature of the Vonage Video API SDK client routes all internet traffic (except for media streams) via your proxy server and is available as an add-on feature.
After following these instructions you will have a test proxy URL that you can use to handle all requests from the Video API SDKs in testing environments. This document is not intended to be used as a guideline for installing and setting up a production system.
Proxy Server Using AWS and Docker
In the above architecture, we can see a few different entities:
Create EC2 Instances - Ubuntu
First, let's create an EC2 instance.
- Go to Services > EC2.
- Select Ubuntu OS.
- Click Next and select the network options that best applies to you (default VPC).
- Scroll down to Advanced Details | User Data field to attach the installation script.
- The following script will install Docker in the instance, clone the proxy configuration and run the service automatically.
#!/bin/bash
sudo apt update -y
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update -y
apt-cache policy docker-ce
sudo apt install docker-ce -y
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
git clone https://gist.github.com/de3d8f46972a83a883e8dc15cc1e0209.git \
&& cp de3d8f46972a83a883e8dc15cc1e0209/docker-compose.yml ./docker-compose.yml
sudo docker swarm init
sudo docker stack deploy -c docker-compose.yml proxy
sudo docker stack services proxy - If you want to manually install Docker or if already have an instance with Docker installed you only need to make sure swarm is initiated. You can then, copy the docker-compose file from: https://gist.github.com/de3d8f46972a83a883e8dc15cc1e0209.git
- Run the service using the following command:
sudo docker stack deploy -c docker-compose.yml proxy
- You should then repeat this process to create the other EC2 instances.
Create Application Load Balancer
The next step is to create the Elastic Load Balancer on Amazon Web Services.
- Navigate to Services > EC2 > Load Balancer.
- Select Application Load Balancer.
- Set a Name, Listener HTTPS, and select your VPC and availability zones.
- The next step is to configure the Certificate and Security Groups. Make sure to add a Security Group with the HTTPS traffic enabled.
- Once this is done you should configure the routing, which means where and how the Load Balancer will redirect the traffic to the instances. Configure a new target group and the health checks. It's important to configure the health check to /healthcheck as the Load Balancer will use the endpoint to check the instances status and will redirect traffic only to healthy endpoints.
Finally, it is necessary to register the instances to the target group.
- Select all the instances that you have created.
- Add them to the target group.
- It will take a few seconds for the Load Balancer to detect the endpoints as it must run the health-checks.
Add Record on Route 53
The Load balancer running and forwarding the traffic to the registered instances. One additional step is to add an A record that will redirect the traffic from our DNS record to the Load Balancer DNS address.
- Navigate to Services > Route 53.
- Select your host zone.
- Click Create Record Set and add an A record.
- Alias "Yes" and type the DNS record of your Load Balancer (it should autocomplete).
Your Proxy Server should now be reachable and ready to use.
Additional Information
For more information on how to use this Proxy URL feature in the Client SDKs, see the developer documentation.
If you need fine grained control over media streams routing, check the configurable TURN feature, which can be used independently of IP Proxy or together with it.
Articles in this section
- What is Single Peer Connection (SPC) and How do I enable it?
- How do I enable or disable Scalable Video for my video project or application?
- What are the Vonage Video API network connectivity requirements?
- OpenTok Pre-Call test, Network test, and getStats() API
- Is there any way to test my network configuration?
- Can I use Vonage Video API in a restricted network environment?
- Is it possible to deploy a TURN server inside the corporate network or DMZ?
- Does Vonage Video API provide server infrastructure?
- What are the IP ranges for Vonage Video API servers?
- What is the minimum bandwidth requirement to use the Vonage Video API?