Multiple applications on the same parsing server

I worked all week to transfer my applications hosted on parse.com to the server parsing, everything was done perfectly, the only problem is getting it to run several applications on the same equipment without my dedicated server application for this, it will be expensive.

I read this discussion about this, and based on this, do the following solution:

var app1 = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'myAppId1', masterKey: process.env.MASTER_KEY || 'myMasterKey1', //Add your master key here. Keep it secret! serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed push: pushConfig, liveQuery: { classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions } }); var app2 = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/app2', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'myAppId2', masterKey: process.env.MASTER_KEY || 'myMasterKey2', //Add your master key here. Keep it secret! serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed push: pushConfig, liveQuery: { classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions } }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: // javascriptKey, restAPIKey, dotNetKey, clientKey var app = express(); // Serve static assets from the /public folder app.use('/public', express.static(path.join(__dirname, '/public'))); // Serve the Parse API on the /parse URL prefix var mountPath = process.env.PARSE_MOUNT || '/parse'; app.use(mountPath, app1); app.use(mountPath, app2); 

This works until the time testing environment can use several applications to send push to the same equipment, simply by creating several instances of the server parsing, pointing to different databases.

Can someone tell me if something could go wrong with applications in production? Could this cause me problems in the future?

Does anyone support this solution?

Thanks!

+6
source share
2 answers

Parse Server as of v2.2.9 does not support multi-application support.

Each application requires separate instances (and mount paths). Otherwise, you would encounter complications regarding cloud code, since the kernel is not designed to support multiple applications, although it has some legacy from Parse.com, for example, the appId property, which will be a step towards it.

However, since it is now an open source project, it may offer support for several applications in the future.

Update

Parse server v2.2.18 still only supports one application per instance, according to the wiki :

Parse Server only supports single instances of the application. Work continues to ensure multi-user mode of Parse Server. However, if you intend to run many different applications with different data stores, you currently need to instantiate individual instances.

+3
source

Use PM2 and start 2 instances of Parse Server. Here's what the PM2 configuration file looks like:

 { "apps": [ { "name": "app1", "script": "servers/app1/server.js", "cwd": "/home/parse", "log_file": "logs/server-app1.log", "error_file": "logs/server-app1-error.log", "log_date_format": "YYYY-MM-DD HH:mm:ss Z", "instances": 1, "merge_logs": true, "watch": ["/usr/bin/parse-server", "/home/parse/servers/app1"], "ignore_watch": ["logs"], "env": {"VERBOSE": true} }, { "name": "app2", "script": "servers/app2/server.js", "cwd": "/home/parse", "log_file": "logs/server-app2.log", "error_file": "logs/server-app2-error.log", "log_date_format": "YYYY-MM-DD HH:mm:ss Z", "instances": 1, "merge_logs": true, "watch": ["/usr/bin/parse-server", "/home/parse/servers/app2"], "ignore_watch": ["logs"], "env": {"VERBOSE": true} }, { "name": "parse-dashboard", "script": "/usr/bin/parse-dashboard", "args": "--config dashboard/parse-dashboard-config.json --mountPath /dashboard", "cwd": "/home/parse", "log_file": "logs/dashboard.log", "error_file": "logs/dashboard-error.log", "log_date_format": "YYYY-MM-DD HH:mm:ss Z", "instances": 1, "watch": ["/usr/bin/parse-dashboard"] } ] } 
0
source

All Articles