meteor-up

External database working with Meteor when local but not after i deploy?


When developing locally I can make Meteor use an external database if I start it with the following command instead of just meteor

MONGO_URL='mongodb://user:MY-PASSWORD.mlab.com:57057/DB-NAME' meteor --settings settings.json

When I deploy with meteor-up I have no content on my site, so it seems its using a empty local database not connecting to the remote one. Meteor-up's settings seem quite simple so I'm not sure what I could be doing wrong:

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: {},
        },
    },
};

Solution

  • You have to comment out this:

    // Remove so mlab works when deployed
    // mongo: {
    //  version: '3.4.1',
    //  servers: {
    //      one: {},
    //  },
    // },