Install
This guide provides detailed installation instructions for running the FE&R Decision API on various platforms and environments.
Prerequisites
Before installing, ensure you have:
FE&R Credentials: Environment ID and API Key from https://app2.abtasty.com
Platform-specific requirements (see each section below)
Run Decision API from Source (Linux and macOS)
Running from source allows you to build and customize the Decision API for your specific needs.
Prerequisites
Go 1.23.3 or higher
Git
Make (optional, for convenience)
Step 2: Clone the Repository
# Clone the Decision API repository
git clone https://github.com/flagship-io/decision-api.git
# Navigate to the project directory
cd decision-apiStep 3: Install Dependencies
Step 4: Build the Binary
Using Make (Recommended)
Manual Build
Step 5: Configure Environment Variables
Create a configuration file or set environment variables:
Or create a .env file:
Step 6: Run the Server
Run Decision API from Source (Windows)
Prerequisites
Go 1.23.3 or higher
Git for Windows
PowerShell or Command Prompt
Step 3: Clone the Repository
Step 4: Install Dependencies
Step 5: Build the Binary
Step 6: Configure Environment Variables
Option 1: Set in PowerShell Session
Option 2: Create a .env file
Create a file named .env in the project root:
Step 7: Run the Server
Run the Decision API using the provided Docker image
Docker provides the easiest way to run the Decision API with minimal setup.
Prerequisites
Docker 20.10 or higher
Docker Compose (optional, for multi-container setup)
Method 1: Run with Docker (Simple)
Method 2: Run with Docker Compose (Recommended)
Create a docker-compose.yml file:
Configuration parameters
You can use the following parameters to customize the Decision API. Each parameter is named as in the config.yaml file, and the matching environment variable is parenthesis.
env_id (ENV_ID)
string
yes
The Flagship environment ID. You can get it from the Flagship platform. Default to empty string
api_key (API_KEY)
string
yes
The Flagship API Key for this environment ID. You can get it from the Flagship platform. Default to empty string
address (ADDRESS)
string
no
The server address to listen for requests. Default to ":8080"
cors.enabled (CORS_ENABLED)
bool
no
If true, the server will return the cors response headers necessary for cross origins API calls. Default to true
cors.allowed_origins (CORS_ALLOWED_ORIGINS)
string
no
If the cors are enabled, this option will set the Access-Control-Allow-Origin response headers. Default to "*"
log.level (LOG_LEVEL)
string
no
Set the minimum log level that will be send to output. Can be trace, debug, info, warn, error, fatal, panic. Default to "warning"
log.format (LOG_FORMAT)
string
no
Set the output log format. Can be either "text" or "json". Default to "text"
polling_interval (POLLING_INTERVAL)
string
no
The polling frequency (as parsable by the ParseDuration method) to synchronize with your Flagship configuration. Default to 60s
cache.type (CACHE_TYPE)
string
no
If you want to enable caching for the visitor assignment. Can be "memory", "redis", "dynamo" or "local". Default to empty string.
cache.options.dbPath (CACHE_OPTIONS_DBPATH)
string
no
If you chose local cache type, this is the path of the file where the cache will be stored. Default to empty string
cache.options.redisHost (CACHE_OPTIONS_REDISHOST)
string
no
If you chose redis cache type, this is the host for your redis server
cache.options.redisUsername (CACHE_OPTIONS_REDISUSERNAME)
string
no
If you chose redis cache type, this is the username for your redis server
cache.options.redisUsername (CACHE_OPTIONS_REDISPASSWORD)
string
no
If you chose redis cache type, this is the password for your redis server
cache.options.redisDb (CACHE_OPTIONS_REDISDB)
int
no
If you chose redis cache type, this is the db number for your redis server. Default to 0 (default DB)
cache.options.redisTls (CACHE_OPTIONS_REDISTLS)
bool
no
If true, redis client will be set to connect using TLS to the redis server. Default to false
cache.options.dynamoTableName (CACHE_OPTIONS_DYNAMOTABLENAME)
string
no
The table name to store cache assignments when using DynamoDB. Default to "visitor-assignments"
cache.options.dynamoPKSeparator (CACHE_OPTIONS_DYNAMOPKSEPARATOR)
string
no
The primary key separator between env ID & visitor ID to store cache assignments when using DynamoDB. Default to "."
cache.options.dynamoPKField (CACHE_OPTIONS_DYNAMOPKFIELD)
string
no
The primary key field name to store cache assignments when using DynamoDB. Default to "id"
cache.options.dynamoGetTimeout (CACHE_OPTIONS_DYNAMOGETTIMEOUT)
string
no
The timeout for getting previously stored visitor cache assignment when using DynamoDB. Default to 1s
Start the services:
Last updated
Was this helpful?

