1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/website/docs/user_guide/environments.md
Ivar Conradi Østhus d5bc0c6f76
docs: minor typo
2021-10-26 11:32:19 +02:00

7.5 KiB

id title
environments Environments
Environment is a new feature currently under beta. It can be enabled from Unleash v4.2.x with a feature toggle. We plan to make the environment feature general available from Unleash v4.3.x.

Environments is a new way to organize activation strategy configurations for feature toggles into separate environments. In Unleash a feature lives across all your environments, after all, the goal is to get the new feature released as soon as possible. But it makes sense to configure the activation differently per environment. You might want the feature enabled for everyone in development, while only enable it for yourself in production.

Unleash Enterprise users have been able to leverage strategy constraints to control the roll-out per environment. This will not be needed after the release as a "full group" of activation strategy will belong to an environment.

Connected applications will also use environment scoped API keys, to make sure they only download feature toggle configurations for the environment they are running in.

Metrics has also been upgraded to record the environment, so that Unleash now can display the usage metrics per environment.

Environments Overview

How to start using environments

In order to start using environments you need to be on Unleash v4.2. You also need to have the environment feature enabled (if you are using Unleash Hosted, please reach out on contact@getunleash.io if you want to start using environments.

Step 1: Enable new environments for your Project

Navigate to the project and choose the “environments” tab.

Configure environment for this project

Step 2: Configure activation strategies for the new environment

From the “feature toggle view” you will now be able to configure activation strategies per environment.

Add strategy configuration per environment

Step 3: Create environment specific API keys

In order for the SDK to download the feature toggle configuration for the correct environment you will need to create an API token for a defined environment.

Create Environment specific API Keys

Migration

To ease migration we have created a special environment called “default”. All existing activation strategies have been added to this environment. All existing Client API keys has also been scoped to work against the default environment, to ensure zero disruption as part of the upgrade.

If you today are using strategy constraints together with the “environment” field on the Unleash Context you should be aware that the new environment support works slightly differently. Now the SDK will only download the activation strategies configured for a configured environment. The Unleash SDK API will know which environment to deliver to the SDK because the API token used by the SDK is scoped to a single environment. Because of this you will probably stop using “environment” on the Unleash Context.

You will not use strategy constraints for environments any more.

Addons

We have slightly changed the events related to working with feature toggles. This means that you would need to change your addon configuration to also subscribe for the new events to not miss updates:

Deprecated events:

  • FEATURE_UPDATE - not used after switching to environments

New Events

  • FEATURE-METADATA-UPDATED - The feature toggle metadata was updated (across all environments).
  • FEATURE-STRATEGY-ADD¹ - An activation strategy was added to a feature toggle in an environment. The data will contain the updated strategy configuration.
  • FEATURE-STRATEGY-UPDATE¹ - An activation strategy was updated for a feature toggle. The data will contain the updated strategy configuration.
  • FEATURE-STRATEGY-REMOVE¹ - An activation strategy was removed for a feature toggle.
  • FEATURE-ENVIRONMENT-ENABLED¹ - Signals that a feature toggle has been enabled in a defined environment.
  • FEATURE-ENVIRONMENT-DISABLED¹ - Signals that a feature toggle has been disabled in a defined environment.
  • FEATURE-PROJECT-CHANGE¹ - The feature toggle was moved to a new project.
  1. These feature events will contain project and environment as part of the even metadata.

API

In order to support configuration per environment we had to rebuild our feature toggle admin API to account for environments as well. This means

  • /api/admin/features - deprecated (scheduled for removal in Unleash v5.0). The old feature toggles admin API still works, but strategy configuration will be assumed to target the “default” environment.
  • /api/admin/projects/:projectId/features - New feature API to be used for feature toggles which also adds support for environments. See the documentation to learn more.

Plan Differences

Open-Source (free)

  • Will get access to two pre-configured environments: “development” and “production”. Existing users of Unleash will also get an additional “default” environment to simplify adoption of environments.
  • Will be possible to turn environments on/off for all projects.

Pro (commercial)

  • Will get access to two pre-configured environments: “development” and “production”. Existing users of Unleash will also get an additional “default” environment to simplify the adoption of environments.
  • Will be possible to turn environments on/off for the default project.

Enterprise (commercial)

  • Will get access to two pre-configured environments: “development” and “production”. Existing users of Unleash will also get an additional “default” environment to simplify the adoption of environments.
  • Will be possible to turn environments on/off for all projects
  • Will be allowed to update and remove environments.
  • Will be allowed to create new environments.

Rollout Plan

  • Unleash v4.2 will provide early access to environment support. This means that it can be enabled per customer via a feature flag.
  • Unleash v4.3 plans to provide general access to the environment support for all users of Unleash (Open-Source, Pro, Enterprise).

Future enhancements

With improved environment capabilities we have also done the groundwork to be able to also improve other related aspects inside Unleash:

  • Improve **Usage Metrics **to be able to show usage and evaluation results per hour for multiple days with dimensions such as environment, application and time (per hour).
  • Improve RBAC with the ability to limit who can change configuration for a specific environment (planned as an enterprise feature).