繁体   English   中英

在Google Cloud Platform上部署MEAN.JS

[英]Deploy MEAN.JS on Google Cloud Platform

我尝试在Google Cloud Platform(也包括KeystoneJS CMS)上部署MEAN.JS,但是它不起作用。 我在线使用命令行工具。

按照顺序,我安装了Node.js,MongoDB,bower和grunt,然后尝试部署MEAN.JS:

  • 安装Node.js: sudo apt-get install curl curl -sL https://deb.nodesource.com/setup | sudo bash - sudo apt-get install -y nodejs nodejs-legacy sudo apt-get install curl curl -sL https://deb.nodesource.com/setup | sudo bash - sudo apt-get install -y nodejs nodejs-legacy

  • 安装MongoDB: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list sudo apt-get update sudo apt-get install -y mongodb-org sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list sudo apt-get update sudo apt-get install -y mongodb-org

  • 安装bower et Grunt: sudo npm install -g bower sudo npm install -g grunt-cli

  • 安装MEAN.js: sudo npm install -g generator-meanjs mkdir mean cd mean yo meanjs grunt

这是命令行板上的结果:

Running "jshint:all" (jshint) task 53 files lint free. Running "csslint:all" (csslint) task 2 files lint free. Running "concurrent:default" (concurrent) task Running "watch" task Running "nodemon:dev" (nodemon) task Waiting... [nodemon] v1.2.1 [nodemon] to restart at any time, enter rs [nodemon] watching: app/views/ / . gruntfile.js server.js config/ / .js app/* /*.js [nodemon] starting node --debug server.js debugger listening on port 5858 NODE_ENV is not defined! Using default development environment js-bson: Failed to load c++ bson extension, using pure JS version Failed to load c++ bson extension, using pure JS version MEAN.JS application started on port 3000

我可以定义NODE_ENV变量(测试,开发等),但这是相同的问题。


问题是 :
它应该可以工作,但是如果我尝试访问我的IP:端口(在本例中为146.148.113.68:3000):“此网页不可用”。
VM,软件包MEAN.JS是否有问题? 我在KeystoneJS CMS中有相同的问题。

谢谢 !

您确定机器的端口已打开以供访问吗? 在Compute Engine上部署应用程序时,必须编辑网络设置以允许自定义端口。 有简单的复选标记选项可用于允许HTTP和HTTP通信,但是对于自定义端口,则必须在设置中添加端口。

该文档可能会有所帮助,但您始终可以在Cloud Console中找到这些内容。

此外,现在Google Cloud Launcher还支持MEAN.io和MEAN.js两种版本的MEAN堆栈部署,从而简化了整个过程。

一切看起来都很好,唯一需要更改的是阻止您的Web应用程序的防火墙设置,VM或KeystoneJS CMS没有问题。 您只需要更改传入和传出流量的防火墙设置即可:

防火墙设置

您需要指定ip和端口号,出于测试目的,我已临时访问所有端口。

在此处输入图片说明

尝试其他服务来托管您的MEANJS Web应用程序。 Heroku: https: //www.heroku.com/ Nodejitsu: https ://www.nodejitsu.com/

如果它可以在这些平台上运行,那么问题就不在于您的云。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM