How to deploy meteorJS project to Digital Ocean VPS? CentOS x64 - is good for it? Or I need to setup something else?
It is a bit difficult, and if you are new to Meteor and Node.js it would properly be too much to grasp.
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
Then you wil have to package your Meteor app: http://docs.meteor.com/#deploying
meteor bundle myapp.tgz
Then you would either install MongoDB on the VPS or sign up for MongoHQ
Then you have to start the app:
PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js
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
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.
© 2022 - 2024 — McMap. All rights reserved.