02 Jul 2018

Multiple Environments


When using Algolia, you may want to keep the best practice of separating your multiple development environments: development, staging, qa, production…

There are 2 main ways to do that with Algolia:

  1. Separating your environments in different indices on the same application
  2. Using one application per environment

The first solution is recommended for its simplicity and lower cost, but the second solution has the advantage of completely separating everything about these environments.

All Environments on the Same Application

With this option, you’ll create different indices for each environment. We recommend prefixing the name of each index by the name of its environment: dev_products, staging_products, prod_products

Being on the same application, these indices will share the same APP_ID. But you can create an Algolia user for each account with different API keys linked to them.

You can create a new team member that will have access to all indices from one environment only. You can create such a member by going in the Apps section and click Team on the selected application. Finally click the Add new button and add your prefix in the indices box followed by a * (star). For example staging_* for your staging environment.

Multiple environments 1

Creating a staging Algolia user

This member will have a specific admin and search-only API keys in the API-Keys tab that have only access to indices matching staging_* indices. You can use those keys in your code to ensure isolation between environments, even in case of a bug in your code.

You can repeat the same operation for all of your environments. The only elements shared between your environments are the number of records and operations since they belong to the same application.

One Application Per Environment

This approach provides a complete isolation between the different environments. From Algolia’s point of view it will be different accounts (for example two different ESSENTIAL plans) that you will manage from the same dashboard.

You can create a new application in the My Account section of the dashboard. Then, in the Applications tab, select Create a new application. You can then easily switch between your application via the top-left dropdown menu.

Unless you are on an ENTERPRISE plan and have a dedicated cluster of servers, and eventually a Sandbox application, having multiple applications will generate an invoice per Application. E.g. If you have 2 applications with 2 ESSENTIAL plans, you’ll need to pay twice the monthly amount for this plan.

© Algolia - Privacy Policy