Git Product home page Git Product logo

feature-flag-scheduler's Introduction

Feature Flag Scheduler CLI for Optimizely

Schedule feature flag toggling using AWS Lambda & CloudWatch.

Overview: Run CLI command to create a CloudWatch cron-scheduled Event with a payload containing feature ID, toggle state (on/off), and environment name. When the scheduled Event is triggered, it will invoke a Lambda function and pass along the payload which will be used to toggle feature state via the Optimizely REST API.

Solution Diagram


Functions

Schedule for Feature Flag to be enabled on March 1, 2019 @ 5:45pm UTC

$ python run.py schedule -feature 8930855000 -toggle on -date "3-1-2019 17:45:00" -env production

Schedule for Feature Flag to be disabled on March 20, 2019 @ 5:45pm UTC

$ python run.py schedule -feature 8930855000 -toggle off -date "3-20-2019 17:45:00" -env production

List all scheduled feature toggle jobs

$ python run.py list

will print out scheduled jobs and their 'job name'

Scheduled Jobs:
================
Feature ID	Toggle State	Date				Env		Job Name
8930855000	DISABLE		03-20-2019 17:45:00(UTC)	production	OPTLY_FLAG_8930855000_off_production
8930855000	ENABLE		03-1-2019  17:45:00(UTC)	production	OPTLY_FLAG_8930855000_on_production

Remove a scheduled job

$ python run.py delete -job OPTLY_FLAG_8930855000_on_production

Toggle a flag on-demand (not scheduled)

$ python run.py flag -toggle on -feature 8930855000 -env stage

Configuration

Environments: >= Python 3.6

Setting up the local CLI

  • The AWS connectivity is handled by named profiles
  • The named profile used by the CLI must be set as an environment variable OPTLY_LAMBDA_AWS_PROFILE
  • The Lambda function ARN must be set as an environment variable OPTLY_LAMBDA_FNC_ARN
  • The Lambda function ID must be set as an environment variable OPTLY_LAMBDA_FNC_ID

Setting up AWS Lambda function

The files contents of lambda_function/lambda_function.py can be placed directly within a Lambda function

  • The Optimizely "personal token" must be set as the v2_token environment variable in the Lambda function configuration screen within AWS

Setting up CloudWatch Events

Nothing needs to be done on the CloudWatch dashboard, but it helps troubleshoot by being able to refresh your list of scheduled jobs via the interface


Missing features:

  • Support for specifying rollout %
  • Support for relative timezones (requires UTC time currently)

feature-flag-scheduler's People

Contributors

cooperreid-optimizely avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Forkers

cpreid

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.