docs: Add Dify app configuration via database procedure
FFG-DEP-DIFY-001 — how to configure Dify apps without UI Covers: rename, link KB, update dataset config, get API tokens Includes current state for The Forge and Awakened Concierge Key insight: direct DB manipulation avoids UI publish problem
This commit is contained in:
104
docs/deployment/dify-app-configuration.md
Normal file
104
docs/deployment/dify-app-configuration.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# Dify App Configuration via Database
|
||||
|
||||
**Document ID:** FFG-DEP-DIFY-001
|
||||
**Created:** April 12, 2026 (Chronicler #84 — The Meridian)
|
||||
**Purpose:** How to configure Dify apps without using the UI (avoids "everything disappears if you don't publish" problem)
|
||||
|
||||
---
|
||||
|
||||
## Why This Exists
|
||||
|
||||
Dify's web UI loses unsaved changes if you navigate away before publishing. The API uses session-based auth that's not easily accessible. The cleanest approach is direct database manipulation via the Dify PostgreSQL container.
|
||||
|
||||
---
|
||||
|
||||
## Key Database Info
|
||||
|
||||
- **Container:** `firefrost-codex-db-1` on TX1 Dallas (38.68.14.26)
|
||||
- **Database:** `dify`
|
||||
- **User:** `postgres`
|
||||
- **Access:** `docker exec firefrost-codex-db-1 psql -U postgres -d dify -c "..."`
|
||||
|
||||
---
|
||||
|
||||
## Key Tables
|
||||
|
||||
| Table | Purpose |
|
||||
|-------|---------|
|
||||
| `apps` | App name, mode, config ID |
|
||||
| `app_model_configs` | Model, system prompt, dataset config |
|
||||
| `app_dataset_joins` | Links apps to knowledge bases |
|
||||
| `api_tokens` | API keys per app |
|
||||
| `datasets` | Knowledge bases |
|
||||
|
||||
---
|
||||
|
||||
## Common Operations
|
||||
|
||||
### Rename an app
|
||||
```sql
|
||||
UPDATE apps SET name = 'The Forge' WHERE id = '<app_id>';
|
||||
```
|
||||
|
||||
### Find app ID by name
|
||||
```sql
|
||||
SELECT id, name, mode FROM apps ORDER BY created_at DESC LIMIT 10;
|
||||
```
|
||||
|
||||
### Get app API token
|
||||
```sql
|
||||
SELECT token FROM api_tokens WHERE app_id = '<app_id>';
|
||||
```
|
||||
|
||||
### Link KB to app
|
||||
```sql
|
||||
INSERT INTO app_dataset_joins (app_id, dataset_id)
|
||||
VALUES ('<app_id>', '<dataset_id>');
|
||||
```
|
||||
|
||||
### Update dataset config (enable hybrid search)
|
||||
```sql
|
||||
UPDATE app_model_configs
|
||||
SET dataset_configs = '{
|
||||
"retrieval_model": "multiple",
|
||||
"datasets": {
|
||||
"datasets": [{
|
||||
"dataset": {
|
||||
"enabled": true,
|
||||
"id": "<dataset_id>"
|
||||
}
|
||||
}]
|
||||
}
|
||||
}'::jsonb
|
||||
WHERE id = '<config_id>';
|
||||
```
|
||||
|
||||
### Get config ID for an app
|
||||
```sql
|
||||
SELECT app_model_config_id FROM apps WHERE name = 'The Forge';
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## The Forge — Current State (April 12, 2026)
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| App ID | `faf87e2a-1e98-4a0b-af14-b997ad1d3482` |
|
||||
| Config ID | `805eae6e-4cfd-43da-9e8b-3bc979a736b2` |
|
||||
| API Token | `app-forge-trinity-console-key` |
|
||||
| Model | `gemma4:26b-a4b-it-q8_0` |
|
||||
| KB (v2) | `3776b10b-918d-48d8-933b-e3dd0655838a` |
|
||||
|
||||
## Awakened Concierge — Current State (April 12, 2026)
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| App ID | `329a6bdb-5b19-45ce-a003-1861a5473d39` |
|
||||
| API Token | `app-pwucQuDCos5VXlVTQHnXPZAD` |
|
||||
| Model | `gemma4:26b-a4b-it-q8_0` |
|
||||
| KB | None (prompt-only) |
|
||||
|
||||
---
|
||||
|
||||
**Fire + Frost + Foundation = Where Love Builds Legacy** 💙🔥❄️
|
||||
Reference in New Issue
Block a user