Merge pull request 'LibreTranslate Reboot Fix' (#6) from dev into main
Reviewed-on: #6
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
# Libreranslate Configuration
|
# LibreTranslate Configuration
|
||||||
|
|
||||||
## Install
|
## 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
|
cd $DOCKER_HOME/Config/LibreTranslate
|
||||||
@@ -10,20 +10,20 @@ cp env.example .env
|
|||||||
vi .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
|
./prep.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
2. If using a temporary location for `models/` such as `/tmp/`, ensure
|
3. If using a temporary location for `models/` such as `/tmp/`, ensure
|
||||||
that `prep.sh` is in `root`'s crontab.
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Start the container up as normal.
|
4. Start the container up as normal.
|
||||||
|
|
||||||
```
|
```
|
||||||
cp docker-compose.main.yml docker-compose.yml
|
cp docker-compose.main.yml docker-compose.yml
|
||||||
|
23
Config/LibreTranslate/cron-reboot.sh
Executable file
23
Config/LibreTranslate/cron-reboot.sh
Executable file
@@ -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
|
@@ -34,7 +34,7 @@ services:
|
|||||||
tty: true
|
tty: true
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py']
|
test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py']
|
||||||
command: --req-limit 100 --char-limit 2000
|
command: --req-limit $REQUESTS --char-limit $CHARACTERS
|
||||||
environment:
|
environment:
|
||||||
# Allow the saving of API Keys. Requires volume libretranslate_api_keys.
|
# Allow the saving of API Keys. Requires volume libretranslate_api_keys.
|
||||||
- LT_API_KEYS=true
|
- LT_API_KEYS=true
|
||||||
|
@@ -12,6 +12,10 @@ COMPOSE_BAKE=true
|
|||||||
CPU=2.00
|
CPU=2.00
|
||||||
RAM=4.0G
|
RAM=4.0G
|
||||||
|
|
||||||
|
# How much the users are able to utilize the server.
|
||||||
|
REQUESTS=100
|
||||||
|
CHARACTERS=2000
|
||||||
|
|
||||||
### Languages ###
|
### Languages ###
|
||||||
|
|
||||||
## Check for language model updates on each run.
|
## Check for language model updates on each run.
|
||||||
@@ -41,6 +45,5 @@ MODELS_DIR=../../Volumes/LibreTranslate/models
|
|||||||
|
|
||||||
## Storing them in /tmp/ will cause them to get reset after reboots, but hides
|
## 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/.
|
## 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.
|
## Please see the README for the CRON command related to this setting.
|
||||||
## `@reboot /opt/Docker/Config/LibreTranslate/prep.sh`
|
|
||||||
# MODELS_DIR=/tmp/LibreTranslate/models
|
# MODELS_DIR=/tmp/LibreTranslate/models
|
||||||
|
Reference in New Issue
Block a user