Skip to content

Deploying a LanguageTool App

Introduction

LanguageTool is an open-source grammar, style, and spell checker. Deploying LanguageTool with a Dockerfile on Klutch.sh gives you reproducible builds, managed secrets, and persistent storage for optional dictionaries—all configured from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.


Prerequisites

  • A Klutch.sh account (create one)
  • A GitHub repository containing your LanguageTool configuration (GitHub is the only supported git source)
  • Docker familiarity and basic JVM knowledge
  • Optional: custom dictionaries or language packs stored on persistent volumes

For platform onboarding, see the Quick Start.


Architecture and ports

  • LanguageTool serves HTTP; set the internal container port to 8010.
  • If you add supporting services (caches, proxies), run them as separate Klutch.sh TCP apps exposed on port 8000.
  • Persistent storage is optional for custom dictionaries; mount if needed.

Repository layout

languagetool/
├── config/ # Optional configs or custom dictionaries
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Test locally using the official image:

Terminal window
docker run --rm -p 8010:8010 --name languagetool silviof/docker-languagetool

Optional start.sh for portability and Nixpacks fallback:

#!/usr/bin/env bash
set -euo pipefail
exec java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8010 --public

Make it executable with chmod +x start.sh.


Dockerfile for LanguageTool (production-ready)

Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):

FROM silviof/docker-languagetool:latest
WORKDIR /app
# Copy custom configs or dictionaries if needed
COPY config /app/config
EXPOSE 8010
CMD ["--port", "8010", "--public"]

Notes:

  • Pin the image tag for reproducible builds.
  • If you need extra language packs, add them in the image or mount via volume.

Environment variables (Klutch.sh)

Set these in the Klutch.sh app settings (Secrets tab) before deploying:

  • PORT=8010
  • LT_PUBLIC=true
  • LT_LANGUAGES=en-US,de-DE (adjust as needed)
  • Any JVM options like JAVA_OPTS=-Xms512m -Xmx1024m if required

If you deploy without the Dockerfile and need Nixpacks overrides:

  • NIXPACKS_BUILD_CMD="echo LanguageTool uses prebuilt image"
  • NIXPACKS_START_CMD=java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8010 --public
  • NIXPACKS_JDK_VERSION=17

Attach persistent volumes

In Klutch.sh storage settings, add mount paths and sizes (no names required):

  • /app/config — optional for custom dictionaries or server configs.

Ensure paths are writable inside the container if you update files at runtime.


Deploy LanguageTool on Klutch.sh (Dockerfile workflow)

  1. Push your repository (with the Dockerfile at the root) to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  1. Connect the GitHub repository; Klutch.sh automatically detects the Dockerfile.
  2. Choose HTTP traffic for LanguageTool.
  3. Set the internal port to 8010.
  4. Add the environment variables above (languages, public flag, JVM options, and any NIXPACKS_* overrides if you temporarily deploy without the Dockerfile).
  5. Attach persistent volumes for /app/config if you use custom dictionaries/configs, selecting sizes that fit your needs.
  6. Deploy. Your LanguageTool service will be reachable at https://example-app.klutch.sh; attach a custom domain if desired.

Sample API request

Check grammar via HTTP:

Terminal window
curl -X POST "https://example-app.klutch.sh/v2/check" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "language=en-US&text=This is an exampel with a typo."

Health checks and production tips

  • Add a reverse proxy health check hitting /v2/check with a lightweight payload.
  • Enforce HTTPS at the edge; forward HTTP to port 8010 internally.
  • Pin image tags and JVM options; test upgrades carefully.
  • Monitor memory usage and tune JAVA_OPTS for your workload.
  • If caching dictionaries or configs, ensure volumes have adequate space.

LanguageTool on Klutch.sh combines reproducible Docker builds with managed secrets, optional persistent configs, and flexible HTTP/TCP routing. With the Dockerfile at the repo root and port 8010 configured, you can run a scalable grammar-checking service without extra YAML or workflow overhead.