From 4aebf1e21d7551a90566648ad11b1d1d21f4bdc8 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 26 Jul 2025 12:17:18 -0700 Subject: [PATCH 1/6] Fix typo in header and set ordered list to number itself. --- Config/LibreTranslate/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Config/LibreTranslate/README.md b/Config/LibreTranslate/README.md index a112d95..99eb4b7 100644 --- a/Config/LibreTranslate/README.md +++ b/Config/LibreTranslate/README.md @@ -1,8 +1,8 @@ -# Libreranslate Configuration +# LibreTranslate Configuration ## Install -0. Copy `env.example` to `.env` and adjust the values as necessary. +1. Copy `env.example` to `.env` and adjust the values as necessary. ``` cd $DOCKER_HOME/Config/LibreTranslate @@ -16,14 +16,14 @@ vi .env ./prep.sh ``` -2. If using a temporary location for `models/` such as `/tmp/`, ensure +1. If using a temporary location for `models/` such as `/tmp/`, ensure that `prep.sh` is in `root`'s crontab. ``` @reboot /opt/Docker/Config/LibreTranslate/prep.sh ``` -3. Start the container up as normal. +1. Start the container up as normal. ``` cp docker-compose.main.yml docker-compose.yml From 15f01061bac4bcca0d0ca6c3fc347e07c8a3f080 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 26 Jul 2025 12:36:29 -0700 Subject: [PATCH 2/6] Move request characters to the env file. --- Config/LibreTranslate/docker-compose.main.yml | 2 +- Config/LibreTranslate/env.example | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Config/LibreTranslate/docker-compose.main.yml b/Config/LibreTranslate/docker-compose.main.yml index 9da0311..61843e8 100644 --- a/Config/LibreTranslate/docker-compose.main.yml +++ b/Config/LibreTranslate/docker-compose.main.yml @@ -34,7 +34,7 @@ services: tty: true healthcheck: test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py'] - command: --req-limit 100 --char-limit 2000 + command: --req-limit $REQUESTS --char-limit $CHARACTERS environment: # Allow the saving of API Keys. Requires volume libretranslate_api_keys. - LT_API_KEYS=true diff --git a/Config/LibreTranslate/env.example b/Config/LibreTranslate/env.example index 2222cb6..099ebf0 100644 --- a/Config/LibreTranslate/env.example +++ b/Config/LibreTranslate/env.example @@ -12,6 +12,10 @@ COMPOSE_BAKE=true CPU=2.00 RAM=4.0G +# How much the users are able to utilize the server. +REQUESTS=100 +CHARACTERS=2000 + ### Languages ### ## Check for language model updates on each run. From eb2dda9d66cb97fdc8b79fb03ce698a58f58910c Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 26 Jul 2025 13:35:32 -0700 Subject: [PATCH 3/6] Allow container to reboot properly if using /tmp/ for models. Fixes newly created folder having permissions issues. --- Config/LibreTranslate/README.md | 12 ++++++------ Config/LibreTranslate/cron-reboot.sh | 23 +++++++++++++++++++++++ Config/LibreTranslate/env.example | 7 +------ 3 files changed, 30 insertions(+), 12 deletions(-) create mode 100755 Config/LibreTranslate/cron-reboot.sh diff --git a/Config/LibreTranslate/README.md b/Config/LibreTranslate/README.md index 99eb4b7..96504fe 100644 --- a/Config/LibreTranslate/README.md +++ b/Config/LibreTranslate/README.md @@ -1,8 +1,8 @@ -# LibreTranslate Configuration +# Libreranslate Configuration ## Install -1. Copy `env.example` to `.env` and adjust the values as necessary. +0. Copy `env.example` to `.env` and adjust the values as necessary. ``` cd $DOCKER_HOME/Config/LibreTranslate @@ -16,14 +16,14 @@ vi .env ./prep.sh ``` -1. If using a temporary location for `models/` such as `/tmp/`, ensure -that `prep.sh` is in `root`'s crontab. +2. If using a temporary location for `models/` such as `/tmp/`, ensure +that the reboot script is in `root`'s crontab to set the folders back up. ``` -@reboot /opt/Docker/Config/LibreTranslate/prep.sh +@reboot /opt/Docker/Config/LibreTranslate/cron-reboot.sh ``` -1. Start the container up as normal. +3. Start the container up as normal. ``` cp docker-compose.main.yml docker-compose.yml diff --git a/Config/LibreTranslate/cron-reboot.sh b/Config/LibreTranslate/cron-reboot.sh new file mode 100755 index 0000000..e454e97 --- /dev/null +++ b/Config/LibreTranslate/cron-reboot.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# 2025-07-26 Hyperling +# Ensure the LibreTranslate container starts correctly after a reboot, especially if placing models/ under /tmp/. + +## Setup ## + +DIR="$(dirname -- "${BASH_SOURCE[0]}")" +cd $DIR +source .env + +## Main ## + +# Shutdown the container. +docker compose down + +# Create folders. +prep.sh + +# Start the container. +docker compose up -d + +# Finish successfully. +exit 0 diff --git a/Config/LibreTranslate/env.example b/Config/LibreTranslate/env.example index 099ebf0..2f13ec2 100644 --- a/Config/LibreTranslate/env.example +++ b/Config/LibreTranslate/env.example @@ -12,10 +12,6 @@ COMPOSE_BAKE=true CPU=2.00 RAM=4.0G -# How much the users are able to utilize the server. -REQUESTS=100 -CHARACTERS=2000 - ### Languages ### ## Check for language model updates on each run. @@ -45,6 +41,5 @@ MODELS_DIR=../../Volumes/LibreTranslate/models ## Storing them in /tmp/ will cause them to get reset after reboots, but hides ## them from backup type locations such as Volumes/LibreTranslate/ and /var/. -## This will require a CRON entry for prepping the project dirs after a reboot. -## `@reboot /opt/Docker/Config/LibreTranslate/prep.sh` +## Please see the README for the CRON command related to this setting. # MODELS_DIR=/tmp/LibreTranslate/models From 7046699ed6fc67badd1032868163dd67f32f31d5 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 26 Jul 2025 13:42:12 -0700 Subject: [PATCH 4/6] Reapply changes from previous commits. Unsure why the synced branch did not have them if it was up to date. --- Config/LibreTranslate/README.md | 8 ++++---- Config/LibreTranslate/env.example | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Config/LibreTranslate/README.md b/Config/LibreTranslate/README.md index 96504fe..bfdbe42 100644 --- a/Config/LibreTranslate/README.md +++ b/Config/LibreTranslate/README.md @@ -1,8 +1,8 @@ -# Libreranslate Configuration +# LibreTranslate Configuration ## Install -0. Copy `env.example` to `.env` and adjust the values as necessary. +1. Copy `env.example` to `.env` and adjust the values as necessary. ``` cd $DOCKER_HOME/Config/LibreTranslate @@ -16,14 +16,14 @@ vi .env ./prep.sh ``` -2. If using a temporary location for `models/` such as `/tmp/`, ensure +1. If using a temporary location for `models/` such as `/tmp/`, ensure that the reboot script is in `root`'s crontab to set the folders back up. ``` @reboot /opt/Docker/Config/LibreTranslate/cron-reboot.sh ``` -3. Start the container up as normal. +1. Start the container up as normal. ``` cp docker-compose.main.yml docker-compose.yml diff --git a/Config/LibreTranslate/env.example b/Config/LibreTranslate/env.example index 2f13ec2..6c1792c 100644 --- a/Config/LibreTranslate/env.example +++ b/Config/LibreTranslate/env.example @@ -12,6 +12,10 @@ COMPOSE_BAKE=true CPU=2.00 RAM=4.0G +# How much the users are able to utilize the server. +REQUESTS=100 +CHARACTERS=2000 + ### Languages ### ## Check for language model updates on each run. From a868f874d7458161743995587232c828dae5a0c4 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 26 Jul 2025 13:54:37 -0700 Subject: [PATCH 5/6] Add file paths. --- Config/LibreTranslate/cron-reboot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Config/LibreTranslate/cron-reboot.sh b/Config/LibreTranslate/cron-reboot.sh index e454e97..5873ebf 100755 --- a/Config/LibreTranslate/cron-reboot.sh +++ b/Config/LibreTranslate/cron-reboot.sh @@ -6,7 +6,7 @@ DIR="$(dirname -- "${BASH_SOURCE[0]}")" cd $DIR -source .env +source ./.env ## Main ## @@ -14,7 +14,7 @@ source .env docker compose down # Create folders. -prep.sh +./prep.sh # Start the container. docker compose up -d From a3d6cdcee120d3b41505868171f71490621f6d7f Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 26 Jul 2025 13:55:04 -0700 Subject: [PATCH 6/6] Number list rather than relying on autoincrement. --- Config/LibreTranslate/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Config/LibreTranslate/README.md b/Config/LibreTranslate/README.md index bfdbe42..c8054b8 100644 --- a/Config/LibreTranslate/README.md +++ b/Config/LibreTranslate/README.md @@ -10,20 +10,20 @@ cp env.example .env vi .env ``` -1. Run the `prep.sh` file to create the volume mounts. +2. Run the `prep.sh` file to create the volume mounts. ``` ./prep.sh ``` -1. If using a temporary location for `models/` such as `/tmp/`, ensure +3. If using a temporary location for `models/` such as `/tmp/`, ensure that the reboot script is in `root`'s crontab to set the folders back up. ``` @reboot /opt/Docker/Config/LibreTranslate/cron-reboot.sh ``` -1. Start the container up as normal. +4. Start the container up as normal. ``` cp docker-compose.main.yml docker-compose.yml