Google App Engine在同一应用程序上有两个端口 [英] Google App Engine two ports on same application

查看:118
本文介绍了Google App Engine在同一应用程序上有两个端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Google App Engine上运行Node js应用程序,但是我的应用程序当前在两个不同的端口上运行两个协议.其中之一是端口8080(必须在Google App Engine上工作),另一个是端口1883(mqtt服务器).查看文档,我找不到任何能使它正常工作的东西,实际上,服务器启动时没有错误,但是我当然无法连接到端口1883,只能连接http和https.

I want to run a node js application on Google App Engine but my application is currently running two protocols, on two different ports. One of them is the port 8080 (which is required to work on Google App Engine) and the other one is 1883, a mqtt server. Looking the documentation, I couldn't find anything to make this works, actually, the server starts without errors but of course I can't connect to the port 1883, only the http and https.

我需要知道这是否完全可能,如果可以的话,我该如何转发该端口或代理该端口?

I need to know if this is possible at all and if is, how do I forward that port or proxy that?

我的app.yaml:

My app.yaml:

runtime: nodejs
env: flex
service: comms-server
network:
  name: default
  subnetwork_name: default
  forwarded_ports:
    - 1883/tcp

此外,我的VPC配置是:

Also, my VPC configuration is:

推荐答案

尝试以下操作:

network:
  forwarded_ports:
  - 1883
  instance_tag: comms-server

并且:

gcloud compute firewall-rules create default-allow-comms-server \
  --allow tcp:1883 \
  --target-tags comms-server \
  --description "Allow  traffic on port 1883"

这篇关于Google App Engine在同一应用程序上有两个端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆