system-config/doc/source/codesearch.rst
Ian Wienand 368466730c Migrate codesearch site to container
The hound project has undergone a small re-birth and moved to

 https://github.com/hound-search/hound

which has broken our deployment.  We've talked about leaving
codesearch up to gitea, but it's not quite there yet.  There seems to
be no point working on the puppet now.

This builds a container than runs houndd.  It's an opendev specific
container; the config is pulled from project-config directly.

There's some custom scripts that drive things.  Some points for
reviewers:

 - update-hound-config.sh uses "create-hound-config" (which is in
   jeepyb for historical reasons) to generate the config file.  It
   grabs the latest projects.yaml from project-config and exits with a
   return code to indicate if things changed.

 - when the container starts, it runs update-hound-config.sh to
   populate the initial config.  There is a testing environment flag
   and small config so it doesn't have to clone the entire opendev for
   functional testing.

 - it runs under supervisord so we can restart the daemon when
   projects are updated.  Unlike earlier versions that didn't start
   listening till indexing was done, this version now puts up a "Hound
   is not ready yet" message when while it is working; so we can drop
   all the magic we were doing to probe if hound is listening via
   netstat and making Apache redirect to a status page.

 - resync-hound.sh is run from an external cron job daily, and does
   this update and restart check.  Since it only reloads if changes
   are made, this should be relatively rare anyway.

 - There is a PR to monitor the config file
   (https://github.com/hound-search/hound/pull/357) which would mean
   the restart is unnecessary.  This would be good in the near and we
   could remove the cron job.

 - playbooks/roles/codesearch is unexciting and deploys the container,
   certificates and an apache proxy back to localhost:6080 where hound
   is listening.

I've combined removal of the old puppet bits here as the "-codesearch"
namespace was already being used.

Change-Id: I8c773b5ea6b87e8f7dfd8db2556626f7b2500473
2020-11-20 07:41:12 +11:00

43 lines
1.1 KiB
ReStructuredText

:title: Code Search
.. _codesearch:
Code Search
###########
The `Hound <https://github.com/hound-search/hound>`_ code search
engine is deployed in our infrastructure to service all OpenStack
repositories.
At a Glance
===========
:Hosts:
* http://codesearch.opendev.org
:Puppet:
* :git_file:`playbooks/roles/codesearch`
:Projects:
* https://github.com/hound-search/hound
:Bugs:
* https://storyboard.openstack.org/#!/project/748
:Resources:
* `Hound README <https://github.com/hound-search/hound/blob/master/README.md>`_
Overview
========
Hound is configured to read projects from a config.json file that is
automatically generated from the Gerrit projects.yaml
Maintenance
===========
Hound uses 'git pull' to keep repos in sync. If a force push is ever used to
correct an issue in a repo, then hound will not be able to pull or index those
changes. The only way to detect this is to look in /var/log/hound.log. The
error message looks like hound attempting to update the repo and getting a
'remote host hung up' message. The issue can be corrected by an infra-root
removing the relevant hound data directory. Hound will re-clone with the new
history.