diff --git a/Config/LibreTranslate/README.md b/Config/LibreTranslate/README.md index 9aaa2e4..76bcf27 100644 --- a/Config/LibreTranslate/README.md +++ b/Config/LibreTranslate/README.md @@ -13,7 +13,7 @@ vi .env 1. Run the `prep.sh` file to create the volume mounts. ``` -$DOCKER_HOME/Config/LibreTranslate/prep.sh +./prep.sh ``` 2. If using a temporary location for `models/` such as `/tmp/`, ensure @@ -26,5 +26,6 @@ that `prep.sh` is in `root`'s crontab. 3. Start the container up as normal. ``` +cp docker-compose.main.yml docker-compose.yml docker compose up -d ``` diff --git a/Config/LibreTranslate/docker-compose.standard.yml b/Config/LibreTranslate/docker-compose.main.yml similarity index 93% rename from Config/LibreTranslate/docker-compose.standard.yml rename to Config/LibreTranslate/docker-compose.main.yml index 8c169d0..76bf908 100644 --- a/Config/LibreTranslate/docker-compose.standard.yml +++ b/Config/LibreTranslate/docker-compose.main.yml @@ -1,4 +1,4 @@ -# LibreTranslate configuration for a capable server. +# LibreTranslate configuration. # Example docker-compose.yml: # https://github.com/LibreTranslate/LibreTranslate/blob/main/docker-compose.yml @@ -51,5 +51,5 @@ services: mode: global resources: limits: - cpus: '2.00' - memory: 4G + cpus: $CPU + memory: $RAM diff --git a/Config/LibreTranslate/docker-compose.micro.yml b/Config/LibreTranslate/docker-compose.micro.yml deleted file mode 100644 index b0d439b..0000000 --- a/Config/LibreTranslate/docker-compose.micro.yml +++ /dev/null @@ -1,55 +0,0 @@ -# LibreTranslate configuration for a small-scale server (1 CPU, 1GB RAM). -# Example docker-compose.yml: -# https://github.com/LibreTranslate/LibreTranslate/blob/main/docker-compose.yml - -# Named volumes ensure that the container user gets the correct permissions. -volumes: - - libretranslate_api_keys: - driver: local - driver_opts: - type: none - device: $API_KEYS_DIR - o: bind - - libretranslate_models: - driver: local - driver_opts: - type: none - device: $MODELS_DIR - o: bind - -services: - - ## Main ## - lt-app: - container_name: lt-app - build: - context: ./ - network: host - restart: always - ports: - - "5000:5000" - # Uncomment this for logging in docker compose logs - tty: true - healthcheck: - test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py'] - command: --req-limit 100 --char-limit 2000 - environment: - # Allow the saving of API Keys. Requires volume libretranslate_api_keys. - - LT_API_KEYS=true - - LT_API_KEYS_DB_PATH=/app/db/api_keys.db - # Optimize loading time. Requires volume libretranslate_models. - - LT_UPDATE_MODELS=$UPDATE_MODELS - - LT_LOAD_ONLY=$LANGUAGES - volumes: - # Store the API keys. - - libretranslate_api_keys:/app/db - # Avoid re-downloading language models every reboot. - - libretranslate_models:/home/libretranslate/.local:rw - deploy: - mode: global - resources: - limits: - cpus: '0.25' - memory: 640M diff --git a/Config/LibreTranslate/env.example b/Config/LibreTranslate/env.example index f8a0141..f45906b 100644 --- a/Config/LibreTranslate/env.example +++ b/Config/LibreTranslate/env.example @@ -2,6 +2,19 @@ COMPOSE_BAKE=true +### Container Specs ### + +## For a small-scale server (such as 1 CPU, 1GB RAM). +CPU_MINIMAL=0.25 +RAM_MINIMAL=640M + +## For a fully capable server. +CPU_RECOMMENDED=2.00 +RAM_RECOMMENDED=4.0G + +CPU=$CPU_RECOMMENDED +RAM=$RAM_RECOMMENDED + ### Languages ### ## Check for language model updates on each run.