A properly configured AWS CLI is required. If you don't have one locally you can set the needed environment variables as to configure the CLI.
A working Docker installation is required. Docker is not a runtime requirement of the feature flipper and is only used to create a consistent deployment environment.
A working Docker installation looks like this
(note the use of version
, not --version
):
[you:~]$ docker version
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 22:37:33 2016
OS/Arch: darwin/amd64
Server:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 22:37:33 2016
OS/Arch: linux/amd64
The deployment scripts are idempotent. If you run into any issue while running
make
just run it again. Some of what the deployment script do includes:
- Creating a S3 bucket with static site hosting
- Creating a Route53 alias to the bucket
- Building and uploading the Single Page App (SPA) to S3
- Creating DynamoDB tables for feature data
- Creating Autoscaling policies for DynamoDB tables
- Creating Lambda functions and uploading their code
- Creating an IAM role enabling Lambda functions to access DynamoDB tables
- Tearing down old API Gateway routes
- Creating new API routes. For each route
- Configuring the method request
- Configuring the integration request
- Configuring the integration response
- Configuring the method response
- Adding permissions in the lambda function so API Gateway can call it
- Creating a API Gateway deployment
export AWS_ACCESS_KEY_ID=<access key>
export AWS_SECRET_ACCESS_KEY=<secret>
export AWS_DEFAULT_REGION=<your region>
# The Route53 domain. Make sure to remove the trailing .
export R53_DOMAIN=yourdomain.com
# The bucket from which to serve the SPA.
export S3_BUCKET="feature-flipper.$R53_DOMAIN"
# for CORS
export ACCESS_CONTROL_ALLOW_ORIGIN="http://$S3_BUCKET"
To deploy or update the feature flipper simply run this from the repo root:
# Optionally set this if you want the public consumers of feature data to
# authenticate with an api key. If you set this you must also associate the API
# key with the FeatureFlipper-public deployment stage
# export REQUIRE_API_KEY=1
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION, R53_DOMAIN,
# S3_BUCKET, and ACCESS_CONTROL_ALLOW_ORIGIN should still be set
make
To login to the SPA go to http://feature-flipper.yourdomain.com
The frontend needs to know which API Gateway endpoint to talk to, and it needs and API key to authenticate. The API key was created above and printed out as the last output. Here's how to find the endpoint:
The endpoint is found in the API Gateway console
- Go to the API Gateway console
- Click "FeatureFlipper-private"
- Click the "Resources" dropdown
- Click "Stages"
- Click "prod"
- Copy the "Invoke URL" and paste it into the login prompt at http://feature-flipper.yourdomain.com
The FeatureFlipper-public invoke URL is what the node-local cache is configured with.