problem deploying on google cloud instance

Added by Michael Schuitema 5 months ago

I have build the hello world example and I am trying to deploy this on a Google Cloud instance. It seems to run fine locally (hence it has all the necessary library dependencies). However, I am not able to it to deploy on the server.

I am trying (using my actual http address which is different from the example below)
./hello --docroot . --http-address 105.150.47.754 --http-port 80

but it responds with

Error (asio): bind : cannot assign requested address

It seems to work fine using (0.0.0.0/0)

The cloud instance allows HTTP tcp/80 traffic.

Any ideas what might be wrong?

I have tried setcap 'cap_net_bind_service=+ep' ~/hello

to allow non-root users to publish on ports below 1024, but also to no avail.

Any suggestions?

Cheers, Mike


Replies (2)

RE: problem deploying on google cloud instance - Added by Wim Dumon 5 months ago

Hey Mike,

No idea... any luck with './hello --docroot . --http-address 0.0.0.0 --http-port 80'? 0.0.0.0 means 'listen on all interfaces'.

It is correct that you have to be root to listen on ports < 1024 on unix systems. You may test to run the Wt application as root; if that works, your setcap command may be wrong or insufficient...

Wim.

RE: problem deploying on google cloud instance - Added by Michael Schuitema 5 months ago

Wim thanks that (./hello --docroot . --http-address 0.0.0.0 --http-port 80') works. However, this does not look like a production solution. It seems the machine could be misused for DoS attacks.

I also tried to run it as ./hello --docroot . --http-address 10.150.0.4 --http-port 80

where 10.150.0.4 is the interal IP and that also works. This already looks more secure, but would be great if anyone could confirm that it is save.

Cheers, Mike

(1-2/2)