How to install Elasticsearch on Mastodon?
-
Do I need an external server, or should I install an elasticsearch app on Cloudron, or can I install it directly from the Ubuntu via code.
https://docs.joinmastodon.org/admin/optional/elasticsearch/
I'll describe my installation process and the problems I encountered.
First connect to the VPS using Terminal on Mac.
type:
apt install openjdk-8-jre-headless
The result is
Then I deleted the file according to the path. This code works again.
Enter code:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Message:
gpg: failed to start agent '/usr/bin/gpg-agent': No such file or directory gpg: can't connect to the agent: No such file or directory
To solve the above problem, I use
apt install gpg-agent
.again
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Enter code:
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
apt update && apt install elasticsearch
Then turn Mastodon off and on again in Cloudron.
Modify the
.env.production
file.ES_ENABLED=true ES_HOST=localhost ES_PORT=9200
Turn Mastodon off and on again in Cloudron.
Finally at this step it does not work.
RAILS_ENV=production bundle exec rake chewy:upgrade
Terminal Tips
-bash: bundle: command not found
-
@username said in How to install Elasticsearch on Mastodon?:
Do I need an external server, or should I install an elasticsearch app on Cloudron, or can I install it directly from the Ubuntu via code.
You will need an external server because we don't support installing additional packages on the server since it might break updates. At some point we do plan to integrate ElasticSearch into Cloudron. I think some other apps like nextcloud require this as well. For the moment, just install it on a ubuntu or equivalent outside Cloudron.
-
@girish said in How to install Elasticsearch on Mastodon?:
At some point we do plan to integrate ElasticSearch into Cloudron.
That would be very helpful and useful.
@girish said in How to install Elasticsearch on Mastodon?:
apps like nextcloud require this as well
yeah Elasticsearch is needed to get proper full text search working on Nextcloud.
-
@girish any chance ElasticSearch could be added to Mastodon any time soon? As instances grow and more people flock to Mastodon, this becomes an ever more important feature to have.
-
@felipebaez it's planned to add an elasticsearch addon but I don't have an ETA. For now, the best bet is to have a elasticsearch outside Cloudron and configure mastodon to use it.
Elasticsearch is quite the beast with memory requirements, so we have to look into how it will fit.
-
@girish said in How to install Elasticsearch on Mastodon?:
@username said in How to install Elasticsearch on Mastodon?:
Do I need an external server, or should I install an elasticsearch app on Cloudron, or can I install it directly from the Ubuntu via code.
You will need an external server because we don't support installing additional packages on the server since it might break updates. At some point we do plan to integrate ElasticSearch into Cloudron. I think some other apps like nextcloud require this as well. For the moment, just install it on a ubuntu or equivalent outside Cloudron.
I've just tried getting an external Linode running Elasticsearch running with my Cloudron Mastodon server. No luck. Got the server running, but no idea how to get the Cloudron Mastodon server to connect and create the "ElasticSearch indices and fill them with data".
Anyone got any guidance/steps on how to get this working?
Tried this but no luck: https://docs.joinmastodon.org/admin/optional/elasticsearch/
-
@shanelord01 I've got mine working. It's only advisable to have it running from with in the same server otherwise you'll have to expose it to the internet.
I'm hosting my ES in docker but its similar.Here's what I've done:
- Set your network.host and discovery.seed_hosts to 0.0.0.0, this is so that it'll be open to the internet
- Set your Port to something other than 9200, 9920 for example.
- Ensure that your firewall/port forwarding is setup.
- Configure your env.production
ES_ENABLED=true ES_HOST=[ES IP Address] ES_PORT=9920
- I recommend a reboot of the app
- Run bin/tootctl search deploy in the app terminal
-
The demand for ElasticSearch is about to increase rapidly very soon:
Full text search has just been merged in Mastodon main branch, and will be in the next version 4.2.0 (planned release date: 1st half of September). -
I don't blame the Staff for not implementing this (yet). The RAM requirements are simply huge. Even as an add-on, how many users are going to "add this on" and then watch their Cloudron go down in flames. Imagine the Forum then! And then we'll all be asking/demanding/pleading with the Staff to fix it, tweak it, optimize it, "it should be clearer that I need a 16GB ram machine for Cloudron" complaints that will probably even turn into "don't use CLourdon, it's a memory beast" posts here and there. If anything, it would be nice if Cloudron just made it simpler to connect to an ES install.
-
@scooke Thanks for the insights. I use Cloudron because it's very easy to use, not to save money. So I'm open to whichever solution they work out. If there won't be a solution from Cloudron, I'd appreciate if the team would let us know. I'd start finding one myself in that case, though that's an adventure I try to avoid.
-
@nichu42 you should already be able to connect an external ES instance. I think this is the best way if you badly need this now.
For integrating with cloudron, ES is a beast with its memory requirements as @scooke pointed out. It will take us a while to get to it and needs much thought. It's not in immediate roadmap.
-
@nichu42 I was just looking at it briefly. In case you go down this route... For some reason, they only support ES7 per https://github.com/mastodon/mastodon/issues/26544#issuecomment-1684005007 which is almost https://www.elastic.co/support/eol .
Also, Nextcloud ES integration now requires ES8 which could conflict with the previous ES7 requirement.
Finally, https://github.com/mastodon/mastodon/issues/18535 suggests OpenSearch 2.4.x might be supported.
Let me if you come up with something!