You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/readme-sync/deploy-as-a-microservice/012 - quickstart-with-docker.md
+10-4Lines changed: 10 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Quickstart with Docker"
3
3
excerpt: ""
4
4
slug: "quickstart-with-docker"
5
-
hidden: true
5
+
hidden: false
6
6
metadata:
7
7
title: "Agent Quickstart with Docker - Optimizely Full Stack"
8
8
createdAt: "2020-05-21T20:35:58.387Z"
@@ -13,27 +13,31 @@ This is a brief quickstart showing how to run Agent locally via Docker and how t
13
13
If Docker is not installed then you can download it [here](https://docs.docker.com/install/).
14
14
15
15
## Running locally via Docker
16
+
16
17
First pull the Docker image with:
18
+
17
19
```bash
18
20
docker pull optimizely/agent
19
21
```
20
22
21
23
Then start the service in the foreground with the following command:
24
+
22
25
```bash
23
26
docker run -p 8080:8080 --env OPTIMIZELY_LOG_PRETTY=true optimizely/agent
24
27
```
25
28
Note that we're enabling "pretty" logs which provide colorized and human readable formatting.
26
29
The default log output format is structured JSON.
27
30
28
31
## Evaluating REST APIs
29
-
The rest of the getting started guide will demonstrate the APIs capabilities. For brevity, we've chosen to illustrate the API usage with Python. Note that the APIs are also defined via OpenAPI (Swagger) and can be found [here](http://localhost:8080/openapi.yaml).
32
+
33
+
The rest of the getting started guide will demonstrate the APIs capabilities. For brevity, we've chosen to illustrate the API usage with Python. Note that the APIs are also defined via OpenAPI (Swagger) and can be found on localhost [here](http://localhost:8080/openapi.yaml).
30
34
31
35
### Start an http session
32
-
Each request made into Optimizely Agent is in the context of an Optimizely SDK Key. SDK Keys map API requests to a specific Optimizely Project and Environment. We can setup a global request header by using the `requests.Session` object.
36
+
37
+
Each request made into Optimizely Agent is in the context of an Optimizely SDK Key. SDK Keys map API requests to a specific Optimizely Project and Environment. We can set up a global request header by using the `requests.Session` object.
@@ -43,6 +47,7 @@ To get your SDK key, navigate to the project settings of your Optimizely account
43
47
Future examples will assume this session is being maintained.
44
48
45
49
### Get current environment configuration
50
+
46
51
The `/config` endpoint returns a manifest of the current working environment.
47
52
48
53
```python
@@ -54,6 +59,7 @@ for key in env['featuresMap']:
54
59
```
55
60
56
61
### Activate Feature
62
+
57
63
The `/activate?featureKey={key}` endpoint activates the feature for a given user. In Optimizely, activation is in the context of a given user to make the relative bucketing decision. In this case we'll provide a `userId` via the request body. The `userId` will be used to determine how the feature will be evaluated. Features can either be part of a Feature Test in which variations of feature variables are being measured against one another or a feature rollout, which progressively make the feature available to the selected audience.
58
64
59
65
From an API standpoint the presence of a Feature Test or Rollout is abstracted away from the response and only the resulting variation or enabled feature is returned.
Agent provides an endpoint that sends notifications to subscribers via [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). This is Agent's equivalent of Notification Listeners found in Optimizely SDKs.
14
13
15
14
For details on the notification types, what causes them to be triggered, and the data they provide, see the [Notification Listeners documentation](https://docs.developers.optimizely.com/full-stack/docs/set-up-notification-listener-go).
@@ -22,27 +21,34 @@ By default, the notifications endpoint is disabled. To enable it, change config.
22
21
api:
23
22
enableNotifications: true
24
23
```
24
+
25
25
Or, enable it by setting an environment variable:
26
+
26
27
```shell script
27
28
export OPTIMIZELY_API_ENABLENOTIFICATIONS=1
28
29
```
29
30
30
31
## Usage
32
+
31
33
Send a `GET` request to `/v1/notifications/event-stream` to subscribe:
This connection will remain open, and any notifications triggered by other requests received by Agent are pushed as events to this stream. Try sending requests to `/v1/activate` or `/v1/track` to see notifications being triggered.
37
41
38
42
39
43
### Filtering
44
+
40
45
To subscribe only to a particular category of notifications, add a `filter` query parameter. For example, to subscribe only to Decision notifications:
Copy file name to clipboardExpand all lines: docs/readme-sync/deploy-as-a-microservice/040 - configure-optimizely-agent/040 - advanced-configuration.md
Configuration can be provided to Agent via the following methods:
15
+
15
16
1. Reading from environment variables
16
17
2. Reading from a YAML configuration file
17
18
@@ -22,25 +23,34 @@ Internally, Optimizely Agent uses the [Viper](https://github.com/spf13/viper) li
22
23
## Config File Location
23
24
24
25
The default location of the config file is `config.yaml` in the root directory. If you want to specify another location, use the `OPTIMIZELY_CONFIG_FILENAME` environment variable:
26
+
25
27
```bash
26
28
OPTIMIZELY_CONFIG_FILENAME=/path/to/other_config_file.yaml make run
27
29
```
28
30
29
31
## Nested Configuration Options
30
-
When setting the value of "nested" configuration options using environment variables, underscores denote deeper access. The following examples are equivalent ways of setting the client polling interval:
32
+
33
+
When setting the value of "nested" configuration options using environment variables, underscores denote deeper access. The following examples are equivalent ways of setting the client polling interval.
34
+
35
+
Set the polling interval in YAML:
36
+
31
37
```yaml
32
38
# Setting a nested value in a .yaml file:
33
39
client:
34
40
pollingInterval: 120s
35
41
```
36
42
43
+
Set the polling interval with a shell script:
44
+
37
45
```shell script
38
46
// Set environment variable for pollingInterval, nested inside client
39
47
export OPTIMIZELY_CLIENT_POLLINGINTERVAL=120s
40
48
```
41
49
42
50
## Unsupported Environment Variable Options
51
+
43
52
Some options can only be set via config file, and not environment variable (for details on these options, see the Configuration Options table in the [main README](https://github.com/optimizely/agent/blob/master/README.md):
0 commit comments