简体   繁体   中英

Deploy MEAN.JS on Google Cloud Platform

I tried to deploy MEAN.JS on Google Cloud Platform (also the KeystoneJS CMS), but it doesn't work. I use the command-line tool online.

In the order, i installed Node.js, MongoDB, bower and grunt, then I try to deploy MEAN.JS :

  • Install 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

  • Install 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

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

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

Here is the result on the command-line board :

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

I can define the NODE_ENV variable (test, development, all...) but it's the same problem.


The problem is :
It should work but whan i try to access to my IP:port (in this case 146.148.113.68:3000) : "This webpage is not available".
Is it a problem with the VM, the packages, MEAN.JS ? I have the same problem with the KeystoneJS CMS.

Thanks !

Are you sure ports to your machine are open for access? When you deploy an app on Compute Engine, you have to edit network settings to allow custom ports. There's easy checkmark options for allowing HTTP and HTTPs traffic, but for custom ports, you will have to add port in settings.

This documentation might be helpful but you can always find these things in the Cloud Console.

Also, now Google Cloud Launcher also supports MEAN stack deployment with both MEAN.io and MEAN.js flavors which simplifies the whole process.

Everything looks fine Only thing to change is the firewall settings which is blocking your web application ,there is no problem with VM or KeystoneJS CMS. You Need to just change the firewall settings for incoming and Outing Traffic:

防火墙设置

You need to specify the ip and port number , i have given access to all ports temporarily for testing purpose.

在此处输入图片说明

Try other services to host your MEANJS Web Application. Heroku : https://www.heroku.com/ Nodejitsu : https://www.nodejitsu.com/

If it works in these platoforms,then the problem is not with your cloud.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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