1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00

Update quickstart guide (#8523)

This commit is contained in:
Melinda Fekete 2024-10-25 11:12:05 +02:00 committed by GitHub
parent 5662fe79f8
commit 3076bb4c21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 146 additions and 120 deletions

View File

@ -79,7 +79,7 @@ If you don't want to run Unleash locally, we also provide easy deployment setups
### Configure and run Unleash anywhere
The above sections show you how to get up and running quickly and easily. When you're ready to start configuring and customizing Unleash for your own environment, check out the documentation for [getting started with self-managed deployments](https://docs.getunleash.io/reference/deploy/getting-started), [Unleash configuration options](https://docs.getunleash.io/reference/deploy/configuring-unleash), or [running Unleash locally via docker](https://docs.getunleash.io/tutorials/quickstart#i-want-to-run-unleash-locally).
The above sections show you how to get up and running quickly and easily. When you're ready to start configuring and customizing Unleash for your own environment, check out the documentation for [getting started with self-managed deployments](https://docs.getunleash.io/reference/deploy/getting-started), [Unleash configuration options](https://docs.getunleash.io/reference/deploy/configuring-unleash), or [running Unleash locally via docker](https://docs.getunleash.io/tutorials/quickstart).
<br/>

View File

@ -1,119 +0,0 @@
---
title: Quickstart
---
There are lots of options to get started with Unleash. If you're comfortable with Docker, this is the fastest way to get up and running. If that's not you, here are [some additional ways to try Unleash](#more-unleash).
## 1. Set up Unleash with Docker {#setup-unleash-docker}
The easiest way to run Unleash locally is using Git and [Docker](https://www.docker.com/).
```sh
git clone git@github.com:Unleash/unleash.git
cd unleash
docker compose up -d
```
## 2. Log in to the Admin UI
Then point your browser to localhost:4242 and log in using:
```
username: admin
password: unleash4all
```
## 3. Create your first flag {#create-a-flag}
1. Navigate to the Feature flags list
2. Click 'New feature flag'
3. Give it a unique name, and click 'Create feature flag'
For a detailed guide on how to create a flag through the UI, [you can follow this guide](/how-to-create-feature-flag).
## 4a. Connect a client-side SDK {#connect-a-client-side-sdk}
To try Unleash with a client-side technology, create a [front-end token](/reference/api-tokens-and-client-keys#front-end-tokens) and use `<your-unleash-instance>/api/frontend` as the API URL.
Now you can open your application code and connect through one of the [client-side SDKs](/reference/sdks#client-side-sdks).
The following example shows you how you could use the [JavaScript SDK](/reference/sdks/javascript-browser) to connect to the Unleash demo frontend API:
```javascript
import { UnleashClient } from "unleash-proxy-client";
const unleash = new UnleashClient({
url: "https://<your-unleash-instance>/api/frontend",
clientKey: "<your-token>",
appName: "<your-app-name>",
});
unleash.on("synchronized", () => {
// Unleash is ready to serve updated feature flags.
// Check a feature flag
if (unleash.isEnabled("some-flag")) {
// do cool new things when the flag is enabled
}
});
```
## 4b. Connect a backend SDK {#connect-a-backend-sdk}
To try Unleash with a server-side technology, create a [client token](/reference/api-tokens-and-client-keys#client-tokens) and use `<your-unleash-instance>/api` as the API URL.
Now you can open up your application code and create a connection to Unleash using one of our [SDKs](/reference/sdks). Here's an example using the [NodeJS SDK](/reference/sdks/node) to connect to the Unleash demo instance:
```javascript
const { initialize } = require("unleash-client");
const unleash = initialize({
url: "https://<your-unleash-instance>/api/",
appName: "<your-app-name>",
customHeaders: {
Authorization: "<your-token>",
},
});
unleash.on("synchronized", () => {
// Unleash is ready to serve updated feature flags.
if (unleash.isEnabled("some-flag")) {
// do cool new things when the flag is enabled
}
});
```
## Additional Ways to Try Unleash {#more-unleash}
### Unleash Demo Instance {#unleash-demo-instance}
For testing purposes, we have set up a demo instance that you can use to test out different use cases before setting up your own instance. You can find the demo instance here: https://app.unleash-hosted.com/demo/
NOTE: This is a demo instance set up with the Pro version. [More information on our different versions](https://www.getunleash.io/pricing).
If you don't have your own Unleash instance set up, you can use the Unleash demo instance. In that case, the details are:
**Client Side**
- API URL: `https://app.unleash-hosted.com/demo/api/frontend`
- Frontend key: `demo-app:default.bf8d2a449a025d1715a28f218dd66a40ef4dcc97b661398f7e05ba67`
**Server Side**
- API URL: `https://app.unleash-hosted.com/demo/api`
- Client key: `56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d`
Curl command to test credentials and retrieve feature flags:
```
curl https://app.unleash-hosted.com/demo/api/client/features \
-H "Authorization: 56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d";
```
### Unleash Pro & Enterprise Instances {#unleash-pro-and-enterprise-instances}
You can run Unleash in the cloud by using our hosted offerings. Please see the [plans page](https://www.getunleash.io/pricing) to learn more.
### Other Local Setup Options
There are several [more options to get started locally.](using-unleash/deploy/getting-started)

145
website/docs/quickstart.mdx Normal file
View File

@ -0,0 +1,145 @@
---
title: Quickstart
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
This guide helps you set up Unleash in just a few minutes. The fastest way to get started is by using [Docker](#set-up-unleash-with-docker). If Docker doesn't work for you, see [other ways to try Unleash](#additional-ways-to-try-unleash).
## Set up Unleash with Docker
### Start Unleash locally
To start Unleash locally, clone the [Unleash repository](https://github.com/Unleash/unleash) and start the server with Docker Compose:
```shell
git clone git@github.com:Unleash/unleash.git
cd unleash
docker compose up -d
```
### Log in to the Unleash Admin UI
In your browser, go to [http://localhost:4242](http://localhost:4242) and log in using the following credentials:
- **username**: `admin`
- **password**: `unleash4all`
![Unleash Admin UI log in screen](/img/quickstart-login.png)
### Create your first flag
To create your first flag:
1. Open the **Default** project.
2. Click **New feature flag**.
3. Enter a name, and click **Create feature flag**.
For more details on creating feature flags, see [How to create a feature flag](/how-to-create-feature-flag).
### Connect an SDK
Next, use one of the client or server-side [SDKs](/reference/sdks) to connect Unleash with your application.
1. Create an API token:
- For client-side SDKs, use a [frontend token](/reference/api-tokens-and-client-keys#front-end-tokens).
- For server-side SDKs, use a [client token](/reference/api-tokens-and-client-keys#client-tokens).
2. Determine your Unleash URL:
- For client-side SDKs, use `<your-unleash-instance>/api/frontend`.
- For server-side SDKs, use `<your-unleash-instance>/api`.
3. Use the SDK to connect to Unleash in your application.
The following example shows how to use the [JavaScript SDK](/reference/sdks/javascript-browser) and the [Node.js SDK](/reference/sdks/node) to connect to your Unleash instance:
<Tabs groupId="connect-sdk-quickstart">
<TabItem value="sdk-client-side" label="Connect a client-side SDK">
```javascript title="JavaScript SDK"
import { UnleashClient } from "unleash-proxy-client";
const unleash = new UnleashClient({
url: "https://<your-unleash-instance>/api/frontend",
clientKey: "<your-token>",
appName: "<your-app-name>",
});
unleash.on("synchronized", () => {
// Unleash is ready to serve updated feature flags.
// Check a feature flag
if (unleash.isEnabled("some-flag")) {
// do cool new things when the flag is enabled
}
});
```
</TabItem>
<TabItem value="sdk-server-side" label="Connect a server-side SDK">
```javascript title="Node.js SDK"
const { initialize } = require("unleash-client");
const unleash = initialize({
url: "https://<your-unleash-instance>/api/",
appName: "<your-app-name>",
customHeaders: {
Authorization: "<your-token>",
},
});
unleash.on("synchronized", () => {
// Unleash is ready to serve updated feature flags.
if (unleash.isEnabled("some-flag")) {
// do cool new things when the flag is enabled
}
});
```
</TabItem>
</Tabs>
## Other ways to try Unleash
### Unleash demo instance
You can also use the [Unleash demo instance](https://app.unleash-hosted.com/demo/) to test different use cases before setting up your own instance. This is a [Pro](https://www.getunleash.io/pricing) version available at `https://app.unleash-hosted.com/demo/`.
To run tests on this instance, use the following API URLs and keys:
- **Client-side:**
- API URL: `https://app.unleash-hosted.com/demo/api/frontend`
- Frontend key: `demo-app:default.bf8d2a449a025d1715a28f218dd66a40ef4dcc97b661398f7e05ba67`
- **Server-side:**
- API URL: `https://app.unleash-hosted.com/demo/api`
- Client key: `56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d`
To test the credentials and retrieve feature flags, run this command:
```shell
curl https://app.unleash-hosted.com/demo/api/client/features \
-H "Authorization: 56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d"
```
### Other local setup options
For other ways to get started locally, see the steps for [starting an Unleash server](using-unleash/deploy/getting-started#start-unleash-server).
## Hosting Unleash
#### Hosted by Unleash
With our [Pro and Enterprise plans](https://www.getunleash.io/pricing), you can run Unleash in the cloud by using our hosted offerings.
#### Self-hosted
Self-hosting Unleash is available for [Open-Source](https://www.getunleash.io/pricing) and [Enterprise](https://www.getunleash.io/pricing) customers. Visit [Self-hosting Unleash](/using-unleash/deploy) to learn more.
## Next steps
Check out our reference documentation that explains all [core concepts](/reference) you need to get the most out of Unleash.
Explore feature flag best practices and language-specific tutorials in our [developer guides](/topics).

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB