Deploy SearxNG on ai-server-4080 for chat_backend grounded search (#10).
Sync runner checkout / sync (pull_request) Successful in 6s
Sync runner checkout / sync (pull_request) Successful in 6s
Add roles/searxng (compose + JSON-enabled settings), gate with searxng_stack on ai-server-4080, open UFW 8088/tcp from the LAN. Port 8088 avoids the dta_webapp :8080 clash; chat_backend must use SEARXNG_BASE_URL=http://10.0.0.128:8088.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
---
|
||||
# SearxNG for chat_backend grounded web search (#10).
|
||||
# Hosted on ai-server-4080 only (next to Ollama). LAN-only — not NPM public.
|
||||
|
||||
searxng_dir: "{{ apps_base_dir }}/searxng"
|
||||
searxng_image: "searxng/searxng:latest"
|
||||
|
||||
# Host port 8088 — 8080 is already dta_webapp prod on ai-server-4080.
|
||||
searxng_host_port: 8088
|
||||
searxng_container_port: 8080
|
||||
|
||||
# Public base URL as seen by chat_backend containers on the LAN.
|
||||
searxng_base_url: "http://{{ ansible_host }}:{{ searxng_host_port }}/"
|
||||
|
||||
# Override via host_vars or vault; must be stable across restarts.
|
||||
searxng_secret_key: "CHANGE_ME_SEARXNG_SECRET"
|
||||
|
||||
# LAN CIDR allowed to hit the JSON API (same pattern as observability).
|
||||
searxng_ufw_from: "{{ ufw_ssh_allowed_network }}"
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
# SearxNG JSON search API for chat_backend grounded retrieval.
|
||||
# Enabled on ai-server-4080 via searxng_stack: true (issue #10).
|
||||
|
||||
- name: searxng | ensure project directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ searxng_dir }}"
|
||||
state: directory
|
||||
owner: "{{ admin_user }}"
|
||||
group: "{{ admin_user }}"
|
||||
mode: "0750"
|
||||
|
||||
- name: searxng | settings.yml
|
||||
ansible.builtin.template:
|
||||
src: settings.yml.j2
|
||||
dest: "{{ searxng_dir }}/settings.yml"
|
||||
owner: "{{ admin_user }}"
|
||||
group: "{{ admin_user }}"
|
||||
mode: "0640"
|
||||
register: _searxng_settings
|
||||
|
||||
- name: searxng | compose file
|
||||
ansible.builtin.template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ searxng_dir }}/docker-compose.yml"
|
||||
owner: "{{ admin_user }}"
|
||||
group: "{{ admin_user }}"
|
||||
mode: "0644"
|
||||
register: _searxng_compose
|
||||
|
||||
- name: searxng | allow JSON API from LAN
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
port: "{{ searxng_host_port }}"
|
||||
proto: tcp
|
||||
from_ip: "{{ searxng_ufw_from }}"
|
||||
comment: SearxNG for chat_backend grounded search
|
||||
|
||||
- name: searxng | start stack
|
||||
ansible.builtin.command:
|
||||
cmd: >-
|
||||
docker compose up -d --remove-orphans
|
||||
{{ '--force-recreate' if (
|
||||
_searxng_compose is changed
|
||||
or _searxng_settings is changed
|
||||
) else '' }}
|
||||
chdir: "{{ searxng_dir }}"
|
||||
become: true
|
||||
become_user: "{{ admin_user }}"
|
||||
register: _searxng_up
|
||||
changed_when: >-
|
||||
_searxng_up.rc == 0 and (
|
||||
'Started' in (_searxng_up.stdout | default(''))
|
||||
or 'Recreated' in (_searxng_up.stdout | default(''))
|
||||
or 'Created' in (_searxng_up.stdout | default(''))
|
||||
or _searxng_compose is changed
|
||||
or _searxng_settings is changed
|
||||
)
|
||||
failed_when: _searxng_up.rc != 0
|
||||
|
||||
- name: searxng | show compose failure output
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ _searxng_up.stderr_lines | default(_searxng_up.stdout_lines) }}"
|
||||
when: _searxng_up is failed
|
||||
@@ -0,0 +1,23 @@
|
||||
# Managed by Ansible (roles/searxng). Do not edit by hand.
|
||||
services:
|
||||
searxng:
|
||||
image: {{ searxng_image }}
|
||||
container_name: searxng
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "{{ searxng_host_port }}:{{ searxng_container_port }}"
|
||||
volumes:
|
||||
- ./settings.yml:/etc/searxng/settings.yml:rw
|
||||
environment:
|
||||
- SEARXNG_BASE_URL={{ searxng_base_url }}
|
||||
cap_drop:
|
||||
- ALL
|
||||
cap_add:
|
||||
- CHOWN
|
||||
- SETGID
|
||||
- SETUID
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
@@ -0,0 +1,20 @@
|
||||
# Managed by Ansible (roles/searxng). Do not edit by hand.
|
||||
# Minimal overlay on SearxNG defaults — JSON format required by chat_backend (#62).
|
||||
|
||||
use_default_settings: true
|
||||
|
||||
server:
|
||||
secret_key: "{{ searxng_secret_key }}"
|
||||
limiter: false
|
||||
image_proxy: false
|
||||
port: {{ searxng_container_port }}
|
||||
bind_address: "0.0.0.0"
|
||||
base_url: "{{ searxng_base_url }}"
|
||||
|
||||
search:
|
||||
safe_search: 0
|
||||
autocomplete: ""
|
||||
default_lang: "en"
|
||||
formats:
|
||||
- html
|
||||
- json
|
||||
Reference in New Issue
Block a user