Skip to content

Commit

Permalink
docs: change title, add content to how-to guide
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Apr 12, 2022
1 parent 8f3018d commit f160139
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions website/docs/how-to/how-to-run-the-unleash-proxy.mdx
@@ -1,33 +1,23 @@
---
title: Unleash Proxy
title: How to run the Unleash Proxy
---

## How to Run the Unleash Proxy
The [Unleash Proxy](../sdks/unleash-proxy.md) provides a way for you to consume feature toggles in front-end clients, such as the [JavaScript Proxy client](../sdks/proxy-javascript.md) and [React Proxy client](../sdks/proxy-react.md).

The Unleash Proxy is Open Source and [available on github](https://github.com/Unleash/unleash-proxy). You can either run it as a docker image or as part of a [node.js express application](https://github.com/Unleash/unleash-proxy#run-with-nodejs).
Depending on your setup, the Proxy is most easily run in one of two ways, depending on your situation:
- Run the proxy via Docker
- Run the proxy as a Node.js app

### Configuration variables
If you're using a hosted version of Unleash, we can also run the proxy for you if you'd rather not run it yourself.

Regardless of how you choose to run the it, the proxy will need access to these three variables:
## Prerequisites

- **`unleashUrl`** / **`UNLEASH_URL`**
This is what you need to do before you can run the proxy

The URL of your Unleash instance's API. For instance, to connect to the [Unleash demo app](https://app.unleash-hosted.com/demo/), you would use `https://app.unleash-hosted.com/demo/api/`
- an unleash server to connect to
- a client API token for the proxy to use

- **`unleashApiToken`** / **`UNLEASH_API_TOKEN`**

The API token to connect to your Unleash project. For more information on how these work and how to create them, check out the [API token documentation](../user_guide/token.md).

- **`clientKeys`** / **`UNLEASH_PROXY_CLIENT_KEYS`**

A list of client keys that the proxy will accept. For the proxy to accept an incoming request, the client must use one of these keys for authorization. In client SDKs, this is usually known as a `clientKey` or a `clientSecret`. If you query the proxy directly via HTTP, this is the `authorization` header.

When using an environment variable to set the proxy secrets, the value should be a comma-separated list of strings, such as `secret-one,secret-two`.

There are many more configuration options available. You'll find all [available options on github](https://github.com/Unleash/unleash-proxy#available-options).


### Running the proxy via Docker
## How to run the Proxy via Docker

The easiest way to run Unleash is via Docker. We have published a [docker image on docker hub](https://hub.docker.com/r/unleashorg/unleash-proxy).

Expand All @@ -53,7 +43,7 @@ The easiest way to run Unleash is via Docker. We have published a [docker image
Unleash-proxy is listening on port 3000!
```

### Running the proxy using Node.js
## How to run the Proxy as a Node.js app

To run the Proxy via Node.js, you'll have to create your own Node.js project and use the Unleash Proxy as a dependency. Assuming you've already set up your project, here's the steps to take to start the proxy as part of your app:

Expand All @@ -80,7 +70,7 @@ To run the Proxy via Node.js, you'll have to create your own Node.js project and
);
```

### Verify that the proxy is working
## Verify that the proxy is working

In order to verify the proxy you can use curl and see that you get a few evaluated feature toggles back. Assuming that the proxy is running on port 3000 and that your proxy client key is `some-secret`, you could run this command :

Expand All @@ -90,7 +80,7 @@ curl http://localhost:3000/proxy -H "Authorization: some-secret"

The output is of the form described in the [payload section](#payload).

### Health endpoint
## Health endpoint

The proxy will try to synchronize with the Unleash API at startup, until it has successfully done that the proxy will return `HTTP 503 - Not Read?` for all request. You can use the health endpoint to validate that the proxy is ready to recieve requests:

Expand Down

0 comments on commit f160139

Please sign in to comment.