Important or Recent Updates
Historic Updates | Date |
---|---|
Guide rewritten for Container Manager | 09/07/2023 |
Added additional security option to the compose to restrict the container from gaining new privileges | 25/10/2023 |
Note and amendment made for NAS models with older Celeron CPUs | 09/11/2023 |
Removed note from the 9th November Update due to updates to the container. | 19/04/2024 |
General formatting amendments | 10/09/2024 |
What is LanguageTool?
I was looking for a free and also more privacy focused version of Grammarly to help with improving these guides and my writing in general and discovered LanguageTool. It has a free tier as well as premium options. But the part that sold it for me is that it could be self-hosted meaning your data stays local, and its source is open.
Please note that the self-hosted server using Docker can only be used with the Browser and Office add-ons – unfortunately the desktop app does not support self-hosting.
Let’s Begin
In this guide I will take you through the steps of getting it setup in Docker on your Synology NAS.
First up you need to follow these two guides in order to follow the rest of the guide successfully
Performance
When the tool is doing its checks it is a read heavy operation, I found that if you are checking large amounts of text it can take longer when running off of a hard drive array. I would recommend either having an SSD read cache or if you have upgraded your systems’ memory this will speed up things considerably.
Folder Structure
Open up File station and create the following folder structure.
/docker/projects/languagetool-compose
/docker/languagetool/ngrams
/docker/languagetool/fasttext
Container Setup
Next we are going to set up a ‘Project’ in Container Manager. Open up Container Manager and click on Project then on the right-hand side click ‘Create’.
In the next screen we will set up our General Settings.
Section | Setting |
---|---|
Project Name: | languagetool |
Path: | /docker/projects/languagetool-compose |
Source: | Create docker-compose.yml |
Next we are going to drop in our docker compose configuration, copy all the code in the box below and paste it into line ‘1’ just like the screenshot.
What on earth is a Docker Compose? Docker Compose allows us to define how Docker should set up one or more containers within a single configuration file. This file is yaml formatted and Container Manager uses the Projects feature to manage them.
services:
languagetool:
image: meyay/languagetool:latest
container_name: languagetool
environment:
download_ngrams_for_langs: en
langtool_languageModel: /ngrams
langtool_fasttextModel: /fasttext/lid.176.bin
MAP_UID: 1234 #CHANGE_TO_YOUR_UID
MAP_GID: 65432 #CHANGE_TO_YOUR_GID
volumes:
- /volume1/docker/languagetool/ngrams:/ngrams
- /volume1/docker/languagetool/fasttext:/fasttext
ports:
- 8010:8010/tcp
network_mode: synobridge
security_opt:
- no-new-privileges:true
restart: unless-stopped
Environment Variables
We are now going to amend some key variables to make sure the container has access to our folders and also knows where we are in the world. Don’t change any other settings other than those I mention.
Section | Setting |
---|---|
MAP_UID= | The UID you obtained in the user setup guide |
MAP_GID= | The GID you obtained in the user setup guide |
Once you have made the edits you can click ‘Next’
You do not need to enable anything on the ‘Web portal settings’ screen click ‘Next’ again.
On the final screen click ‘Done’ which will begin the download of the container images and once downloaded they will be launched!
You have now completed the setup of the container.
You need to be patient as the first start-up will take some time to download the ngrams and fastText files (14.5Gb) this will depend on the speed of your connection.
Configuring the Extensions
With the container running we can now configure the specific extensions LanguageTool offers to point its queries to our local version of the tool. I am using the Chrome plugin as an example, but the premise is the same for each one.
Once the extension has installed head into its settings (where these are located will depend on your browser)
First up I have Picky mode enabled ignore the login prompt.
Then you will see a section called ‘Experimental settings (only for advanced users)‘
In this section we are going to select the ‘Other server’ option and then enter ‘http://YOURNASIP:8010/v2’ ensuring you have entered your own IP.
Let’s test to see if everything is working correctly.
Open up https://paste.drfrankenstein.co.uk/ and copy the text below into the ‘Editor’ section.
Dear Jane,
I was delighted to read you're letter last week. Its always a pleasure to recieve the latest news and to here that you and your family had a great summer.
We spent last week at the beach and had so much fun on the sand and in the water exploring the coast we weren't prepared for the rains that came at the end of the vacation. The best parts of the trip was the opportunities to sightsee and relax.
My kids are back in school to. I find their are less things to worry about now that the kids are at school all day. There is plenty of fun things to do in the summer, but by August, I've running out of ideas. I've excepted the fact that we'll have to think up brand-new activities next summer; hoping to round up some creative ideas soon.
Thanks again for your letter!
Sincerely,
Karen
You will see an animation in the bottom right, this means the tool is checking the sentences, after a few seconds you will see the results of the analysis with the suggested changes highlighted.
You are now all set up.
Looking for some help, join our Discord community
If you are struggling with any steps in the guides or looking to branch out into other containers join our Discord community!
Buy me a beverage!
If you have found my site useful please consider pinging me a tip as it helps cover the cost of running things or just lets me stay hydrated. Plus 10% goes to the devs of the apps I do guides for every year.
Hi there!
Could you check if migrating from self compiled fasttext to the Alpine 3.19 package fixes the compatibility issue with the NASes that had issues with the releases after November 2023?
Much appreciated!
Hey – let me see if someone on Discord with an older machine can try it out 🙂
I have tested the fixed build @meyal had put up recently, and confirm it is working again on a DS109+’s cpu without the fasttext error occurring now.
Hey thanks for testing, I will get the guide updated to reflect this!
Hi, I would like to ask if you have some suggestions of using private LanguageTool server with MS Word plugin. Seems like it does not accept HTTP addresses only HTTPS are allowed.
I successfully ran the LanguageTool server in my Synology NAS, and it works on Chrome and Firefox. Thanks.
Hey, apologies for the late reply. So I would understand not wanting to expose this to the internet to get https… as a working around which I have not had chance to do in a guide and this person on Reddit clued me in on to get internal HTTPs without port forwarding..
https://www.reddit.com/r/synology/comments/18abww6/improved_workflow_for_integrating_bitwarden/
You can get this sorted out by using a reverse proxy (Nginx Proxy Manager), with a domain name like duckdns (subdomain), use the Lets Encrypt feature (Use a DNS Challenge) in NPM to generate a certificate then restricting access to the domain by denying all except LAN clients only IP range.
You can create a subdomain something like languagetool.duckdns.org or a subdomain myname.duckdns.org then generate the certificate with wildcard for *. myname.duckdns.org
Yes another great alternative, also if you own your own domain something like DNS Challenge is another way to do internal SSL without having to expose the port.
Did something happen to the discord?
I think something happened on Discords end over night while I was sleeping. People were showing up as Banned and the channel was blocked. Seems OK now.