在本地开发时,如果我使用以下命令而不是meteor
MONGO_URL='mongodb://user:MY-PASSWORD.mlab.com:57057/DB-NAME' meteor --settings settings.json
当我使用meteor-up进行部署时,我的网站上没有任何内容,因此它似乎使用空的本地数据库而不连接到远程数据库。 Meteor-up的设置看起来很简单,所以我不确定我做错了什么:
module.exports = {
servers: {
one: {
// TODO: set host address, username, and authentication method
host: 'DIGITAL-OCEAN-IP',
username: 'root',
pem: '~/.ssh/id_rsa',
// password: 'PASSWORD',
// or neither for authenticate from ssh-agent
},
},
app: {
// TODO: change app name and path
name: 'APP-NAME',
path: '../',
servers: {
one: {},
},
buildOptions: {
serverOnly: true,
},
env: {
// TODO: Change to your app's url
// If you are using ssl, it needs to start with https://
ROOT_URL: 'http://DIGITAL-OCEAN-IP',
// MONGO_URL: 'mongodb://localhost/meteor',
MONGO_URL: 'mongodb://DB-USER:PASSWORD@ds157057.mlab.com:57057/DB-NAME',
},
// ssl: { // (optional)
// // Enables let's encrypt (optional)
// autogenerate: {
// email: 'email.address@domain.com',
// // comma separated list of domains
// domains: 'website.com,www.website.com'
// }
// },
docker: {
// change to 'abernix/meteord:base' if your app is using Meteor 1.4 - 1.5
image: 'abernix/meteord:node-8.4.0-base',
},
// Show progress bar while uploading bundle to server
// You might need to disable it on CI servers
enableUploadProgressBar: true,
},
mongo: {
version: '3.4.1',
servers: {
one: {},
},
},
};
答案 0 :(得分:0)
你必须注释掉这个:
// Remove so mlab works when deployed
// mongo: {
// version: '3.4.1',
// servers: {
// one: {},
// },
// },