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:
- Install Golang version 1.20+.
- Clone the Optimizely Agent repository locally.
- From the repository directory, open a terminal and start Optimizely Agent.
make setup
Then run the following:
make run
This starts the Optimizely Agent with the default configuration in the foreground.
Run Agent from source (Windows)
You can use a helper script to install the prerequisites (Golang and Git) and compile Agent in a Windows environment.
-
Clone the Optimizely 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 have Docker 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/agent
docker 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.yaml
file. See configure Optimizely Agent for more options.
Docker versions
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
.
Run 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 Optimizely's Helm Chart.
-
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 similar to the following:
"optimizely-agent" has been added to your repositories
-
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 to the following:
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:
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:
- (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 thehelm install
command. See modifying values in the GitHub Readme for more options.
Updated 11 days ago