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:
- Separating your environments in different indices on the same application
- 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:
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.
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 STARTER 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, having multiple applications will generate an invoice per Application. E.g. If you have 2 applications with 2 STARTER plans, you’ll need to pay twice the monthly amount for this plan.