Configuring multiple servers

To enable horizontal scaling of content, you can add multiple servers for any environment and set up an internal process to connect each server.

Add multiple servers within the environment

First, you need to add your servers in the environment. To do so, you can either add a new environment or update an existing one.

Now, on the configuration window, click on the Advanced option of the environment. Under the Deploy Content to Server(s) section, add the names of servers that you wish to add for this environment.

Add servers.png

Finally, after adding the servers in an environment, you need to run your app on the servers.

Start the app in individual servers

To start your app on all the servers, run the following command in all of them, along with the corresponding server details.

For Windows:

set NODE_ENV=<<YOUR_ENV_NAME>>&& set SERVER=<<YOUR_SERVER_NAME>>&& npm run start

To run ‘Server 1’ and ‘Server 2’ in Windows, run the following commands in the respective servers:

  • Server 1:
  • set NODE_ENV=production&& set SERVER=Server 1&& npm run start
  • Server 2:
  • set NODE_ENV=production&& set SERVER=Server 2&& npm run start

For Linux:

NODE_ENV=<<YOUR_ENV_NAME>> SERVER=<<YOUR_SERVER_NAME>> npm run start

To run ‘Server 1’ and ‘Server 2’ in Linux, run the following commands in the respective servers:

  • Server 1:
  • NODE_ENV=production SERVER=Server 1 npm run start
  • Server 2:
  • NODE_ENV=production SERVER=Server 2 npm run start

Publish content in the environment

Once you perform the above steps, publish the entries in the environment. The published content will reflect in all the servers.

More articles in "Advanced Topics"

On This Page

top-arrow