使用分离的数据库部署应用程序(MONGO URL)

你需要将应用程序层与数据库层分开,这意味着指定 MONGO_URL。这意味着通过 bundle 命令运行你的应用程序,解压缩它,设置环境变量,然后将项目作为节点应用程序启动。这是如何做…

#make sure you're running the node v0.10.21 or later
npm cache clean -f
npm install -g n
sudo n 0.10.21

# bundle the app
mkdir myapp
cd myapp 
git clone http://github.com/myaccount/myapp
meteor bundle --directory ../deployPath
cd ../deployPath

# make sure fibers is installed, as per the README
export MONGO_URL='mongodb://127.0.0.1:27017/mydatabase'
export PORT='3000'
export ROOT_URL='http://myapp.com'

# run the site
node main.js