Installation
There are various components to the Flagship platform that must be configured and installed appropriately. They will be described below.
MySQL
All Flagship data is stored in MySQL. This is currently the only primary database that can be used.
To use your own MySQL database, you must perform the following bootstrap steps:
- Create a
flagship
database. See here. - Execute the statements listed here.
- This will create all necessary tables.
- Create an initial Flagship owner user. See here.
- This will create a user with username
owner@flag.ship
and passwordTest123!
. - You can modify the email as needed.
- It is recommended to reset your password from the UI.
- This will create a user with username
The latest MySQL version is recommended.
Redis Cluster
Some Flagship data is cached in Redis Cluster. This is primarily to make the Flags API faster. The following data is stored here:
- Encrypted project private keys
- Feature flags
- Context field keys and value types
The latest Redis Cluster version is recommended.
Admin API
The Admin API is described in detail here.
You can use the following Docker image from Dockerhub:
alexschimpf/flagship-admin:latest
This is the easiest way to get the Admin API up and running.
The full list of config options is defined here. The docker container can be configured by a number of environment variables. If certain environment variables are not specifically defined, a warning message will be logged on startup.
Variable Name | Notes | Default |
---|---|---|
SECRET_KEY | Used to encrypt JWT tokens and project private keys. This should be a long random string with a length that is a multiple of 4. | -- |
MYSQL_ECHO | If truthy, all MySQL statements will be logged. This should definitely be disabled in production. | 1 |
MYSQL_ISOLATION_LEVEL | MySQL transaction isolation level | READ COMMITTED |
MYSQL_POOL_SIZE | See here | 5 |
MYSQL_MAX_OVERFLOW | See here | 10 |
MYSQL_CONN_STR | Should follow the following format: mysql+mysqlconnector://USER:PASSWORD@HOSTNAME:PORT/flagship | -- |
REDIS_CONN_STR | Should follow the following format: redis://HOSTNAME:PORT | -- |
UI_BASE_URL | The UI base URL. This should NOT end with a trailing slash. | http://localhost:3000 |
SESSION_COOKIE_KEY | The login session cookie key name | flagship-session |
SESSION_COOKIE_MAX_AGE | Login session cookie max age (in seconds) | 86400 (i.e. 24 hours) |
SESSION_COOKIE_DOMAIN | The domain name tied to your login session cookie | localhost |
CORS_ALLOW_ORIGINS | A comma-separated list of allowed origins for CORS. Your Flagship UI base URL should be listed here. | http://localhost:3000 |
SET_PASSWORD_TOKEN_TTL | How long a password reset token lives before becoming invalid | 86400 (i.e. 24 hours) |
ENABLE_FAKE_AUTH | This is used to skip authentication checks during testing. This should definitely be disabled in production. | False |
DEFAULT_LOCALE | Currently this doesn't have any effect because "en-us" is the only supported locale. | en-us |
SMTP_HOST | SMTP server hostname. Used for sending emails from Flagship. | -- |
SMTP_PORT | SMTP server port. Used for sending emails from Flagship. | -- |
SMTP_USER | SMTP server user. Used for sending emails from Flagship. | -- |
SMTP_PASSWORD | SMTP server password. Used for sending emails from Flagship. | -- |
EMAIL_FROM_ADDRESS | This is the "From" email address used for emails from Flagship. This address should be owned by you. | -- |
Flags API
The Flags API is described in detail here.
You can use the following Docker image from Dockerhub:
alexschimpf/flagship-flags:latest
This is the easiest way to get the Flags API up and running.
The full list of config options is defined here. The docker container can be configured by a number of environment variables. If certain environment variables are not specifically defined, a warning message will be logged on startup.
Variable Name | Notes | Default |
---|---|---|
SECRET_KEY | Used to encrypt JWT tokens and project private keys. This should be a long random string with a length that is a multiple of 4. | -- |
REDIS_CONN_STR | Should follow the following format: redis://HOSTNAME:PORT | -- |
CORS_ALLOW_ORIGINS | A comma-separated list of allowed origins for CORS. If you are interacting with the Flags API from a browser, this should be set to your website's base URL. | http://localhost:3000 |
DEFAULT_LOCALE | Currently this doesn't have any effect because "en-us" is the only supported locale. | en-us |
UI
The UI is described in detail here.
You can use the following Docker image from Dockerhub:
alexschimpf/flagship-frontend:latest
The docker container can be configured using the following environment variables:
Variable Name | Notes | Default |
---|---|---|
API_BASE_URL | Base URL of the Admin API | http://localhost:8000 |
SDK
To connect your system to Flagship's Flags API, you can use an available SDK. There are currently 2 supported SDKs - one for Javascript and one for Python. It should be trivial to support other programming languages or use your own implementation.
Example Project
See an example project here.