Install Optimizely Agent
How to install Optimizely Agent on Linux, macOS, Windows, Docker, and Kubernetes.
Run Agent from source (Linux and macOS)
To develop and compile Optimizely Agent from source complete the following:
- InstallGolang version 1.20+.
- Clone theOptimizely Agent repository locally.
- From the repository directory, open a terminal and start Optimizely Agent.
make setupThen run the following:
make runThis starts the Optimizely Agent with the default configuration in the foreground.
Run Agent from source (Windows)
You can use ahelper script to install the prerequisites (Golang and Git) and compile Agent in a Windows environment.
Clone theOptimizely Agent repo locally.
From the repo directory, open a Powershell terminal and run the following:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser.\scripts\build.ps1.\bin\optimizely.exe
Run Agent locally with Docker
If you haveDocker installed, you can start Optimizely Agent as a container.
- Pull the Docker image.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/agentdocker pull optimizely/agent:X.Y.Z - Run the docker container with the following:This will start Agent in the foreground and expose the container API port 8080 to the host.
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 - (Optional) You can alter the configuration by passing in environment variables to the preceding command without having to create a
config.yamlfile. Seeconfigure Optimizely Agent for more options.
Docker versions
When a new version is released, two images are pushed toDocker 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 builtFROM scratch while alpine isFROM alpine.
Run Agent in a Kubernetes cluster
If you runKubernetes as part of your infrastructure and haveHelm installed, you can easily host Optimizely Agent in your cluster using Optimizely'sHelm Chart.
Add the
optimizely-agentHelm Chart from Optimizely's repository.helm repo add optimizely-agent https://optimizely.github.io/optimizely-agent-helmThe output should be similar to the following:
"optimizely-agent" has been added to your repositoriesThen, install the Optimizely Agent chart, giving your deployment a name like
my-agent.helm install my-agent optimizely-agent/agentThe output should be similar to the following:
NAME: my-agentLAST DEPLOYED: Tue Jul 12 18:24:27 2022NAMESPACE: defaultSTATUS: deployedREVISION: 1NOTES:*** 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:latestService Account: [account name will be generated]Replica Count: 1Auto-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:8080Resources: [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:
NAME: my-agentLAST DEPLOYED: Tue Jul 12 18:24:27 2022NAMESPACE: defaultSTATUS: deployedREVISION: 1NOTES:*** 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:latestService Account: [account name will be generated]Replica Count: 1Auto-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:8080Resources: [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:- (Optional) You can change the default values in the chart by modifying the
--valuesusing a custom YAML file or individually when you--setflags directly in thehelm installcommand. Seemodifying values in the GitHub Readme for more options.
Updated 17 days ago