Skip to content

Commit f08bcac

Browse files
committed
chore: update README and scripts to require OUTPOST_AZURE_ID for deployment
1 parent 554308b commit f08bcac

File tree

3 files changed

+59
-10
lines changed

3 files changed

+59
-10
lines changed

examples/azure/README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,30 @@ This example includes three main scripts to manage the deployment:
131131

132132
To deploy Outpost, you must run the scripts in the following order:
133133

134-
1. **Provision Dependencies:**
134+
1. **Set Required Environment Variable:**
135+
```bash
136+
# Generate a random ID (recommended):
137+
export OUTPOST_AZURE_ID=$(openssl rand -hex 3)
138+
139+
# Or use your own ID (lowercase alphanumeric with hyphens, 3-30 chars):
140+
# export OUTPOST_AZURE_ID=abc123
141+
```
142+
143+
This ID ensures your Azure resources have unique names and is required by the `dependencies.sh` script.
144+
145+
2. **Provision Dependencies:**
135146
```bash
136147
# To use a specific password (optional):
137148
# export PG_PASS=<YOUR_POSTGRES_PASSWORD>
138149
./dependencies.sh
139150
```
140151

141-
2. **Deploy Outpost:**
152+
3. **Deploy Outpost:**
142153
```bash
143154
./local-deploy.sh
144155
```
145156

146-
3. **Run Diagnostics:**
157+
4. **Run Diagnostics:**
147158
This command specifically targets the local Docker deployment. You will need a public webhook URL for the test.
148159
```bash
149160
export WEBHOOK_URL=<YOUR_PUBLIC_WEBHOOK_URL>
@@ -163,6 +174,9 @@ To deploy Outpost, you must run the scripts in the following order:
163174

164175
* **To provision new dependencies (Recommended):** Run the scripts to generate the files automatically.
165176
```bash
177+
# Set required environment variable:
178+
export OUTPOST_AZURE_ID=$(openssl rand -hex 3)
179+
166180
# To use a specific password (optional):
167181
# export PG_PASS=<YOUR_POSTGRES_PASSWORD>
168182
./dependencies.sh
@@ -189,6 +203,9 @@ Before deploying manually, ensure you have the `.env.outpost` and `.env.runtime`
189203

190204
* **To provision new dependencies:** Run the scripts to generate the files automatically.
191205
```bash
206+
# Set required environment variable:
207+
export OUTPOST_AZURE_ID=$(openssl rand -hex 3)
208+
192209
# To use a specific password (optional):
193210
# export PG_PASS=<YOUR_POSTGRES_PASSWORD>
194211
./dependencies.sh

examples/azure/dependencies.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@ if [[ -z "${OUTPOST_AZURE_ID-}" ]]; then
1717
echo ""
1818
echo " export OUTPOST_AZURE_ID=\$(openssl rand -hex 3)"
1919
echo ""
20-
echo "Or use your own ID (lowercase alphanumeric, 3-6 chars):"
20+
echo "Or use your own ID (lowercase alphanumeric with hyphens, 3-30 chars):"
2121
echo ""
22-
echo " export OUTPOST_AZURE_ID=abc123"
22+
echo " export OUTPOST_AZURE_ID=my-project-20251001"
2323
echo ""
2424
exit 1
2525
fi
2626

27-
# Validate OUTPOST_AZURE_ID format (lowercase alphanumeric, 3-6 chars)
28-
if ! [[ "$OUTPOST_AZURE_ID" =~ ^[a-z0-9]{3,6}$ ]]; then
29-
echo "❌ Error: OUTPOST_AZURE_ID must be lowercase alphanumeric, 3-6 characters."
27+
# Validate OUTPOST_AZURE_ID format (lowercase alphanumeric with hyphens, 3-30 chars)
28+
# Must start and end with alphanumeric (not hyphen)
29+
if ! [[ "$OUTPOST_AZURE_ID" =~ ^[a-z0-9]([a-z0-9-]{1,28}[a-z0-9])?$ ]]; then
30+
echo "❌ Error: OUTPOST_AZURE_ID must be lowercase alphanumeric with optional hyphens, 3-30 characters."
31+
echo "Must start and end with a letter or number (not a hyphen)."
3032
echo "Current value: '$OUTPOST_AZURE_ID'"
3133
exit 1
3234
fi

examples/azure/diagnostics.sh

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,23 @@ run_api_tests() {
194194
fi
195195
echo " -> ✅ Tenant created."
196196

197+
echo " (Checking configured topics...)"
198+
topics_response=$(curl -s -w "\n%{http_code}" -X GET "$base_url/api/v1/$TENANT_ID/topics" \
199+
-H "Authorization: Bearer $API_KEY")
200+
201+
topics_http_code=$(echo "$topics_response" | tail -n1)
202+
topics_body=$(echo "$topics_response" | sed '$d')
203+
204+
if [ "$topics_http_code" = "200" ]; then
205+
if [ -n "$topics_body" ] && [ "$topics_body" != "[]" ] && [ "$topics_body" != "null" ]; then
206+
echo " -> ℹ️ Configured topics: $topics_body"
207+
else
208+
echo " -> ℹ️ No topic restrictions configured (all topics allowed)"
209+
fi
210+
else
211+
echo " -> ⚠️ Could not fetch topics (HTTP $topics_http_code)"
212+
fi
213+
197214
echo " (Creating webhook destination...)"
198215
DESTINATION_ID=$(curl -sf -X POST "$base_url/api/v1/$TENANT_ID/destinations" \
199216
-H "Content-Type: application/json" \
@@ -211,11 +228,24 @@ run_api_tests() {
211228
echo " -> ✅ Webhook destination created."
212229

213230
echo " (Publishing test event...)"
214-
if ! curl -sf -X POST "$base_url/api/v1/publish" \
231+
publish_response=$(curl -s -w "\n%{http_code}" -X POST "$base_url/api/v1/publish" \
215232
-H "Content-Type: application/json" \
216233
-H "Authorization: Bearer $API_KEY" \
217-
-d "{\"tenant_id\":\"$TENANT_ID\",\"topic\":\"diagnostics.test\",\"data\":{\"hello\":\"world\",\"source\":\"$event_source\"}}" >/dev/null; then
234+
-d "{\"tenant_id\":\"$TENANT_ID\",\"topic\":\"diagnostics.test\",\"data\":{\"hello\":\"world\",\"source\":\"$event_source\"}}")
235+
236+
publish_http_code=$(echo "$publish_response" | tail -n1)
237+
publish_body=$(echo "$publish_response" | sed '$d')
238+
239+
if [ "$publish_http_code" != "200" ] && [ "$publish_http_code" != "201" ] && [ "$publish_http_code" != "202" ]; then
218240
echo " -> ❌ Failed to publish event."
241+
echo " HTTP Status: $publish_http_code"
242+
if [ -n "$publish_body" ]; then
243+
echo " Response: $publish_body"
244+
fi
245+
echo " Request details:"
246+
echo " - Tenant ID: $TENANT_ID"
247+
echo " - Topic: diagnostics.test"
248+
echo " - Endpoint: $base_url/api/v1/publish"
219249
if [[ "$base_url" == *"azurecontainerapps.io"* ]]; then
220250
echo " Fetching logs for '$AZURE_CONTAINER_APP_NAME'..."
221251
az containerapp logs show --name "$AZURE_CONTAINER_APP_NAME" --resource-group "$RESOURCE_GROUP" --tail 20

0 commit comments

Comments
 (0)