Deploy SearxNG on ai-server-4080 for chat_backend grounded search (#10) (#11)
Sync runner checkout / sync (push) Successful in 7s

## Summary
- Closes [#10](#10).
- Deploys **SearxNG** on **ai-server-4080** (`10.0.0.128`) for [chat_backend#62](ai_ml_operations/chat_backend#62) / [PR #65](ai_ml_operations/chat_backend#65) grounded search.
- New `roles/searxng/` (compose + JSON-enabled `settings.yml`), gated by `searxng_stack: true`, wired into `site.yml`.
- **Host port 8088** (not 8080 — that is `dta_webapp` on this host). UFW allows `10.0.0.0/24` → `8088/tcp` only.

## Ops after merge

```bash
./scripts/provision.sh ai-server-4080
# or targeted:
ansible-playbook playbooks/site.yml --limit ai-server-4080 --tags never  # full site play includes searxng when searxng_stack
```

Then set in `chat_backend_prod.env` / `chat_backend_beta.env`:

```text
SEARCH_PROVIDER=searxng
SEARCH_FAILOVER_PROVIDER=ddgs
SEARXNG_BASE_URL=http://10.0.0.128:8088
```

Smoke test from any app host:

```bash
curl -sG 'http://10.0.0.128:8088/search' --data-urlencode 'q=test' -d 'format=json' | head
```

## Test plan
- [ ] Provision ai-server-4080; confirm `docker ps` shows `searxng`
- [ ] Confirm `:8088` responds with JSON; `:8080` still serves dta_webapp
- [ ] Confirm UFW rule is LAN-only
- [ ] From adama/roslin container network, curl SearxNG succeeds
- [ ] Update chat_backend secrets to `:8088` and redeploy betaReviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
2026-08-02 11:33:38 -07:00
parent 92afbc6e00
commit 7e48c22e3e
8 changed files with 161 additions and 5 deletions
+64
View File
@@ -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