Skip to content

Scaling Fireloop

Jonathan Casarrubias edited this page Apr 18, 2017 · 2 revisions

FireLoop.io

Scaling FireLoop

Building apps with FireLoop is nice and easy, but that would be worthless if the platform wouldn't scale into multiple server or even process instances.

The following documentation will explain how to enable FireLoop to work under clustered environments.

Requirements

Creating DataSource

Regardless the datasource you select for your API Models, you will need to create a datasource pointing to a MongoDB or Redis database.

If you already selected MongoDB or Redis database for your API Models, you won't need to create a new datasource, users using any other databases like SQL ones, will require to create a new datasource pointing to MongoDB or Redis and install its LoopBack dependency.

$ cd to/project/api
$ npm install --save [loopback-connector-mongodb | loopback-connector-redis]

and configure as any other LoopBack datasource, example:

{
  "mongodb": {
    "url": "mongodb://user:pass@host:27016/dbname",
    "name": "mongodb",
    "connector": "mongodb"
  }
}

server/datasources.json

Enable Clustering Mode

In order to enable the clustering mode, we need to set the following configurations:

{
  "@mean-expert/loopback-component-realtime": {
    "auth": true,
    "debug": false,
    "driver": {
      "name": "socket.io",
      "options": {
        "adapter": {
          "name": "socket.io-adapter-mongo",
          "datasource": "mongodb"
        }
      }
    }
  }
}

Please note that the adapter.name should be the adapter you selected and installed prior this process, as well as the adapter.datasource should be the name of the datasource you created.

After following the configurations above, FireLoop will work either on clustered process or server environments.