Skip to content

LanguageTool (Alternative to Grammarly) in Container Manager on a Synology NAS

Last updated on 28 January 2024

Important or Recent Updates
Historic UpdatesDate
Guide rewritten for Container Manager09/07/2023
Added additional security option to the compose to restrict the container from gaining new privileges25/10/2023
Note and amendment made for NAS models with older Celeron CPUs09/11/2023
Historic updates


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.

Please note as of the November 2023 in order to use the built-in fasttext functionality you will need a Synology model using a CPU newer than the Intel Celeron J3 series. What kind of CPU does my Synology NAS have? However, you can use the other functionality if you continue.

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 a folder within the docker share called ‘languagetool’ then within this folder create two separate subfolders called ‘ngrams’ and ‘fasttext’

Then within the /docker/projects folder create a further folder called ‘languagetool-compose’ this is where our compose file will be saved.

Part 2 — 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.

Project Name’ will be ‘languagetool’

Path’ click the button and select the folder we created earlier in ‘/docker/projects/languagetool-compose’.

Source:’ change the drop-down to ‘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.

YAML
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.

MAP_UID=⁣ – The UID you obtained in the user setup guide

MAP_GID=⁣ – The GID you obtained in the user setup guide

langtool_fasttextModel Remove this line if you have an older model NAS as noted at the start of the 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.



Buy Me a Coffee or a Beer

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 get the odd beverage. Plus 10% goes to the devs of the apps I do guides for every year.

Published inDockerOther Tools 7.2Synology

6 Comments

  1. 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!

    • Dr_Frankenstein Dr_Frankenstein

      Hey – let me see if someone on Discord with an older machine can try it out 🙂

  2. Adam Adam

    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.

    • Dr_Frankenstein Dr_Frankenstein

      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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!