comms: add atlas quick/smart bots

This commit is contained in:
Brad Stein 2026-01-28 13:00:19 -03:00
parent d56438fe06
commit 55d01ee539
8 changed files with 66 additions and 6 deletions

View File

@ -69,6 +69,10 @@ spec:
value: "480"
- name: AI_ATLASBOT_ENDPOINT
value: http://atlasbot.comms.svc.cluster.local:8090/v1/answer
- name: AI_ATLASBOT_MODEL_FAST
value: qwen2.5:14b-instruct-q4_0
- name: AI_ATLASBOT_MODEL_SMART
value: qwen2.5:14b-instruct
- name: AI_ATLASBOT_TIMEOUT_SEC
value: "30"
- name: AI_NODE_NAME

View File

@ -28,6 +28,12 @@ spec:
vault.hashicorp.com/agent-inject-secret-bot-pass: "kv/data/atlas/comms/atlasbot-credentials-runtime"
vault.hashicorp.com/agent-inject-template-bot-pass: |
{{- with secret "kv/data/atlas/comms/atlasbot-credentials-runtime" -}}{{ index .Data.data "bot-password" }}{{- end -}}
vault.hashicorp.com/agent-inject-secret-bot-quick-pass: "kv/data/atlas/comms/atlasbot-credentials-runtime"
vault.hashicorp.com/agent-inject-template-bot-quick-pass: |
{{- with secret "kv/data/atlas/comms/atlasbot-credentials-runtime" -}}{{ index .Data.data "bot-quick-password" }}{{- end -}}
vault.hashicorp.com/agent-inject-secret-bot-smart-pass: "kv/data/atlas/comms/atlasbot-credentials-runtime"
vault.hashicorp.com/agent-inject-template-bot-smart-pass: |
{{- with secret "kv/data/atlas/comms/atlasbot-credentials-runtime" -}}{{ index .Data.data "bot-smart-password" }}{{- end -}}
vault.hashicorp.com/agent-inject-secret-seeder-pass: "kv/data/atlas/comms/atlasbot-credentials-runtime"
vault.hashicorp.com/agent-inject-template-seeder-pass: |
{{- with secret "kv/data/atlas/comms/atlasbot-credentials-runtime" -}}{{ index .Data.data "seeder-password" }}{{- end -}}
@ -76,9 +82,13 @@ spec:
- name: ARIADNE_STATE_URL
value: http://ariadne.maintenance.svc.cluster.local/api/internal/cluster/state
- name: BOT_USER
value: atlasbot
value: atlas-smart
- name: BOT_USER_QUICK
value: atlas-quick
- name: BOT_USER_SMART
value: atlas-smart
- name: BOT_MENTIONS
value: atlasbot,aatlasbot,atlas-quick,atlas-smart
value: atlas-quick,atlas-smart
- name: OLLAMA_URL
value: http://ollama.ai.svc.cluster.local:11434
- name: OLLAMA_MODEL

View File

@ -87,6 +87,8 @@ spec:
ensure_key "comms/synapse-redis" "redis-password" >/dev/null
ensure_key "comms/synapse-macaroon" "macaroon_secret_key" >/dev/null
ensure_key "comms/atlasbot-credentials-runtime" "bot-password" >/dev/null
ensure_key "comms/atlasbot-credentials-runtime" "bot-quick-password" >/dev/null
ensure_key "comms/atlasbot-credentials-runtime" "bot-smart-password" >/dev/null
ensure_key "comms/atlasbot-credentials-runtime" "seeder-password" >/dev/null
SYN_PASS="$(ensure_key "comms/synapse-db" "POSTGRES_PASSWORD")"

View File

@ -92,7 +92,11 @@ spec:
- name: SEEDER_USER
value: othrys-seeder
- name: BOT_USER
value: atlasbot
value: atlas-smart
- name: BOT_USER_QUICK
value: atlas-quick
- name: BOT_USER_SMART
value: atlas-smart
command:
- /bin/sh
- -c
@ -230,6 +234,15 @@ spec:
wait_for_service(MAS_ADMIN_API_BASE)
token = admin_token()
bot_quick = os.environ.get("BOT_USER_QUICK", "")
bot_smart = os.environ.get("BOT_USER_SMART", "")
bot_quick_pass = os.environ.get("BOT_PASS_QUICK", "")
bot_smart_pass = os.environ.get("BOT_PASS_SMART", "")
ensure_user(token, os.environ["SEEDER_USER"], os.environ["SEEDER_PASS"])
ensure_user(token, os.environ["BOT_USER"], os.environ["BOT_PASS"])
if bot_quick and bot_quick_pass:
ensure_user(token, bot_quick, bot_quick_pass)
if bot_smart and bot_smart_pass:
ensure_user(token, bot_smart, bot_smart_pass)
PY

View File

@ -27,6 +27,12 @@ spec:
vault.hashicorp.com/agent-inject-secret-bot-pass: "kv/data/atlas/comms/atlasbot-credentials-runtime"
vault.hashicorp.com/agent-inject-template-bot-pass: |
{{- with secret "kv/data/atlas/comms/atlasbot-credentials-runtime" -}}{{ index .Data.data "bot-password" }}{{- end -}}
vault.hashicorp.com/agent-inject-secret-bot-quick-pass: "kv/data/atlas/comms/atlasbot-credentials-runtime"
vault.hashicorp.com/agent-inject-template-bot-quick-pass: |
{{- with secret "kv/data/atlas/comms/atlasbot-credentials-runtime" -}}{{ index .Data.data "bot-quick-password" }}{{- end -}}
vault.hashicorp.com/agent-inject-secret-bot-smart-pass: "kv/data/atlas/comms/atlasbot-credentials-runtime"
vault.hashicorp.com/agent-inject-template-bot-smart-pass: |
{{- with secret "kv/data/atlas/comms/atlasbot-credentials-runtime" -}}{{ index .Data.data "bot-smart-password" }}{{- end -}}
vault.hashicorp.com/agent-inject-secret-seeder-pass: "kv/data/atlas/comms/atlasbot-credentials-runtime"
vault.hashicorp.com/agent-inject-template-seeder-pass: |
{{- with secret "kv/data/atlas/comms/atlasbot-credentials-runtime" -}}{{ index .Data.data "seeder-password" }}{{- end -}}
@ -83,7 +89,11 @@ spec:
- name: SEEDER_USER
value: othrys-seeder
- name: BOT_USER
value: atlasbot
value: atlas-smart
- name: BOT_USER_QUICK
value: atlas-quick
- name: BOT_USER_SMART
value: atlas-smart
command:
- /bin/sh
- -c
@ -142,6 +152,8 @@ spec:
seeder_user = os.environ["SEEDER_USER"]
bot_user = os.environ["BOT_USER"]
bot_quick = os.environ.get("BOT_USER_QUICK", "").strip()
bot_smart = os.environ.get("BOT_USER_SMART", "").strip()
server = "live.bstein.dev"
seeder_id = f"@{seeder_user}:{server}"
bot_id = f"@{bot_user}:{server}"
@ -159,6 +171,12 @@ spec:
cols = get_cols(cur)
upsert_user(cur, cols, seeder_id, os.environ["SEEDER_PASS"], True)
upsert_user(cur, cols, bot_id, os.environ["BOT_PASS"], False)
if bot_quick and os.environ.get("BOT_PASS_QUICK"):
quick_id = f"@{bot_quick}:{server}"
upsert_user(cur, cols, quick_id, os.environ["BOT_PASS_QUICK"], False)
if bot_smart and os.environ.get("BOT_PASS_SMART"):
smart_id = f"@{bot_smart}:{server}"
upsert_user(cur, cols, smart_id, os.environ["BOT_PASS_SMART"], False)
finally:
conn.close()
PY

View File

@ -76,7 +76,7 @@ spec:
- name: SEEDER_USER
value: othrys-seeder
- name: BOT_USER
value: atlasbot
value: atlas-smart
command:
- /bin/sh
- -c

View File

@ -7,6 +7,14 @@ read_secret() {
tr -d '\r\n' < "${vault_dir}/$1"
}
read_optional() {
if [ -f "${vault_dir}/$1" ]; then
tr -d '\r\n' < "${vault_dir}/$1"
else
printf ''
fi
}
export TURN_STATIC_AUTH_SECRET="$(read_secret turn-secret)"
export TURN_PASSWORD="${TURN_STATIC_AUTH_SECRET}"
@ -14,6 +22,11 @@ export LIVEKIT_API_SECRET="$(read_secret livekit-primary)"
export LIVEKIT_SECRET="${LIVEKIT_API_SECRET}"
export BOT_PASS="$(read_secret bot-pass)"
export BOT_PASS_QUICK="$(read_optional bot-quick-pass)"
export BOT_PASS_SMART="$(read_optional bot-smart-pass)"
if [ -z "${BOT_PASS_SMART}" ]; then
export BOT_PASS_SMART="${BOT_PASS}"
fi
export SEEDER_PASS="$(read_secret seeder-pass)"
export CHAT_API_KEY="$(read_secret chat-matrix)"

View File

@ -66,7 +66,7 @@ spec:
- name: SEEDER_USER
value: othrys-seeder
- name: BOT_USER
value: atlasbot
value: atlas-smart
command:
- /bin/sh
- -c