Identify multiple ports from ManagedVM

I use the functionality of a managed virtual machine to start a WebSocket server that I would like to open on the Internet on any port (preferably port 80) using a URL, for example: mvm.mydomain.com

I have not had much success yet. Here are the relevant parts of the various files that I use for this:

Dockerfile:

EXPOSE 8080 8081

At the end of the Docker file, a Python application starts: it responds to health checks on port 8080 (I can verify that it works) and responds to WebSocket requests on port 8081.

app.yaml:

module: mvm
version: 1
runtime: custom
vm: true
api_version: 1

network:
  forwarded_ports: ["8081"]

I am deploying this application in the cloud using:

$ gcloud preview app deploy .

In the cloud console, I’m sure that TCP ports 8080 and 8081 are accepted for incoming traffic. I also observe the IP address assigned to the GCE instance (mvm: 1): xyzz

$ curl http://x.y.z.z:8080/_ah/health
$ curl http://mvm.my-app-id.appspot.com/_ah/health

200 OK.

WebSocket JavaScript :

new WebSocket('ws://x.y.z.z:8081');

. , ():

new WebSocket('ws://mvm.my-app-id.appspot.com:8081');

, WebSocket . , -, GAE/GCE?

- , , .

dispatch.yaml:

dispatch:
  # Send all websocket traffic to the ManagedVM module.
  - url: "mvm.mydomain.com/*"
    module: mvm

GAAME GAE mvm.mydomain.com.

WebSocket JavaScript :

new WebSocket('ws://mvm.mydomain.com:8081');
+4
1

, appspot.com , ( ) , appspot.com, 80 443. IP-of-instance, , , .

, , appspot.com , , .

, , , , , appspot.com, , appspot.com , . /, , , , , ...

, , , , , - appspot.com .

0

Source: https://habr.com/ru/post/1568894/


All Articles