Environments in Kontent.ai let you create snapshots of your content. These can be snapshots of your production environment or other environments.In non-production environments, you can safely change the content model and the content itself without affecting what your customers see in production.
Create an environment
Creating an environment means that you essentially create a copy of a selected environment, such as Production. You can use the copy for development and testing purposes.You can create as many environments as your subscription plan allows. If you need to perform content model changes, we recommend using a code-first content migration.To create a new environment:
In Kontent.ai, click the first drop-down at the top to select a project.
For your current project, click .
In Project settings > Environments, click Create new environment.
You can also clone an environment by clicking > Clone.
What happens when you create an environment?
The new environment will contain all items, assets, types, snippets, taxonomies, collections, workflow, roles, and languages from the source environment. The content items will contain all their revisions, comments and suggestions, and tasks.The users from the source environment will be cloned and may be activated in the new environment. When creating an environment, you choose which users to activate by selecting their roles. Users with the Project manager role are always active because project managers have access to the whole project.Preview URLs will be copied to the new environment in the same state as they were in the source environment. Webhooks will be copied to the new environment and set as disabled so that the new environment doesn’t trigger your production apps.
Get your environment ID
You use the environment ID to tell Delivery API where to look for content. An environment ID looks like this: 8d20758c-d74c-4f59-ae04-ee928c0816b.
In Kontent.ai, select a project and its environment using the two drop-downs at the top left.
In Environment settings > General, click to copy the Environment ID to your clipboard.
Select an environment in the UI
You can switch among the current project’s environments using the second drop-down at the top.You can also select an environment from the project settings:
In Kontent.ai, click the first drop-down at the top to select a project.
For your current project, click .
In Project settings > Environments, choose > Go to environment.
Environment swap – mark environment as production
With environment swap, you can mark any non-production environment as your new production environment. When selecting environments, the new production environment will show at the top of the list.
Before you swap
Before you attempt to swap your environments, consider the following:
Make sure to select roles of users that should be active in the new environment.
What happens when you swap environments?
When you mark a non-production environment as production:
Environment names stay the same. Make sure to rename both the new production environment and the old now non-production environment to avoid confusion after the swap.
Content & assets, content model, and settings of the environments stay the same. This includes all items, assets, content types, snippets, taxonomies, collections, workflows, roles, languages, preview URLs, and webhooks.
You can choose to have webhooks enabled or disabled after the swap.
Environment ID and API keys stay the same for both environments. Your apps will continue to work without interruption. However, because the environment IDs and API keys are different for each environment, you need to update them in your app after the swap so the app uses the new production environment.
Users and their (in)active status are carried over from the original production environment. Those active in the original production are activated in the new production. Similarly, the inactive users remain inactive.
Users that exist ONLY in the original production environment will NOT appear in the new production environment after the swap.
If you want to disable your webhooks for the new production environment, unselect Enable webhooks after the swap is done. Otherwise, the webhooks will be enabled.
Should you clone your project or create environments?Although project cloning and environments work similarly, they serve different purposes.
Use environments to prepare changes in a safe space before going into production. Your developers then take care of propagating those changes to production.
Use project cloning to create new standalone projects for content creation. For example, if you want to run projects based on a similar content model but with slightly different content.
What about subscription plan limits?Your subscription plan limits for content items and assets count only for the environment with the largest number of content items and assets. Bandwidth and API calls count for all environments.
Please note that you can't use a custom asset domain together with the environment swap feature. That's because, after each swap, it'd be necessary to set up new HTTPS certificates.