[SOLVED] Setup MUP for clustering: "CLUSTER_DISCOVERY_URL"

Hey there,

this is my mup.json:

{
// Server authentication info
"servers": [{
        "host": ip-1,
        "username": "root",
        // "password": "password"
        // or pem file (ssh based authentication)
        "pem": "~/.ssh/id_rsa"
    }, {
        "host": ip-2,
        "username": "root",
        // "password": "password"
        // or pem file (ssh based authentication)
        "pem": "~/.ssh/id_rsa"
    }

],

// Install MongoDB in the server, does not destroy local MongoDB on future setup
"setupMongo": false,

// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,

// WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
"nodeVersion": "0.10.36",

// Install PhantomJS in the server
"setupPhantom": true,

// Show a progress bar during the upload of the bundle to the server.
// Might cause an error in some rare cases if set to true, for instance in Shippable CI
"enableUploadProgressBar": false,

// Application name (No spaces)
"appName": "Scrounge",

// Location of app (local directory)
"app": ".",

// Configure environment
"env": {
    "ROOT_URL": "Scrounge.com",
    "MONGO_URL": "mongodb://app:pwd@c196.cockney.2.mongolayer.com:10196,cockney.3.mongolayer.com:10196/ScroungeBA?replicaSet=set-55c254c23dcda9ec180010c1",
    "MONGO_OPLOG_URL": "mongodb://oplogger:pwd@c196.cockney.2.mongolayer.com:10196,cockney.3.mongolayer.com:10196/local?authSource=ScroungeBA",
    "DISABLE_WEBSOCKETS": "1",

    "CLUSTER_DISCOVERY_URL": "mongodb://app:pwd@c196.cockney.2.mongolayer.com:10196,cockney.3.mongolayer.com:10196/ScroungeBA?replicaSet=set-55c254c23dcda9ec180010c1",
    "CLUSTER_SERVICE": "web"
},

// Meteor Up checks if the app comes online just after the deployment
// before mup checks that, it will wait for no. of seconds configured below
"deployCheckWaitTime": 15

When I comment “CLUSTER_DISCOVERY_URL” and “CLUSTER_SERVICE” the application runs just fine. But otherwise only the initial page loads but it is not possible to login / access the database.
Database is hosted on compose.io

1 Like

Sorry, I’m not here to answer your question, but for gods sake, please wrap your code in

// Markdown!
// This is much nicer to read.
function readable () {
    ...
}
// all it takes is ``` at the start and end of your code
1 Like

thanks for the hint :wink:

1 Like

You need to use a correct URL for the ROOT_URL.
It should be http://scrounge.com

I guess that is the problem. I am having lack of knowledge what the ROOT_URL is about. Changed it to http://scrounge.com

However I never set up this URL. Can I just point to ip-1 as a ROOT_URL or do I have to setup a DNS?

My configuration now looks like:

{
    // Server authentication info
    "servers": [{
            "host": ip-1,
            "username": "root",
            // "password": "password"
            // or pem file (ssh based authentication)
            "pem": "~/.ssh/id_rsa"
            // "env": {
            //     "CLUSTER_BALANCER_URL": "http://one.scrounge.eu"
            // }
        }, {
            "host": ip-2,
            "username": "root",
            // "password": "password"
            // or pem file (ssh based authentication)
            "pem": "~/.ssh/id_rsa"
            // "env": {
            //     "CLUSTER_BALANCER_URL": "http://two.scrounge.eu"
            // }
        }

    ],

    // Install MongoDB in the server, does not destroy local MongoDB on future setup
    "setupMongo": false,

    // WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
    "setupNode": true,

    // WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
    "nodeVersion": "0.10.36",

    // Install PhantomJS in the server
    "setupPhantom": true,

    // Show a progress bar during the upload of the bundle to the server.
    // Might cause an error in some rare cases if set to true, for instance in Shippable CI
    "enableUploadProgressBar": false,

    // Application name (No spaces)
    "appName": "Scrounge",

    // Location of app (local directory)
    "app": ".",

    // Configure environment
    "env": {
        "ROOT_URL": "http://scrounge.eu",
        "MONGO_URL": "mongodb://app:pwd@c196.cockney.2.mongolayer.com:10196,cockney.3.mongolayer.com:10196/ScroungeBA?replicaSet=set-55c254c23dcda9ec180010c1",
        "MONGO_OPLOG_URL": "mongodb://oplogger:pwd@c196.cockney.2.mongolayer.com:10196,cockney.3.mongolayer.com:10196/local?authSource=ScroungeBA",
        "DISABLE_WEBSOCKETS": "1",

        "CLUSTER_DISCOVERY_URL": "mongodb://app:pwd@c196.cockney.2.mongolayer.com:10196,cockney.3.mongolayer.com:10196/ScroungeBA?replicaSet=set-55c254c23dcda9ec180010c1",
        "CLUSTER_SERVICE": "web"
    },

    // Meteor Up checks if the app comes online just after the deployment
    // before mup checks that, it will wait for no. of seconds configured below
    "deployCheckWaitTime": 15
}

Works great!

Okay, the last struggle is how to set up the balancer. I uncomment the balancer lines but running into:

POST http://one.scrounge.eu/cluster-ddp/6832cc0276da6c9c4e5339ac808706302be6b4c7/web/583/o689yta2/xhr net::ERR_NAME_NOT_RESOLVED

How do I have to set up cloudflare? I got 2 A records with the droplet IPs and one CNAME for www.

Setup complete. No idea why one and two didn’t work.
I change it to: three and four as a CNAME to scrounge.eu and it works fine.

Great work arunoda! :smile:

Hi there,

I’m about to try the cluster package and also use the D.O. + Compose + Mup configuration.

I can understand and replicate your mup.json file.
In your case, you have two Digital Ocean droplets each one with it’s own credentials on “servers”, right?

You manage to solve your issue just by creating a CNAME “two” and “three” on each droplet pointing to your root url?

1 Like

Yes, I created a CNAME for three and four since one and two didn’t work for some reason.

1 Like

Can you explain what you did with your cname? I don’t get it… and where does your ROOT_URL point?