Gone are the days where a product team used to spend a considerable amount of time to build a basic web application. Say Hi to MEAN! If you are familiar with LAMP/WAMP stacks, you could consider MEAN as a complete stack based on JavaScript. In fact, MEAN represents MongoDB, Express, AngularJS, and NodeJS:
With MEAN, you could have your web application running in less than 10 minutes.
Deploying a MEAN based application on AWS or Azure is quite straightforward as there are ready-made templates from 3rd party vendors like Bitnami. Nevertheless, it’s not that easy on Google Compute Engine, given that there are no built-in images for that platform.
In this post, I will describe the rationale in choosing MEAN stack over others, and 10 Steps to deploy a MEAN stack on Google Compute Engine
We have had rich experience in creating many enterprise application using J2EE, Python, .Net and other technologies. You may wonder why on earth we chose MEAN! Let me list down the reasons:
So, all this considered, here are the steps to deploy a MEAN stack on GCP
Step 1: Sign up for Google Compute Engine, or sign in if you have an account already
Step 2: Create a project or Go into your existing Project
Step 3: Go to Google Compute Engine -> VM Instances
Step 4: Create a CentOS based VM Instance
Step 5: Once the VM is up, SSH into the VM Instance
gcutil --service_version="v1" --project="##your_project" ssh --zone="asia-east1-a" "my-mean-stack"
Step 6: Download NodeJS and Place it on your path:
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-x64.tar.gz
tar xvfz node-v0.10.28-linux-x64.tar.gz
mv node-v0.10.28-linux-x64 /usr/share/
Step 7: Install MongoDB and git:
sudo yum install mongodb-org git
Step 8: Deploy meanio module
$sudo npm install -g meanio
$mean init my-mean-app
Cloning branch: master into destination folder: my-mean-app
Initialized empty Git repository in /home/user/my-mean-app/.git/
....
install dependencies:
$ cd my-mean-app && npm install
Step 9: Start your server
$ grunt
Running "clean:0" (clean) task
Running "jshint:all" (jshint) task
>> 41 files lint free.
Running "csslint:src" (csslint) task
>> 3 files lint free.
Running "concurrent:tasks" (concurrent) task
Running "watch" task
Waiting...
Running "nodemon:dev" (nodemon) task
[nodemon] v1.0.20
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node --debug server.js`
debugger listening on port 5858
js-bson: Failed to load c++ bson extension, using pure JS version
Mean app started on port 3000 (development)
Failed to load c++ bson extension, using pure JS version
Step 10: Open up port 3000 in your Google Compute Network Firewall
TThat’sit! Launch your browser and point it to http://your_external_ip:3000/
. Your web app is up and running!
It's Flash Sale time! Get 50% off your first year with Cloud Academy: all access to AWS, Azure, and Cloud…
In this blog post, we're going to answer some questions you might have about the new AWS Certified Data Engineer…
This is my 3rd and final post of this series ‘Navigating the Vocabulary of Gen AI’. If you would like…