[nevermind] Preferred pattern for connecting two Meteor Apps


#1

Hi everyone,

I noticed there are at least two ways to connect two meteor apps.

Method 1:

Modify the MONGO_URLs in the env of App1 and App2 to point to some external mongo instance.

Method 2:

Modify the MONGO_URL in the env of App2 to point to a mongo instance, and have App1 connect to App2 through DDP.connect, and then pass this into calls to Mongo.Collection.

//in App1
App2 = DDP.connect('http://app2url.somedomain.com')
//App2 points to some mongo instance
PostsFromApp2 = new Mongo.Collection('posts', App2)
//does App1 point directly to the same mongo instance
//or is it pointing to App2?

Is there a key architectural difference between these two methods? For example, in Method 1, both apps point directly to mongo. In Method 2, does the 'posts' data from App1 come from App2, which comes from mongo?

Any input is appreciated, thanks!


#2

Server 2 will treat Server 1 as another client, so any calls to the collection on Server 1 will have to go through Server 2 first, just as any other client. To connect the servers in an equal partnership, you need to set MONGO_URL, or else only one server will be given full privileges. This makes sense, or else any server could DDP.connect and start performing arbitrary operations on the initial server.