Skip to content

Commit f29d703

Browse files
authored
improve deployment scripts, docs, and keycloak token generation with longer time limit (#86)
Signed-off-by: alexsin368 <alex.sin@intel.com>
1 parent 2cc2f75 commit f29d703

6 files changed

Lines changed: 77 additions & 26 deletions

File tree

core/scripts/generate-token.sh

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,38 @@ export KEYCLOAK_PASSWORD=changeme # The password for Keycloak admin login
99
export KEYCLOAK_CLIENT_ID=my-client-id # The client ID to be created in Keycloak
1010

1111
export KEYCLOAK_CLIENT_SECRET=$(bash "${SCRIPT_DIR}/keycloak-fetch-client-secret.sh" ${BASE_URL} ${KEYCLOAK_ADMIN_USERNAME} ${KEYCLOAK_PASSWORD} ${KEYCLOAK_CLIENT_ID} | awk -F': ' '/Client secret:/ {print $2}')
12-
export TOKEN=$(curl -k -X POST https://$BASE_URL/token -H 'Content-Type: application/x-www-form-urlencoded' -d "grant_type=client_credentials&client_id=${KEYCLOAK_CLIENT_ID}&client_secret=${KEYCLOAK_CLIENT_SECRET}" | jq -r .access_token)
12+
13+
# Set token lifespan on the client (in seconds)
14+
# 3600 = 1 hour, 86400 = 24 hours, 604800 = 7 days
15+
TOKEN_LIFESPAN=${TOKEN_LIFESPAN:-3600} # default 1 hour, override via env var
16+
17+
# Get admin token first
18+
ADMIN_TOKEN=$(curl -k -s -X POST \
19+
https://${BASE_URL}/realms/master/protocol/openid-connect/token \
20+
-H "Content-Type: application/x-www-form-urlencoded" \
21+
-d "grant_type=password" \
22+
-d "client_id=admin-cli" \
23+
-d "username=${KEYCLOAK_ADMIN_USERNAME}" \
24+
-d "password=${KEYCLOAK_PASSWORD}" | jq -r '.access_token')
25+
26+
# Get the client UUID
27+
CLIENT_UUID=$(curl -k -s \
28+
"https://${BASE_URL}/admin/realms/master/clients?clientId=${KEYCLOAK_CLIENT_ID}" \
29+
-H "Authorization: Bearer ${ADMIN_TOKEN}" | jq -r '.[0].id')
30+
31+
# Update token lifespan for the client
32+
curl -k -s -X PUT \
33+
"https://${BASE_URL}/admin/realms/master/clients/${CLIENT_UUID}" \
34+
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
35+
-H "Content-Type: application/json" \
36+
-d "{\"attributes\": {\"access.token.lifespan\": \"${TOKEN_LIFESPAN}\"}}"
37+
38+
export TOKEN=$(curl -k -s -X POST \
39+
https://$BASE_URL/token \
40+
-H 'Content-Type: application/x-www-form-urlencoded' \
41+
-d "grant_type=client_credentials&client_id=${KEYCLOAK_CLIENT_ID}&client_secret=${KEYCLOAK_CLIENT_SECRET}" \
42+
| jq -r .access_token)
1343

1444
echo "BASE_URL=${BASE_URL}"
15-
echo "TOKEN=${TOKEN}"
45+
echo "TOKEN=${TOKEN}"
46+
echo "TOKEN_LIFESPAN=${TOKEN_LIFESPAN} seconds ($(( TOKEN_LIFESPAN / 60 )) minutes)"

third_party/Dell/ubuntu-22.04/EI/single-node/user-guide-apisix.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,22 @@ chmod +x generate-token.sh
256256
After the script completes successfully, confirm that the token is available in your shell:
257257
258258
```bash
259-
echo $BASE_URL
260259
echo $TOKEN
261260
```
262261
263262
If a valid token is returned (long JWT string), the environment is ready for inference testing.
264263
264+
Set the DNS used to deploy Enterprise Inference:
265+
```bash
266+
export BASE_URL=https://api.example.com
267+
```
268+
269+
Change the model as needed. Note that with Keycloak/APISIX, the model name is included in the URL path. This must match one of the routes from the command `kubectl get apisixroutes`. Run **ONE** of the following commands depending on the hardware platform Enterprise Inference is deployed on.
270+
265271
**Run a test query for Gaudi:**
266-
> Note: Replace ${BASE_URL} with your DNS
267272
268273
```bash
269-
curl -k https://${BASE_URL}/Llama-3.1-8B-Instruct/v1/completions \
274+
curl -k ${BASE_URL}/Llama-3.1-8B-Instruct/v1/completions \
270275
-X POST \
271276
-d '{"model": "meta-llama/Llama-3.1-8B-Instruct", "prompt": "What is Deep Learning?", "max_tokens": 25, "temperature": 0}' \
272277
-H 'Content-Type: application/json' \

third_party/Dell/ubuntu-22.04/EI/single-node/user-guide-genai.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,16 @@ Expected States:
218218

219219
### 4. Test the Inference
220220

221+
Set the DNS used to deploy Enterprise Inference:
221222
```bash
222223
export BASE_URL=https://api.example.com
223224
```
224-
Reference the litellm_master_key file under core/inventory/metadata/vault.yml for master-key
225+
226+
Reference the litellm_master_key file under core/inventory/metadata/vault.yml for master-key. Change the model as needed. Run **ONE** of the following commands depending on the hardware platform Enterprise Inference is deployed on.
225227

226228
**Run a test query for Gaudi:**
227229
```bash
228-
curl -k https://${BASE_URL}/v1/completions \
230+
curl -k ${BASE_URL}/v1/completions \
229231
-X POST \
230232
-H "Content-Type: application/json" \
231233
-H "Authorization: Bearer <<master-key>>" \
@@ -239,7 +241,7 @@ curl -k https://${BASE_URL}/v1/completions \
239241

240242
**Run a test query for CPU:**
241243
```bash
242-
curl -k https://${BASE_URL}/v1/completions \
244+
curl -k ${BASE_URL}/v1/completions \
243245
-X POST \
244246
-H "Content-Type: application/json" \
245247
-H "Authorization: Bearer <<master-key>>" \

third_party/Dell/ubuntu-22.04/iac/README.md

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ This script mounts or unmounts the **Ubuntu 22.04.5 live server ISO** using the
4646
```bash
4747
export IDRAC_IP=100.67.x.x
4848
export IDRAC_USER=root
49-
export IDRAC_PASS=calvin
49+
export IDRAC_PASS=your-idrac-password
5050
```
5151
**Specify Custom ISO URL**
5252

@@ -102,10 +102,10 @@ Example (terraform.tfvars):
102102
```bash
103103
idrac_endpoint = "https://100.67.x.x"
104104
idrac_user = "root"
105-
idrac_password = "calvin"
105+
idrac_password = "your-idrac-password"
106106
idrac_ssl_insecure = true
107-
ubuntu_username = "user"
108-
ubuntu_password = "password"
107+
ubuntu_username = "your-username"
108+
ubuntu_password = "your-password"
109109
```
110110

111111
### Apply Terraform
@@ -136,8 +136,8 @@ chmod +x deploy-enterprise-inference.sh
136136

137137
```bash
138138
sudo ./deploy-enterprise-inference.sh \
139-
-u user \
140-
-p Linux123! \
139+
-u your-username \
140+
-p your-password \
141141
-t hf_xxxxxxxxxxxxx \
142142
-g gaudi3 \
143143
-a cluster-url \
@@ -149,7 +149,7 @@ sudo ./deploy-enterprise-inference.sh \
149149
|--------|----------|----------|-------------|
150150
| `-u, --username` | Yes (deploy & uninstall) | (none) | Enterprise Inference owner username. Must match the invoking (sudo) user. |
151151
| `-t, --token` | Yes (deploy only) | (none) | Hugging Face access token used to validate and download selected models. |
152-
| `-p, --password` | No | `Linux123!` | User sudo password used for Ansible become operations. |
152+
| `-p, --password` | No | (none) | User sudo password used for Ansible become operations. |
153153
| `-g, --gpu-type` | No | `gaudi3` | Deployment target type: `gaudi3` or `cpu`. |
154154
| `-m, --models` | No | `""` (interactive mode) | Choose model ID from [Pre-Integrated Models List](#pre-integrated-models-list) , based on your deployment type (gaudi or cpu) . If not provided, deployment runs interactively. |
155155
| `-b, --branch` | No | `release-1.4.0` | Git branch of the Enterprise-Inference repository to clone. |
@@ -167,8 +167,8 @@ sudo ./deploy-enterprise-inference.sh \
167167
The deployment script is resume-safe. If a failure occurs, simply rerun the script with the -r flag:
168168
```bash
169169
sudo ./deploy-enterprise-inference.sh \
170-
-u user \
171-
-p Linux123! \
170+
-u your-username \
171+
-p your-password \
172172
-t hf_XXXXXXXXXXXX \
173173
-g gaudi3 \
174174
-a cluster-url \
@@ -272,27 +272,41 @@ Expected:
272272

273273
### 5. API Health Check
274274
Validate the inference gateway is reachable.
275+
276+
If deployed with **Keycloak (APISIX)**, first obtain a token:
275277
```bash
276-
curl -k https://api.example.com/health
278+
source <path-to-Enterprise-Inference>/core/scripts/generate-token.sh
279+
```
280+
`TOKEN` will be set automatically.
281+
282+
If deployed with **GenAI Gateway**, use the litellm_master_key from Enterprise-Inference/core/inventory/metadata/vault.yml:
283+
```bash
284+
export TOKEN=<your-genai-api-key>
285+
```
286+
287+
Then run the health check to get the number of healthy and unhealthy model endpoints:
288+
```bash
289+
curl -k -s -L https://api.example.com/health \
290+
-H "Authorization: Bearer $TOKEN" | jq '{healthy: .healthy_count, unhealthy: .unhealthy_count}'
277291
```
278-
Expected:
279-
{"status":"ok"}
280292

281293
---
282294

283295
### 6. Test Model Inference
284296

285-
if EI is deployed with apisix, follow [Testing EI model with apisix](../EI/single-node/user-guide-apisix.md#5-test-the-inference) for generating token and testing the inference
297+
If EI is deployed with Keycloak/APISIX, follow [Testing EI model with Keycloak/APISIX](../EI/single-node/user-guide-apisix.md#5-test-the-inference) for generating token and testing the inference.
286298

287-
if EI is deployed with genai, follow [Testing EI model with genai](../EI/single-node/user-guide-genai.md#5-test-the-inference) for generating api-key and testing the inference
299+
If EI is deployed with GenAI Gateway, follow [Testing EI model with GenAI Gateway](../EI/single-node/user-guide-genai.md#5-test-the-inference) for acquiring the API key and testing the inference.
288300

289301
---
290302

291303
## Additional Information
292304

293305
### Pre-Integrated Models List
294306

295-
Enterprise Inference provides a set of pre-integrated and validated models optimized for performance and stability. These models can be deployed directly using the Enterprise Inference catalog.
307+
Enterprise Inference provides a set of pre-integrated and validated models optimized for performance and stability. These models can be deployed directly using the Enterprise Inference catalog.
308+
309+
> **Note**: this list is accurate as of `release-1.4.0`.
296310
297311
**Pre-Integrated Gaudi Models**
298312

third_party/Dell/ubuntu-22.04/iac/deploy-enterprise-inference.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Options:
1212
# -u, --username Enterprise Inference owner username (required)
1313
# -t, --token Hugging Face token (required)
14-
# -p, --password User sudo password for Ansible (default: Linux123!)
14+
# -p, --password User sudo password for Ansible
1515
# -g, --gpu-type GPU type: 'gaudi3' or 'cpu' (default: gaudi3)
1616
# -m, --models Model IDs to deploy, comma-separated (default: "5")
1717
# -b, --branch Git branch to clone (default: dell-deploy)
@@ -212,7 +212,7 @@ Required Options (uninstall):
212212
-u, --username Enterprise Inference owner username
213213
214214
Optional Options:
215-
-p, --password User sudo password for Ansible (default: Linux123!)
215+
-p, --password User sudo password for Ansible
216216
-g, --gpu-type GPU type: 'gaudi3' or 'cpu' (default: gaudi3)
217217
-m, --models Model IDs to deploy, comma-separated (default: empty)
218218
-b, --branch Git branch to clone (default: dell-deploy)

third_party/Dell/ubuntu-22.04/iac/verify-installation.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ echo ""
8686
echo "4. Network connectivity check..."
8787
echo " Note: Try to SSH to the server if you know the IP:"
8888
echo " ssh user@<server-ip>"
89-
echo " Password: Linux123!"
9089

9190
echo ""
9291
echo "=========================================="

0 commit comments

Comments
 (0)