HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Install Optimizely Agent

How to install Optimizely Agent on Linux/macOS, Windows, Docker and Kubernetes.

Running Agent from source (Linux/macOS)

To develop and compile Optimizely Agent from source:

  1. Install Golang version 1.13+ .
  2. Clone the Optimizely Agent repo locally.
  3. From the repo directory, open a terminal and start Optimizely Agent:
make setup

Then,

make run

This starts the Optimizely Agent with the default configuration in the foreground.

Running Agent from source (Windows)

You can use a helper script to install prerequisites (Golang and Git) and compile Agent in a Windows environment:

  1. Clone the Optimizely Agent repo locally.
  2. From the repo directory, open a Powershell terminal and run:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

.\scripts\build.ps1

.\bin\optimizely.exe

Running Agent locally via Docker

If you have Docker installed, you can start Optimizely Agent as a container:

  1. Pull the Docker image:
docker pull optimizely/agent

By default, this will pull the "latest" tag. You can also specify a specific version of Agent by providing the version as a tag to the docker command:

docker pull optimizely/agent:X.Y.Z
  1. Run the docker container with:
docker run -p 8080:8080 
--env OPTIMIZELY_LOG_PRETTY=true 
--env OPTIMIZELY_SERVER_HOST=0.0.0.0 
--env OPTIMIZELY_SERVER_ALLOWEDHOSTS=127.0.0.1 optimizely/agent

This will start Agent in the foreground and expose the container API port 8080 to the host.

  1. (Optional) You can alter the configuration by passing in environment variables to the preceding command without having to create a config.yaml file. See configure optimizely agent for more options.

Docker versioning:

When a new version is released, two images are pushed to Docker Hub. Their tags distinguish them:

  • :latest (same as :X.Y.Z)
  • :alpine (same as :X.Y.Z-alpine)

The difference between latest and alpine is that latest is built FROM scratch while alpine is FROM alpine.

Running Agent in a Kubernetes cluster

If you run Kubernetes as part of your infrastructure and have Helm installed, you can easily host Optimizely Agent in your cluster using our Helm Chart:

  1. Add the optimizely-agent Helm Chart from Optimizely's repository:
helm repo add optimizely-agent https://optimizely.github.io/optimizely-agent-helm

The output should be:

"optimizely-agent" has been added to your repositories
  1. Then, install the Optimizely Agent chart, giving your deployment a name like my-agent:
helm install my-agent optimizely-agent/agent

The output should be similar:

NAME: my-agent
LAST DEPLOYED: Tue Jul 12 18:24:27 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
*** Configuration Summary ***

Name Override: 
  [no name override; using generated name]
Full Name Override: 
  [no full name override; using generated full name]

Image Used: 
  optimizely/agent:latest

Service Account:
  [account name will be generated]

Replica Count: 1

Auto-Scaling:
  [auto-scaling is disabled]

Node Selector:
  [no node selectors applied]

Node Affinity:
  [no node affinity applied]

Node Tolerations:
  [no node tolerations applied]

Pod Annotations Applied:
  [no annotations applied]

Pod Security Context:
  [no pod security context applied]

Container Security Context:
  [no container security context applied]

Network Service: 
  Type: ClusterIP
  Ports:
    api: 8080 [internal] <== 8080 [external]
    webhook: 8085 [internal] <== 8085 [external]
    admin: 8088 [internal] <== 8088 [external]

Network Ingress:
    Run the following in a *nix terminal to access the running ClusterIP service IP address
      export CLUSTER_IP=$(kubectl get svc --namespace default my-agent -o jsonpath='{.spec.clusterIP}')
      echo http://$CLUSTER_IP:8080

Resources:
  [no resources declarations applied]

Logging:
  Level set to DEBUG with friendly formatting ON.
  SDK Key WILL be included in logs.

Environment Variables:
  [no environment variables applied]

Secrets:
  1. (Optional) You can change the default values in the chart by modifying the --values using a custom YAML file or individually when you --set flags directly in the helm install command. See modifying values in the GitHub Readme for more options.