1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

docs: add initial (untested) steps on how to run the proxy locally.

I haven't yet tested connecting to the `unleash:4242` address.
This commit is contained in:
Thomas Heartman 2021-11-22 16:16:38 +01:00
parent 52ae753466
commit 98cdc1674f
2 changed files with 74 additions and 3 deletions

View File

@ -198,7 +198,7 @@ unleash.on('synchronized', () => {
## I want to run Unleash locally
### Run Unleash with Docker
### Run Unleash with Docker {#run-unleash-with-docker}
The easiest way to run unleash locally is using [docker](https://www.docker.com/).
@ -214,11 +214,13 @@ docker run -e POSTGRES_PASSWORD=some_password \
3. Start Unleash via docker:
```sh
docker run -p 4242:4242 \
docker run --name unleash \
-p 4242:4242 \
-e DATABASE_HOST=postgres -e DATABASE_NAME=unleash \
-e DATABASE_USERNAME=unleash_user -e DATABASE_PASSWORD=some_password \
-e DATABASE_SSL=false \
--network unleash unleashorg/unleash-server
--network unleash unleashorg/unleash-server \
```
[Click here to see all options to get started locally.](deploy/getting-started.md)
@ -232,6 +234,75 @@ username: admin
password: unleash4all
```
### Run Unleash and the Unleash proxy with Docker
Follow steps outlined in the [Run Unleash with
Docker](#run-unleash-with-docker) section to get the Unleash instance
up and running. Once you have done that you need to first get an API
key from your Unleash instance and then use that API key when starting
the Unleash proxy.
1. Get an API key.
To get an API key, access your Unleash instance in a web browser.
First, navigate to the API access screen.
![The Unleash UI showing a dropdown menu under the "Configure" menu
entry. The dropdown menu's "API Access" option is highlighted and
you're told to navigate there.](/img/api_access_navigation.png
"Navigate to the API access page.")
Next, create an API key with these details
- **name:** proxy-key (this can be whatever you want)
- **token type:** client
- **project:** all
- **environment:** select your preferred environment (this option is
only available in Unleash 4.3 and later)
Copy the API key to your clipboard. You'll need it in the next step.
:::note
Depending on whether you have the environments feature
enabled or not, the API key will look a little different. If you
don't have environments enabled, it'll just be a 64 character long
hexadecimal string (for instance
`943ca9171e2c884c545c5d82417a655fb77cec970cc3b78a8ff87f4406b495d0`).
If you do have environments enabled, the key will be prefixed with
the project and the environment that the key is valid for. It'll use the
format `<project>:<environment>.<key>`, e.g.
`demo-app:production.614a75cf68bef8703aa1bd8304938a81ec871f86ea40c975468eabd6`.
Regardless of which format your string uses, do not modify it.
:::
2. Start the Unleash proxy
Start a container with the Unleash proxy by running the following
command. Replace `${API_KEY}` with the key you created in the
following step.
```sh
docker run --name unleash-proxy \
-e UNLEASH_PROXY_SECRETS=some-secret \
-e UNLEASH_URL='http://unleash:4242/api/' \
-e UNLEASH_API_TOKEN='${API_KEY}' \
-p 3000:3000 \
unleashorg/unleash-proxy
```
3. Test the proxy
To make sure the proxy is running successfully, you can test it by
running the following command:
```curl
curl http://localhost:3000/proxy -H "Authorization: some-secret"
```
### Create your first toggle
In order to create a toggle through the UI, [you can follow this guide](create-feature-toggle.md). Once you have created your feature toggle, you are ready to connect your application using an SDK.

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB