How to deploy meteorjs project to digital ocean?
Asked Answered
I

3

9

How to deploy meteorJS project to Digital Ocean VPS? CentOS x64 - is good for it? Or I need to setup something else?

Indulgence answered 24/5, 2013 at 10:55 Comment(1)
Just make sure with your deployment you use node 0.8.2x as 0.10.x has issues with centos and memory leaks with sockjsAdaiha
K
5

It is a bit difficult, and if you are new to Meteor and Node.js it would properly be too much to grasp.

  1. You will first have to setup Node.js on your Digital Ocean VPS:

    How to install Node.js on Ubuntu
    https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
    
  2. Then you wil have to package your Meteor app: http://docs.meteor.com/#deploying

    meteor bundle myapp.tgz
    
  3. Then you would either install MongoDB on the VPS or sign up for MongoHQ

  4. Then you have to start the app:

    PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js
    
Krystakrystal answered 24/5, 2013 at 12:37 Comment(1)
Instructions to install and run meteor are at doc.meteor.com -- quickstart and work fine on Digital Ocean vps for supported os.Bogeyman
R
4

the meteor.sh script will help you providing setup and deploy commands. Anyway, the setup command was broken for me, so I installed everything with:

sudo apt-get install software-properties-common
sudo apt-get install python-software-properties python g++ make
add-apt-repository ppa:chris-lea/node.js
sudo apt-get update

sudo apt-get install nodejs
sudo apt-get install -y build-essential  
apt-get install mongodb
npm install -g forever

Then use meteor.sh deploy You'll have to check the meteor.sh file and find the lines where it patches the server.js file, since that file may change over time you have to make sure that the patch targets the right lines.

If the app is still broken, set these variables:

export APP_NAME=meteorapp
export ROOT_URL=http://yourdomain.com
export APP_DIR=/var/www/meteorapp
export MONGO_URL=mongodb://localhost:27017/meteorapp

This, more or less, worked for me with UBUNTU 32bit V12

Rhynd answered 31/5, 2013 at 0:15 Comment(0)
F
0

Install server software

$ sudo apt-get install software-properties-common
$ sudo apt-get install python-software-properties python g++ make
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update

$ sudo apt-get install nodejs
$ sudo apt-get install -y build-essential  
$ sudo apt-get install mongodb
$ npm install -g forever

Generate the bundle

$ meteor bundle myapp.tgz

Copy and unzip this file in the server, creating a bundle folder with your app.

To test your app:

$ export ROOT_URL=http://mydomain.com
$ PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js

Tuning

Using forever

https://github.com/nodejitsu/forever

Testing with forever:

$ PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp forever start bundle/main.js

$ ps aux | grep node

$ forever list

$ forever stop bundle/main.js 

Running the app on server initialization

$ sudo vi /etc/rc.local

...

# Launch Meteor app
export ROOT_URL=http://mydomain.com:3000
PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp /usr/bin/forever start /home/user/bundle/main.js

exit 0

Use absolute paths in the script, change the above paths according your server/app config.

Fancie answered 25/2, 2014 at 15:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.