Self-hosting LanguageTool
You already know Grammarly and you want an open-source self-hosted alternative to it. Maybe with a privacy-preserving browser and word processor integration. Let's spin up our LanguageTool instance!
As far as I know there are several users of the Grammarly service, and personally I've been one of them in the past. But as long as the privacy is a concern, and TBH I'm self-hosting pretty much everything in my digital life, it's better to look for a safe and open-source alternative. Introducing LanguageTool, it meets all the requirements I'm chasing, and we will see how to self-host it and how to configure its browser extension in order to get the job done without moving any data to any stinky remote place.
We will do it using Docker and docker-compose. Here's the manifest:
Save the docker-compose.yaml file and launch it:
$ docker-compose up -d
Time to install the ngram data, you can find the supported languages here. Pick a file and copy the URL from here. Let's choose English, get back to the terminal and sh into the container as root:
$ docker exec -u root -it languagetool sh
Now, download the ngram zip file using wget and extract the content in the lt_ngrams volume. As root in the host:
# cd /var/lib/docker/volumes/lt_ngrams/_data/
# wget https://languagetool.org/download/ngram-data/ngrams-en-20150817.zip && unzip ngrams-en-20150817.zip && rm ngrams-en-20150817.zip
# exit
Restart the application:
$ docker-compose restart
Configuring LanguageTool browser extension
Time to move back to our favorite browser, you can find the available extensions in the LanguageTool official website. Just install it, open the settings of the extension → advanced settings, select "other server" and type the address of your LanguageTool instance: http://YOUR_SERVER_IP:8010/v2. If you are running the container locally you can use localhost:8010 instead. As always, for a production environment I recommend using a reverse proxy configured for secure SSL connections, don't expose service ports directly to the web.
That's it, you're good to go, I hope it helps! >_