Was this article helpful?
Thanks for your feedback
Warning: contentstack-express framework has been deprecated. We will soon stop supporting this framework. Instead, we recommend using DataSync, which is faster and more flexible than the web framework.
To enable horizontal scaling of content, you can add multiple servers for any environment and set up an internal process to connect each server.
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.
Finally, after adding the servers in an environment, you need to run your app on the 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:
set NODE_ENV=production&& set SERVER=Server 1&& npm run start
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:
NODE_ENV=production SERVER=Server 1 npm run start
NODE_ENV=production SERVER=Server 2 npm run start
Once you perform the above steps, publish the entries in the environment. The published content will reflect in all the servers.
Was this article helpful?
Thanks for your feedback