LogoLogo
  • Welcome to Release
  • Getting started
    • Quickstart
    • Create an account
    • Prepare to use Release
    • Create an application
      • Create custom application
      • Create from template
      • Servers vs runnables
    • Create an environment
  • Guides and examples
    • Domains and DNS
      • Manage domains
      • DNS and nameservers
        • Configure GoDaddy
        • Configure Cloudflare
        • Configure Namecheap
        • Other DNS hosts
      • Routing traffic
    • Example applications
      • Full stack voting app
      • Flask and RDS counter app
      • Static site with Gatsby
      • Golang with Postgres and Nginx
      • WordPress with MySQL
      • Spring and PostgreSQL
      • Terraform and Flask
      • OpenTelemetry demo
      • Load balancer with hostname
      • Static JavaScript service
      • SSH bastion access to services
      • ngrok and OAuth for private tunnels
      • Using OAuth Proxy
      • Hybrid Docker and static site
      • App Imports: Connecting two applications
      • Example library
    • Running instances
      • Cron jobs
      • Jobs
      • Using Helm charts
      • Using terminal
      • Viewing logs
      • Troubleshooting
        • ImagePullBackoff error
        • CrashLoopBackoff error
        • Exit codes
        • OOM: out of memory
    • Advanced guides
      • Containers guide
      • Application guide
      • Kubernetes guide
      • Create a cluster
      • Upgrade a cluster
      • Managing node groups
      • Patch node groups
      • Hostnames and rules
      • Serve traffic on multiple ports
      • Configure access to your K8s cluster
      • Designing for multiple environments
      • Microservices architecture
      • Monitoring your clusters
      • Performance tuning
      • Visibility and monitoring
      • Working with data
        • Container-based data
        • Seeding and migration
        • Cloud-provided data
        • Golden images
        • Third party
      • Pausing Instant Datasets
        • Application pausing schedules
        • Pause/resume environments
      • Infrastructure as code
        • Terraform
  • Reference documentation
    • Account settings
      • Account info
      • Managing users
      • Build settings
        • Build arguments
        • Build SSH keys
      • Add integrations
      • View clusters and cloud integrations
      • Add datasets
      • Environment handles
    • Workflows in Release
      • Stages of workflows
      • Serial deployments
      • Parallel deployments
      • Rolling deployments
      • Rainbow deployments
    • Networking
      • Network architecture (AWS)
      • Network architecture (GCP)
      • Ingresses
      • IP addresses
      • Cloud-provided services
      • Third-party services
    • Release environment versioning
    • Application settings
      • Application Template
        • Schema definition
      • Default environment variables
      • GitHub
      • Pull requests
      • GitOps
      • Just-in-time file mounts
      • Primary App Link
      • Create application FAQ
      • App-level build arguments
      • Parameters
      • Workspaces
    • End-to-end testing
    • Environment settings
      • Environment configuration
      • Environment variables
        • Environment variable mappings
        • Secrets vaults
        • Using Secrets with GitOps
        • Kubernetes Secrets as environment variables
        • Managing legacy Release Secrets
    • Environment expiration
    • Environment presets
    • Instant datasets on AWS
    • Instant datasets on GCP
    • Instant dataset tasks
      • Tonic Cloud
      • Tonic On-Premise
    • Cloud resources
    • Static service deployment
    • Helm
      • Getting started
      • Version-controlled Helm charts
      • Open-source charts
      • Building Docker images
      • Ingress and networking
      • Configuration
    • GitOps
    • The .release.yaml file
    • Docker Compose conversion support
    • Reference examples
      • Adding and removing services
      • Managing service resources
      • Adding database containers to the Application Template
      • Stock Off-The-Shelf Examples
    • Release API
      • Account Authentication
      • Environments API
        • Create
        • Get
        • Setup
        • Patch
      • User Authentication
      • Environment Presets API
        • Get Environment Preset List
        • Get Environment Preset
        • Put Environment Preset
  • Background concepts
    • How Release works
  • Frequently asked questions
    • Release FAQ
    • AWS FAQ
    • Docker FAQ
    • JavaScript FAQ
  • Integrations
    • Integrations overview
      • Artifactory integration
      • Cloud integrations (AWS)
        • AWS guides
        • Grant access to AWS resources
        • AWS how to increase EIP quota
        • Control your EKS fleet with systems manager
        • Managing STS access
        • AWS Permissions Boundaries
        • Private ECR Repositories
        • Using an Existing AWS VPC
        • Using an Existing EKS Cluster
      • Docker Hub integration
      • LaunchDarkly integration
      • Private registries
      • Slack integration
      • Cloud integrations (GCP)
        • GCP Permissions Boundary
      • Datadog Agent
      • Doppler Secrets Manager
      • AWS Secrets Management
    • Source control integrations
      • GitHub
        • Pull request comments
        • Pull request labels
        • GitHub deployments
        • GitHub statuses
        • Remove GitHub integration
      • Bitbucket
      • GitLab
    • Monitoring and logging add-ons
      • Datadog
      • New Relic
      • ELK (Elasticsearch, Logstash, and Kibana)
  • Release Delivery
    • Create new customer integration
    • Delivery guide
    • Release to customer account access controls
    • Delivery FAQs
  • Release Instant Datasets
    • Introduction
    • Quickstart
    • Security
      • AWS Instant Dataset security
    • FAQ
    • API
  • CLI
    • Getting started
    • Installation
    • Configuration
    • CLI usage example
    • Remote development environments
    • Command reference
      • release accounts
        • release accounts list
        • release accounts select
      • release ai
        • release ai chat
        • release ai config-delete
        • release ai config-init
        • release ai config-select
        • release ai config-upsert
      • release apps
        • release apps list
        • release apps select
      • release auth
        • release auth login
        • release auth logout
      • release builds
        • release builds create
      • release clusters
        • release clusters exec
        • release clusters kubeconfig
        • release clusters shell
      • release datasets
        • release datasets list
        • release datasets refresh
      • release deploys
        • release deploys create
        • release deploys list
      • release development
        • release development logs
        • release development start
      • release environments
        • release environments config-get
        • release environments config-set
        • release environments create
        • release environments delete
        • release environments get
        • release environments list
        • release environments vars-get
      • release gitops
        • release gitops init
        • release gitops validate
      • release instances
        • release instances exec
        • release instances logs
        • release instances terminal
  • Release.ai
    • Release.ai Introduction
    • Getting Started
    • Release.ai Templates
    • Template Configuration Basics
    • Using GPU Resources
    • Custom Workflows
    • Fine Tuning LlamaX
    • Serving Inference
Powered by GitBook
On this page
  • Set up the integration
  • Using the LaunchDarkly integration
  • Pre-deployment step
  • Pre-delete step
  • Examples
  • Rails: Setting up LaunchDarkly SDK client

Was this helpful?

  1. Integrations
  2. Integrations overview

LaunchDarkly integration

The functionality of Release's LaunchDarkly integration and how to set it up

PreviousDocker Hub integrationNextPrivate registries

Last updated 2 years ago

Was this helpful?

Release's LaunchDarkly integration allows you to have a pristine, isolated LaunchDarkly environment to use for testing.

Sharing feature flags between multiple environments can cause testing and reliability issues. Release solves this problem by creating a new LaunchDarkly environment each time you deploy a new Release environment and storing the SDK key, mobile key, and client key as environment variables your application can access.

Release handles creating and deleting LaunchDarkly environments with little configuration needed.

Set up the integration

Navigate to the Integrations tab for your account.

Each field in the set-up form is required. Except for the Access Token field, you can use the defaults provided.

  • Project Key: This is the key for the project you want your environments created under. The default value is default, as LaunchDarkly always has a project with the key default.

  • Access Token: This is the token for the account you would like to create environments under in LaunchDarkly. You can create or find the access token under Account Settings -> Authorization. All access tokens start with api-.

  • Environment Variables: The remaining fields define the names of the environment variables Release will use to store the various API keys from LaunchDarkly. You can change these names to anything you like. Keys are stored as encrypted K8s secrets.

You will need the LaunchDarkly access token to set up your SDK client so that you can choose variations of flags in your application.

Once you have saved these configurations, Release will attempt to use your access token to connect to your LaunchDarkly account. If that works, the integration is ready to go! If not, you'll see errors and can correct any mistakes you have made.

Using the LaunchDarkly integration

The integration consists of two parts, both of which are automated and handled by Release.

  • Pre-deployment step: The LaunchDarkly integration will add a task to each of your deployments to create the feature flag environment.

  • Pre-delete step: When you delete an environment, a step will be injected that cleans up by deleting the environment in LaunchDarkly.

Pre-deployment step

The pre-deployment step will create an environment in LaunchDarkly the first time you deploy a space or new configuration.

The environment variables you specified during set up will be populated and exposed to your containers via K8s secrets.

You can then use these environment variables in your code to access your feature flags as you normally would.

Pre-delete step

The pre-delete step is invoked when a Release environment is removed, whether manually through the UI or when a pull request is merged or closed. The LaunchDarkly integration will remove the corresponding LaunchDarkly environment automatically when the Release environment is removed.

Examples

Below are some examples of how to consume the environment variables to use the LaunchDarkly integration.

Rails: Setting up LaunchDarkly SDK client

  • Create a file in config/initializers/launchdarkly_client.rb.

  • Copy the code below into config/initializers/launchdarkly_client.rb.

=begin

  #Uncomment this section if you would like to use the LaunchDarklyApi gem (https://github.com/launchdarkly/api-client-ruby).
  #This is NOT the gem for using the Ruby LaunchDarkly SDK (https://github.com/launchdarkly/ruby-server-sdk).
  #Most people do not need to use the LaunchDarkly Rest API defined here: https://apidocs.launchdarkly.com/reference, but
  #instead just want to use the SDK to interact with the feature flags in their specific environment.
  #If you would like to use the LaunchDarkly Rest API, make sure to install the gem besides uncommenting these lines.

access_token = ENV['LAUNCHDARKLY_ACCESS_TOKEN']

LaunchDarklyApi.configure do |config|
  config.api_key['Authorization'] = access_token
  config.debugging = true
end

=end

##To use the LaunchDarkly Ruby SDK, you will need the specific SDK key.
##In this example, I'm setting up `LDClient` under the `Rails.configuration` so it's accessible anywhere
##in your Rails project.
Rails.configuration.ld_client =
  LaunchDarkly::LDClient.new(ENV['LAUNCHDARKLY_ENV_SPECIFIC_SDK_KEY'])

Example of using the LDClient you defined above in your Rails application

test_flag = Rails.configuration.ld_client.variation("test-flag", {key: "user@test.com"}, false)

In this example, we will configure the LaunchDarkly SDK client with the specific API key for your environment. This example is based on the .

When running locally, you can use the dotenv gem () to set your LaunchDarkly environment variables to test values.

Install the .

Ruby SDK reference
https://github.com/bkeepers/dotenv
Ruby SDK gem