簡體   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