Is there a way to run multiple Parse server instance in one Node.js (one machine) environment? If yes, what would be the configuration.
I am specifically targeting for Jelastic, but I think general solution would be applicable anyway.
Is there a way to run multiple Parse server instance in one Node.js (one machine) environment? If yes, what would be the configuration.
I am specifically targeting for Jelastic, but I think general solution would be applicable anyway.
I'm using this way and its working perfectly
// First app instance here
var api1 = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev1',
cloud: '/home/myApp/cloud/main1.js',
appId: 'myAppId1',
masterKey: 'myMasterKey1',
fileKey: 'optionalFileKey1',
serverURL: 'http://localhost:1337/parse'
});
// Second app instance here
var api2 = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev2', // Connection string foryour MongoDB database
cloud: '/home/myApp/cloud/main2.js', // Absolute path to your Cloud Code
appId: 'myAppId2',
masterKey: 'myMasterKey2', // Keep this key secret!
fileKey: 'optionalFileKey',
serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
});
// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
// Mount Apps here
app.use(mountPath, api1);
app.use(mountPath, api2);
Hope this helps!! Let me know
You can use the cluster module for running multiple instances of the same server application. Please note that there is no routing logic in Node.js, or in your program, and no shared state between the workers. Therefore, it is important to design your program such that it does not rely too heavily on in-memory data objects for things like sessions and login.