我正在尝试在微型GCE实例(微型,始终免费)上设置Rocket Chat服务器。 我已经通过snapn安装了Rocket.Chat,没有任何问题(SSH访问)。服务已启动并正在运行,并且外部IP可ping通。
RocketChat使用的端口是3000,我已经创建了所需的防火墙规则:
inbound - all instances - IP Range 0.0.0.0/0 - tcp:3000 - allow - priority 1
inbound - all instances - IP Range 0.0.0.0/0 - udp:3000 - allow - priority 2
但是,当我尝试通过浏览器连接时,出现“拒绝”。我想念什么?
答案 0 :(得分:-1)
您需要添加firewall rule on GCP才能将入口端口3000(tcp和udp)添加到您的GCE实例所在的VPC网络中,也可以使用gcloud command添加防火墙规则,如下所示:
gcloud compute firewall-rules create [name] --action allow --rules tcp:3000,udp:3000 --direction INGRESS --network [VPC_NAME]
我成功创建了一个RocketChat,并使用启用了允许HTTP流量的微型实例进行了快照(这是Debian) 遵循步骤here
sudo apt-get install snapd
sudo snap install rocketchat-server
然后检查服务器的状态
sudo service snap.rocketchat-server.rocketchat-server status
输出:
$ sudo service snap.rocketchat-server.rocketchat-server status
● snap.rocketchat-server.rocketchat-server.service - Service for snap application rocketchat-server.rocketchat-server
Loaded: loaded (/etc/systemd/system/snap.rocketchat-server.rocketchat-server.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-01-09 21:14:25 UTC; 14min ago
Main PID: 6148 (startRocketChat)
Tasks: 12 (limit: 4915)
CGroup: /system.slice/snap.rocketchat-server.rocketchat-server.service
├─6148 /bin/bash /snap/rocketchat-server/1356/bin/startRocketChat
└─6165 node /snap/rocketchat-server/1356/main.js
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | Rocket.Chat Version: 0.72.3 |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | NodeJS Version: 8.11.3 - x64 |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | Platform: linux |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | Process Port: 3000 |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | Site URL: http://localhost |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | ReplicaSet OpLog: Enabled |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | Commit Hash: 65747ce814 |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | Commit Branch: HEAD |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ | |
Jan 09 21:14:44 rocketchat rocketchat-server.rocketchat-server[6148]: ➔ +-----------------------------------------+
curl localhost:3000
成功,但外部IP curl [EXTERNAL_IP]:3000
失败。
然后在上面添加了防火墙规则(使用gcloud命令或由您决定的控制台),然后我便可以卷曲我的外部IP,并能够使用EXTERNAL_IP:3000作为设置向导来浏览。
您还可以使用docker部署Rocket.Chat,请参见此documentation