How do we deploy this webpage to production?

Hi,
I would like to know after we create the teleoperation webpage to control the robot, how do we deploy it to production?
Let’s say we launch it in to cloud, e.g.: AWS, do we launch it in EC2 or Robomaker?

Hi @okkewei ,

I’ll divide into 2 parts:

  • ROS environment
  • Web application

Let’s say you have your ROS environment running in a given computer.
Its IP must be public accessible or at least have a DNS name to be found by your web app.

Your web application can be launched in any server of your preference. It can be a github webpage, an aws EC2, a simple http server inside your ROS env, and so on…
I recommend a static content delivery for html+js web apps

Depending on your setup, you may need to deal with proxy configuration, that one goes a bit out of the scope of this corse. This is very specific to each kind of app and provider.

It’s also very important to consider the SSL certificate. If you have a web page using SSL, your ROS env should also provide SSL to connect to the rosbridge websocket.
You can simplify and not use it, until have everything connected, in a first moment :slight_smile:

Regards

1 Like

Hi @marco.nc.arruda ,
Thanks for your reply.
Let’s say I host the static web page in S3 AWS… and in my index.html, I modified the scripts, the ros url changed from the localhost and point to my s3 url as below:-

function init() {
// Connecting to ROS.
var ros = new ROSLIB.Ros({
// url : ‘ws://localhost:9090’
url : ‘ws://http://tars-delivery-robot.s3-website-ap-southeast-1.amazonaws.com/:9090’
});

and when I run roslaunch rosbridge_server rosbridge_websocket.launch in terminal, it mentioned that Rosbridge WebSocket server started at ws://0.0.0.0:9090

2021-06-03 12:31:03+0100 [-] [INFO] [1622719863.625979, 42.953000]: Rosbridge WebSocket server started at ws://0.0.0.0:9090

In order for them to get connected, that is from ROS terminal to s3 url, the rosbridge websocket should start at s3 url instead , am i right ?!

If yes, I changed the launch file in rosbridge socket from the ws://0.0.0.0:9090 to ws://http://tars-delivery-robot.s3-website-ap-southeast-1.amazonaws.com/:9090 ?

However, I got an Permission denied error, when I ran roslaunch rosbridge_server rosbridge_websocket.launch.

Do you know how should I solve it? Please help…
I’m considering of adding SSL cert, maybe later.

Appreciate your help. :pray: :heart:
Thank you. :blush:

Hi @okkewei,

You can connect the website wherever it is hosted to your localhost, since the address localhost:9090 is reachable to your computer.

Bear in mind it won’t be accessible to others (the websocket server) if you don’t have a public IP or DNS poiting to it

So the rosbridge address won’t be changed to this S3 you deployed

Regards

Hi @okkewei

In order to listen on port 80, the program must be executed with sudo permissions.

I would consider either listening in a different port (higher than 1024) to avoid sudo permissions, or then use a proxy like Apache or Nginx (that already runs on port 80 by default) to serve your content.

Hi @marco.nc.arruda , do you mean that i have to get the public IP address from the S3 bucket that i generated , and then put it in the rosbridge address in the launch file?

No,

You don’t need public IP for S3 because it already provides a DNS name for your webpage.

But if you want your rosbridge server accessible for others, you will need one for the computer that runs rosbridge.

@marco.nc.arruda
I managed to create a webpage (from localhost) that can control the robot when i established the rosbridge in terminal.
so to deploy the webpage, I moved the localhost webpage to aws s3, but when i established the rosbridge in terminal, the webpage in s3 and rosbridge are apparently not connected, because rosbridge talked to localhost.
So what should i do? Appreciate it if you can elaborate the step in details…

@marco.nc.arruda do you mean that i need a public ip for the computer that runs rosbridge?

Hi @okkewei ,

It depends to whom you want to provide access to rosbridge.

Do you want to make it public? Or only for your own access?

Now I can control the robot when i launch from s3 url. What I did was:-

  1. In terminal, i run roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
  2. then run roslaunch rosbridge_server rosbridge_websocket.launch
  3. open the index.html where i hosted it in aws s3. In the index.html, i initiated the ros connection to point to s3 url.

In aws s3, i opened up the s3 bucket to public. However, when i access the s3 url from my mobile,I managed to open up the s3 link, but i couldn’t control the robot that runs in my laptop.
Do you know why? Do I have to change the something so that my rosbridge is connected with the webpage (index.html) whoever open up the link??

Hi @okkewei ,

The URL you setup there does not make sense, because it contains both ws:// and http://protocols. Rosbridge runs with ws:// protocol.

As I mentioned, the S3 webpage is public accessible, that’s why you can access from any device in the world.
Is your rosbridge server accessible to any device as well?

The connection to rosbridge is established between the device that access the page and your laptop, so your laptop must be public accessible to these devices as the S3 address is.

1 Like

If you check in the course provided, the academy is providing a public DNS name for your rosbridge server. This is an internal configuration of our platform.
You need to manage that in your laptop, using proxy server, like ngrok, for example, to create a public DNS name for your rosbridge server

1 Like

@marco.nc.arruda Thanks for your guidance, i really appreciate your time and effort in helping me in this…
My rosbridge server is currently not connected to any robot yet (but this is my ultimate goal). I’m running a simulation to run it.

I have my ngrok installed in order to make my laptop publicly accessible… but I was the tutorial from Youtube where people use ngrok to make their website publicly accessible by using command ngrok http <port_number>, and use port-forwarding to access it. However, I have no idea how this ngrok can make my laptop publicly accessible so that others can control the simulation robot (in my laptop) from the webpage that hosted in S3. Will really appreciate it if you can enlighten me in this… :pray: