Elasticsearch is the standard method for providing full-text search for a Mastodon instance. See the Mastodon docs for general information about installation and usage.
While our instance is deployed as a set of Docker containers, our Elasticsearch instance runs on the host machine rather than in a container. This is partially because at the time @redoak didn't know a whole lot about Docker, and partially because he was impatient/lazy and wanted to see results quickly. He is exactly the correct amount of sorry for this.
Implementation Details
Our deployment isn't terribly exceptional, but in the interest of future maintainability, here are some notes about our setup:
- ES is bound to the docker network interface at
_docker0_
. This setting lives in/etc/elasticsearch/elasticsearch.yml
. - ES expects connections on the port range 9200:9300. It's not safe to expose Elasticsearch publicly, so there is a ufw rule allowing access to those ports only from the IP subnet that our docker containers use.
- to wit:
sudo ufw allow from 172.31.0.1/16 to any port 9200:9300 proto tcp
- to wit:
- The environment variables enabling and configuring Mastodon's connection to ES are set in
/opt/social.coop/sauce/.env.production
. changing these settings only takes effect after runningdocker compose up
.
Commands
Should it ever become desirable to rebuild the ES indices again, this can be achieved by:
$ sudo docker exec -it docker_web_1 /bin/bash
$ nohup tootctl search deploy --concurrency 6 2>&1 > es.log &
Consult the Mastodon docs linked above for more info on related commands and options.