config: Add 9 and update 4 files
Some checks failed
Test and Publish Templates / test-and-publish (push) Failing after 4s
Some checks failed
Test and Publish Templates / test-and-publish (push) Failing after 4s
This commit is contained in:
47
languagetool/start.sh
Executable file
47
languagetool/start.sh
Executable 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"
|
||||
Reference in New Issue
Block a user