config: Add 9 and update 4 files
Some checks failed
Test and Publish Templates / test-and-publish (push) Failing after 4s

This commit is contained in:
j
2026-01-01 12:00:09 +13:00
parent c5b662593a
commit c02621b7a2
13 changed files with 209 additions and 2 deletions

View File

@@ -10,3 +10,6 @@ SSH_USER="root"
# If set, maps this host directory to /static in the container # If set, maps this host directory to /static in the container
# If empty, uses the default config/static directory # If empty, uses the default config/static directory
HOST_STATIC_DIR="" HOST_STATIC_DIR=""
TEMPLATE=caddy

48
languagetool/README.txt Normal file
View File

@@ -0,0 +1,48 @@
LanguageTool Template
=====================
LanguageTool is an open-source proofreading software for English, French, German,
Polish, Russian, and more than 20 other languages. It finds many errors that a
simple spell checker cannot detect.
This template uses the erikvl87/languagetool Docker image which includes:
- FastText language detection (preinstalled)
- Support for n-gram datasets for improved error detection
- Configurable Java heap settings
CONFIGURATION
-------------
Edit config/service.env to customize:
CONTAINER_NAME - Name of the Docker container
HTTP_PORT - Port to expose LanguageTool API (default: 8010)
JAVA_XMS - Minimum Java heap size (default: 256m)
JAVA_XMX - Maximum Java heap size (default: 512m)
ENABLE_NGRAMS - Enable n-gram data volume (default: false)
LANGTOOL_PIPELINEPREWARMING - Prewarm pipeline for faster first request
N-GRAM DATA (OPTIONAL)
----------------------
For improved error detection, you can download n-gram data:
https://languagetool.org/download/ngram-data/
1. Set ENABLE_NGRAMS=true in service.env
2. Copy n-gram files to the data volume
3. Reinstall the service
API USAGE
---------
Check text:
curl --data "language=en-US&text=a simple test" http://localhost:8010/v2/check
Check with auto-detected language:
curl --data "text=a simple test" http://localhost:8010/v2/check
List supported languages:
curl http://localhost:8010/v2/languages
RESOURCES
---------
- Docker image: https://github.com/Erikvl87/docker-languagetool
- LanguageTool: https://languagetool.org/
- API docs: https://languagetool.org/http-api/

View File

@@ -0,0 +1,22 @@
# Service settings specific to this server
# (can also override anything in the template_info.env file in the template to make it specific to this server)
CONTAINER_NAME=languagetool
IMAGE_TAG="latest"
# Server Settings
SSH_USER="root"
# LanguageTool Settings
HTTP_PORT=8010
# Java heap size settings
JAVA_XMS=256m
JAVA_XMX=512m
# Enable n-gram data for improved error detection (optional)
# Mount n-gram datasets to the DATA_VOLUME for better results
# Download from: https://languagetool.org/download/ngram-data/
ENABLE_NGRAMS=false
# Pipeline prewarming for faster first request (optional)
LANGTOOL_PIPELINEPREWARMING=false

20
languagetool/install.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
source "${AGENT_PATH}/common.sh"
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
# LanguageTool Install Script
echo "Checking Docker installation..."
_check_docker_installed || _die "Docker test failed, aborting installation..."
echo "Pulling image ${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}..."
docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || _die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
echo "Stopping and removing any existing container..."
_stop_container "$CONTAINER_NAME"
_remove_container "$CONTAINER_NAME" || _die "Failed to remove container ${CONTAINER_NAME}"
echo "Starting container..."
bash ./start.sh || _die "Failed to start container ${CONTAINER_NAME}"
echo "Installation complete for service ${CONTAINER_NAME}."

7
languagetool/logs.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
source "${AGENT_PATH}/common.sh"
_check_required_env_vars "CONTAINER_NAME"
# LanguageTool Logs Script
docker logs "$CONTAINER_NAME" "$@"

47
languagetool/start.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
source "${AGENT_PATH}/common.sh"
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "HTTP_PORT" "JAVA_XMS" "JAVA_XMX"
# LanguageTool Start Script
# Build environment variables for the container
ENV_ARGS="-e Java_Xms=${JAVA_XMS} -e Java_Xmx=${JAVA_XMX}"
# Add pipeline prewarming if enabled
if [ "${LANGTOOL_PIPELINEPREWARMING}" = "true" ]; then
ENV_ARGS="${ENV_ARGS} -e langtool_pipelinePrewarming=true"
fi
# Build volume arguments
VOLUME_ARGS=""
if [ "${ENABLE_NGRAMS}" = "true" ]; then
# Create the ngrams volume if it doesn't exist
docker volume create "${DATA_VOLUME}" 2>/dev/null || true
VOLUME_ARGS="-v ${DATA_VOLUME}:/ngrams -e langtool_languageModel=/ngrams"
fi
DOCKER_RUN_CMD="docker run -d \
--name ${CONTAINER_NAME} \
--restart=unless-stopped \
-p ${HTTP_PORT}:8010 \
${ENV_ARGS} \
${VOLUME_ARGS} \
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"
echo "Starting container ${CONTAINER_NAME}..."
if ! _create_and_start_container "$DOCKER_RUN_CMD" "$CONTAINER_NAME"; then
if _is_container_exists "$CONTAINER_NAME"; then
echo "Attempting to get logs from failed container..."
_get_container_logs "$CONTAINER_NAME"
fi
_die "Failed to start container ${CONTAINER_NAME}"
fi
if ! _is_container_running "$CONTAINER_NAME"; then
_get_container_logs "$CONTAINER_NAME"
_die "Container ${CONTAINER_NAME} is not running after start attempt"
fi
echo "Service ${CONTAINER_NAME} started successfully on port ${HTTP_PORT}."
echo "Test with: curl --data \"language=en-US&text=a simple test\" http://localhost:${HTTP_PORT}/v2/check"

11
languagetool/status.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
source "${AGENT_PATH}/common.sh"
_check_required_env_vars "CONTAINER_NAME"
# LanguageTool Status Script
if docker ps --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
echo "Running"
else
echo "Stopped"
fi

9
languagetool/stop.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
source "${AGENT_PATH}/common.sh"
_check_required_env_vars "CONTAINER_NAME"
# LanguageTool Stop Script
echo "Stopping container ${CONTAINER_NAME}..."
_stop_container "$CONTAINER_NAME"
echo "Container ${CONTAINER_NAME} stopped."

View File

@@ -0,0 +1,14 @@
# DO NOT EDIT THIS FILE FOR YOUR SERVICE!
# This file is replaced from the template whenever there is an update.
# Edit the service.env file to make changes.
REQUIRES_HOST_ROOT=false
REQUIRES_DOCKER=true
REQUIRES_DOCKER_ROOT=false
# Image settings
IMAGE_REGISTRY="docker.io"
IMAGE_REPO="erikvl87/languagetool"
# Volume settings
DATA_VOLUME=${CONTAINER_NAME}_ngrams

18
languagetool/uninstall.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
source "${AGENT_PATH}/common.sh"
_check_required_env_vars "CONTAINER_NAME"
# LanguageTool Uninstall Script
echo "Stopping container ${CONTAINER_NAME}..."
_stop_container "$CONTAINER_NAME"
echo "Removing container ${CONTAINER_NAME}..."
_remove_container "$CONTAINER_NAME" || _die "Failed to remove container ${CONTAINER_NAME}"
# CRITICAL: Never remove data volumes in uninstall.sh!
# Data volumes (ngrams) must be preserved for potential reinstallation
# Only destroy.sh should remove volumes
echo "Uninstallation of ${CONTAINER_NAME} complete"
echo "Note: Data volumes have been preserved. To remove all data, use destroy.sh"

View File

@@ -13,4 +13,7 @@ LOKI_USER=logclient
LOKI_PASSWORD= LOKI_PASSWORD=
# Optional: Set a custom hostname label (defaults to actual hostname) # Optional: Set a custom hostname label (defaults to actual hostname)
# HOSTNAME_LABEL= # HOSTNAME_LABEL=
TEMPLATE=logclient

View File

@@ -13,4 +13,8 @@ TEMPLATE_MIN_DISK="100"
TEMPLATE_CATEGORY="monitoring" TEMPLATE_CATEGORY="monitoring"
REQUIRES_HOST_ROOT=false REQUIRES_HOST_ROOT=false
REQUIRES_DOCKER=true REQUIRES_DOCKER=true
REQUIRES_DOCKER_ROOT=false REQUIRES_DOCKER_ROOT=false
# defaults to actual hostname.
HOSTNAME_LABEL=

View File

@@ -2,6 +2,7 @@
"caddy": "1.0.0", "caddy": "1.0.0",
"cloudflare-tunnel": "1.0.0", "cloudflare-tunnel": "1.0.0",
"gitea-runner-docker": "1.0.0", "gitea-runner-docker": "1.0.0",
"languagetool": "1.0.0",
"logserver": "1.0.1", "logserver": "1.0.1",
"simple-object-server": "1.0.0", "simple-object-server": "1.0.0",
"squashdisplay": "1.0.0", "squashdisplay": "1.0.0",