How to Install And Deploy a Meteor App on Centos 6.X


INSTALL AND DEPLOY A METEOR APP ON CENTOS
** Production Environment:
1. Centos
2. Apache

** Software Stack on production:
1. Mongo DB
2. Node.js 0.1.100
3. NodeJS “Forever” module to start application in the background

Step 1: Just make sure that all the development libraries are available.

# yum update -y
# yum groupinstall "Development Tools" -y

Step 2: Install Node.js and NPM

# wget http://nodejs.org/dist/v0.10.4/node-v0.10.4.tar.gz
# tar xvfz node-v0.10.4.tar.gz
# cd node-v0.10.4
# ./configure
# make
# make install
# rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

Step 3: Install MongoDB
Create a /etc/yum.repos.d/mongodb.repo file to hold the following configuration information for the MongoDB repository:

# vi /etc/yum.repos.d/mongodb.repo

add these lines

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

--- save and quit (:wq) ---

# yum install mongo-10gen mongo-10gen-server -y

Step 4: Package your app from your local machine where the app situated for testing purpose.

# meteor build <path_to_save_the_file>

Step 5: Push app to server throuh ftp or scp

# cd yourapp_prod/bundle/programs/server
# export PORT=8080
# export MONGO_URL=mongodb://localhost:27017/yourapp_db
# export ROOT_URL=http://yourapp_domain/
# npm install
# cd ../../../
# node bundle/main.js

Step 6: Install node “forever” module to run your app in the background

# npm -g install forever
# forever start <Yourapp_Name>/bundle/main.js

Step 7: configure a reverse proxy in your apache configuration

# vi /etc/httpd/conf.d/yourapp_domain.conf

<VirtualHost *:80>
  ServerName yourapp_domain
  ProxyRequests off
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
  <Location />
    ProxyPass http://localhost:8080/
    ProxyPassReverse http://localhost:8080/
  </Location>
</VirtualHost>

--- save and quit (:wq) ---

Step 8: Install Meteor

# curl install.meteor.com | /bin/sh

Step 9: Deploy A Existing Meteor App and Screen
N.B: .meteor directory must be there without .meteor directory the app will not able to deploy

# yum -y install screen
# screen
# cd Your_app_Path
# meteor &
Press ctrl A + ctrl D together to detach the screen
---------- DONE,Thanks -------------