atlasbot: move to service image and add nats queue infra
This commit is contained in:
parent
cc51eb6d1e
commit
c4ecc07e58
@ -0,0 +1,26 @@
|
||||
# clusters/atlas/flux-system/applications/comms/image-automation.yaml
|
||||
apiVersion: image.toolkit.fluxcd.io/v1
|
||||
kind: ImageUpdateAutomation
|
||||
metadata:
|
||||
name: comms
|
||||
namespace: comms
|
||||
spec:
|
||||
interval: 1m0s
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: flux-system
|
||||
namespace: flux-system
|
||||
git:
|
||||
checkout:
|
||||
ref:
|
||||
branch: feature/ariadne
|
||||
commit:
|
||||
author:
|
||||
email: ops@bstein.dev
|
||||
name: flux-bot
|
||||
messageTemplate: "chore(comms): automated image update"
|
||||
push:
|
||||
branch: feature/ariadne
|
||||
update:
|
||||
strategy: Setters
|
||||
path: services/comms
|
||||
@ -6,6 +6,7 @@ resources:
|
||||
- vault/kustomization.yaml
|
||||
- vaultwarden/kustomization.yaml
|
||||
- comms/kustomization.yaml
|
||||
- comms/image-automation.yaml
|
||||
- crypto/kustomization.yaml
|
||||
- monerod/kustomization.yaml
|
||||
- pegasus/kustomization.yaml
|
||||
|
||||
@ -16,5 +16,6 @@ resources:
|
||||
- longhorn/kustomization.yaml
|
||||
- longhorn-ui/kustomization.yaml
|
||||
- postgres/kustomization.yaml
|
||||
- nats/kustomization.yaml
|
||||
- ../platform/vault-csi/kustomization.yaml
|
||||
- ../platform/vault-injector/kustomization.yaml
|
||||
|
||||
17
infrastructure/nats/configmap.yaml
Normal file
17
infrastructure/nats/configmap.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: nats-config
|
||||
namespace: nats
|
||||
labels:
|
||||
app: nats
|
||||
component: config
|
||||
annotations:
|
||||
description: "NATS JetStream configuration"
|
||||
data:
|
||||
nats.conf: |
|
||||
jetstream {
|
||||
store_dir: /data
|
||||
max_mem_store: 128MB
|
||||
max_file_store: 1GB
|
||||
}
|
||||
7
infrastructure/nats/kustomization.yaml
Normal file
7
infrastructure/nats/kustomization.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- configmap.yaml
|
||||
- service.yaml
|
||||
- statefulset.yaml
|
||||
4
infrastructure/nats/namespace.yaml
Normal file
4
infrastructure/nats/namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: nats
|
||||
17
infrastructure/nats/service.yaml
Normal file
17
infrastructure/nats/service.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: nats
|
||||
namespace: nats
|
||||
labels:
|
||||
app: nats
|
||||
spec:
|
||||
selector:
|
||||
app: nats
|
||||
ports:
|
||||
- name: client
|
||||
port: 4222
|
||||
targetPort: 4222
|
||||
- name: monitoring
|
||||
port: 8222
|
||||
targetPort: 8222
|
||||
54
infrastructure/nats/statefulset.yaml
Normal file
54
infrastructure/nats/statefulset.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: nats
|
||||
namespace: nats
|
||||
labels:
|
||||
app: nats
|
||||
spec:
|
||||
serviceName: nats
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nats
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nats
|
||||
spec:
|
||||
containers:
|
||||
- name: nats
|
||||
image: nats:2.10.18
|
||||
args:
|
||||
- "-c"
|
||||
- "/etc/nats/nats.conf"
|
||||
ports:
|
||||
- name: client
|
||||
containerPort: 4222
|
||||
- name: monitoring
|
||||
containerPort: 8222
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/nats
|
||||
- name: data
|
||||
mountPath: /data
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: nats-config
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
@ -58,12 +58,12 @@ spec:
|
||||
hardware: rpi5
|
||||
containers:
|
||||
- name: atlasbot
|
||||
image: python:3.11-slim
|
||||
image: registry.bstein.dev/bstein/atlasbot:0.1.0-0
|
||||
command: ["/bin/sh","-c"]
|
||||
args:
|
||||
- |
|
||||
. /vault/scripts/comms_vault_env.sh
|
||||
exec python /app/bot.py
|
||||
exec python -m atlasbot.main
|
||||
env:
|
||||
- name: MATRIX_BASE
|
||||
value: http://othrys-synapse-matrix-synapse:8008
|
||||
@ -78,25 +78,41 @@ spec:
|
||||
- name: BOT_USER
|
||||
value: atlasbot
|
||||
- name: BOT_MENTIONS
|
||||
value: atlasbot,aatlasbot,atlas_quick,atlas_smart
|
||||
value: atlasbot,aatlasbot,atlas-quick,atlas-smart
|
||||
- name: OLLAMA_URL
|
||||
value: http://ollama.ai.svc.cluster.local:11434
|
||||
- name: OLLAMA_MODEL
|
||||
value: qwen2.5:14b-instruct
|
||||
- name: ATLASBOT_MODEL_FAST
|
||||
value: qwen2.5:14b-instruct-q4_0
|
||||
- name: ATLASBOT_MODEL_DEEP
|
||||
- name: ATLASBOT_MODEL_SMART
|
||||
value: qwen2.5:14b-instruct
|
||||
- name: OLLAMA_FALLBACK_MODEL
|
||||
value: qwen2.5:14b-instruct-q4_0
|
||||
- name: OLLAMA_TIMEOUT_SEC
|
||||
value: "600"
|
||||
- name: ATLASBOT_THINKING_INTERVAL_SEC
|
||||
value: "120"
|
||||
value: "30"
|
||||
- name: ATLASBOT_SNAPSHOT_TTL_SEC
|
||||
value: "30"
|
||||
- name: ATLASBOT_HTTP_PORT
|
||||
value: "8090"
|
||||
- name: ATLASBOT_QUEUE_ENABLED
|
||||
value: "true"
|
||||
- name: ATLASBOT_NATS_URL
|
||||
value: nats://nats.nats.svc.cluster.local:4222
|
||||
- name: ATLASBOT_NATS_STREAM
|
||||
value: atlasbot
|
||||
- name: ATLASBOT_NATS_SUBJECT
|
||||
value: atlasbot.requests
|
||||
- name: ATLASBOT_FAST_MAX_ANGLES
|
||||
value: "2"
|
||||
- name: ATLASBOT_SMART_MAX_ANGLES
|
||||
value: "5"
|
||||
- name: ATLASBOT_FAST_MAX_CANDIDATES
|
||||
value: "2"
|
||||
- name: ATLASBOT_SMART_MAX_CANDIDATES
|
||||
value: "6"
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8090
|
||||
@ -108,9 +124,6 @@ spec:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
volumeMounts:
|
||||
- name: code
|
||||
mountPath: /app/bot.py
|
||||
subPath: bot.py
|
||||
- name: kb
|
||||
mountPath: /kb
|
||||
readOnly: true
|
||||
@ -118,9 +131,6 @@ spec:
|
||||
mountPath: /vault/scripts
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: code
|
||||
configMap:
|
||||
name: atlasbot
|
||||
- name: kb
|
||||
configMap:
|
||||
name: atlas-kb
|
||||
|
||||
23
services/comms/image.yaml
Normal file
23
services/comms/image.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
# services/comms/image.yaml
|
||||
apiVersion: image.toolkit.fluxcd.io/v1beta2
|
||||
kind: ImageRepository
|
||||
metadata:
|
||||
name: atlasbot
|
||||
namespace: comms
|
||||
spec:
|
||||
image: registry.bstein.dev/bstein/atlasbot
|
||||
interval: 1m0s
|
||||
secretRef:
|
||||
name: harbor-regcred
|
||||
---
|
||||
apiVersion: image.toolkit.fluxcd.io/v1beta2
|
||||
kind: ImagePolicy
|
||||
metadata:
|
||||
name: atlasbot
|
||||
namespace: comms
|
||||
spec:
|
||||
imageRepositoryRef:
|
||||
name: atlasbot
|
||||
policy:
|
||||
semver:
|
||||
range: ">=0.1.0-0"
|
||||
@ -4,6 +4,7 @@ kind: Kustomization
|
||||
namespace: comms
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- image.yaml
|
||||
- serviceaccount.yaml
|
||||
- secretproviderclass.yaml
|
||||
- mas-configmap.yaml
|
||||
@ -44,6 +45,10 @@ resources:
|
||||
- livekit-middlewares.yaml
|
||||
- matrix-ingress.yaml
|
||||
|
||||
images:
|
||||
- name: registry.bstein.dev/bstein/atlasbot
|
||||
newTag: 0.1.0-0 # {"$imagepolicy": "comms:atlasbot:tag"}
|
||||
|
||||
configMapGenerator:
|
||||
- name: comms-vault-env
|
||||
files:
|
||||
@ -60,11 +65,6 @@ configMapGenerator:
|
||||
- server.py=scripts/guest-register/server.py
|
||||
options:
|
||||
disableNameSuffixHash: true
|
||||
- name: atlasbot
|
||||
files:
|
||||
- bot.py=scripts/atlasbot/bot.py
|
||||
options:
|
||||
disableNameSuffixHash: true
|
||||
- name: othrys-element-host-config
|
||||
files:
|
||||
- 20-host-config.sh=scripts/element-host-config.sh
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user