9

如何将meteorJS项目部署到Digital Ocean VPS?CentOS x64 - 对它有好处吗?还是我需要设置其他东西?

4

3 回答 3

5

这有点困难,如果您是 Meteor 和 Node.js 的新手,那么掌握起来就太难了。

  1. 您首先必须在您的 Digital Ocean VPS 上设置 Node.js:

    How to install Node.js on Ubuntu
    https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
    
  2. 然后你必须打包你的 Meteor 应用程序: http: //docs.meteor.com/#deploying

    meteor bundle myapp.tgz
    
  3. 然后你要么在 VPS 上安装 MongoDB,要么注册 MongoHQ

  4. 然后你必须启动应用程序:

    PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js
    
于 2013-05-24T12:37:45.363 回答
4

meteor.sh 脚本将帮助您提供设置和部署命令。无论如何,设置命令对我来说是错误的,所以我安装了所有东西:

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

然后使用meteor.sh deploy 您必须检查meteor.sh 文件并找到它修补server.js 文件的行,因为该文件可能会随着时间而改变,您必须确保补丁针对正确的行。

如果应用程序仍然损坏,请设置以下变量:

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

这或多或少对我有用 UBUNTU 32bit V12

于 2013-05-31T00:15:07.510 回答
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.

于 2014-02-25T15:19:04.250 回答