如何将meteorjs项目部署到数字海洋?
如何部署MeteorJS项目到数字海洋VPS? CentOS x64 – 对它有好处? 或者我需要设置别的东西?
这有点困难,如果你对Meteor和Node.js不熟悉,那么把握太多了。
-
您首先必须在您的Digital Ocean VPS上设置Node.js:
How to install Node.js on Ubuntu https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
-
那么你将不得不打包你的Meteor应用程序: http : //docs.meteor.com/#deploying
meteor bundle myapp.tgz
-
然后,您将在VPS上安装MongoDB或注册MongoHQ
-
那么你必须启动应用程序:
PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js
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部署你将不得不检查meteor.sh文件,并find它补丁server.js文件的行,因为该文件可能会随着时间的推移而变化,你必须确保修补程序的目标是正确的线。
如果应用程序仍然中断,请设置以下variables:
export APP_NAME=meteorapp export ROOT_URL=http://yourdomain.com export APP_DIR=/var/www/meteorapp export MONGO_URL=mongodb://localhost:27017/meteorapp
这个,或多或less,用UBUNTU 32位V12为我工作
安装服务器软件
$ 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
生成包
$ meteor bundle myapp.tgz
在服务器中复制并解压这个文件,用你的应用程序创build一个包文件夹。
testing你的应用程序:
$ export ROOT_URL=http://mydomain.com $ PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js
调音
永远使用
https://github.com/nodejitsu/forever
永远testing:
$ PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp forever start bundle/main.js $ ps aux | grep node $ forever list $ forever stop bundle/main.js
在服务器初始化上运行应用程序
$ 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
在脚本中使用绝对path,根据您的服务器/应用程序configuration更改上述path。