Cloud VPS project codesearch

Clone this repo:

Branches

  1. 4bfe895 app.py: remove DESCRIPTIONS from old UI, add "Hound" to title by Timo Tijhof · 3 weeks ago master
  2. bc534a3 app.py: redirect _health to frontend, frontend: add link to view JSON by Timo Tijhof · 3 weeks ago
  3. 1e05ed0 frontend: Implement /_health by Timo Tijhof · 3 weeks ago
  4. f6ebc9f write_config: index operations/docker-images/production-images by Scott French · 10 days ago
  5. c913c63 app.py: remove favicon and open_search.xml from old UI by Timo Tijhof · 3 weeks ago

MediaWiki Codesearch (powered by Hound)

We use Etsy's Hound as the backend for Codesearch. The search functionality is great, but the UI is a bit lacking, so we work around it a bit.

Setup

This guide is based on setting up a new instance on the Wikimedia Cloud VPS infrastructure. Currently we use Debian Buster medium sized images.

After creating the instance, add and mount the cinder volume.

If we're creating a fresh volume, we want to modify the filesystem so we get some more inodes per available storage.

sudo umount /srv sudo mkfs.ext4 -T news /dev/sdb sudo systemctl daemon-reload sudo mount /srv

Running df -hi should show an increase in available inodes. You can proceed with actually setting up codesearch now by enabling the puppet role: role::codesearch. Then, force a puppet run: sudo puppet agent -tv

If you get errors related to iptables and docker, reboot the instance and they should fix themselves.

You might also need to force Hound configuration to be written by running: sudo systemctl start codesearch-write-config

If all that works, then curl http://localhost:3002/ should work, and you can point a web proxy to that port.

The hound- instances will be automatically restarted by systemd after 24 hours, which will pick up any new config changes.

Constraints

We don't want to modify or fork Hound. Really we just want to use the upstream docker images without modification. So we use a flask application to proxy requests to Hound, and inject our HTML during that process.

License

Hound is (C) 2014, Etsy, Inc. under the terms of the MIT license, see https://github.com/hound-search/hound/blob/v0.6.0/LICENSE for details.

Codesearch is (C) 2017-2020, Kunal Mehta under the terms of the GPL, v3 or any later version. See COPYING for details.

The favicon is a combination of the MediaWiki logo (CC-BY-SA 4.0) by Serhio Magpie, and the Git logo (CC-BY 3.0) by Jason Long. See https://creativecommons.org/licenses/by/3.0/ for details.