diff --git a/libretranslate/data/api_keys/.gitkeep b/libretranslate/data/api_keys/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/libretranslate/data/models/.gitkeep b/libretranslate/data/models/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/libretranslate/docker-compose.yml b/libretranslate/docker-compose.yml new file mode 100644 index 00000000..7d13e6ea --- /dev/null +++ b/libretranslate/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3.7" + +services: + app_proxy: + environment: + APP_HOST: libretranslate_main_1 + APP_PORT: 5000 + PROXY_AUTH_ADD: "false" + main: + image: libretranslate/libretranslate:v1.5.7@sha256:f2ac0b1944da971b3bf1344ec02842800883f2046cdefa868d7dc46a9dff6ed8 + restart: on-failure + + ## Log to docker compose logs. This allows you to see the model download progress when first installing. + tty: true + healthcheck: + test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py'] + ## Uncomment above command and define your args if necessary + # command: --ssl --ga-id MY-GA-ID --req-limit 100 --char-limit 500 + ## Uncomment this section and the libretranslate_api_keys volume if you want to backup your API keys + environment: + - LT_API_KEYS=true + - LT_API_KEYS_DB_PATH=/app/db/api_keys.db # Same result as `db/api_keys.db` or `./db/api_keys.db` + ## Uncomment these vars and libretranslate_models volume to optimize loading time. + - LT_UPDATE_MODELS=true + ## - LT_LOAD_ONLY=en,fr + volumes: + - ${APP_DATA_DIR}/data/api_keys:/app/db + - ${APP_DATA_DIR}/data/models:/home/libretranslate/.local:rw diff --git a/libretranslate/hooks/pre-start b/libretranslate/hooks/pre-start new file mode 100755 index 00000000..872fac86 --- /dev/null +++ b/libretranslate/hooks/pre-start @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +# We're forced to run as user/group 1032: https://github.com/LibreTranslate/LibreTranslate/blob/f7a35db05b3ac7fcd40489faa7da827b03354faf/docker/Dockerfile#L28-L33 +# So we set the owner of the data directories to 1032:1032 +APP_DATA_DIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)/data" + +DESIRED_OWNER="1032:1032" + +API_KEYS_DATA_DIR="${APP_DATA_DIR}/api_keys" +MODELS_DATA_DIR="${APP_DATA_DIR}/models" + +set_permissions() { + local -r path="${1}" + + if [[ -d "${path}" ]]; then + owner=$(stat -c "%u:%g" "${path}") + + if [[ "${owner}" != "${DESIRED_OWNER}" ]]; then + chown "${DESIRED_OWNER}" "${path}" + fi + fi +} + +set_permissions "${API_KEYS_DATA_DIR}" +set_permissions "${MODELS_DATA_DIR}" \ No newline at end of file diff --git a/libretranslate/umbrel-app.yml b/libretranslate/umbrel-app.yml new file mode 100644 index 00000000..afc7d901 --- /dev/null +++ b/libretranslate/umbrel-app.yml @@ -0,0 +1,29 @@ +manifestVersion: 1.1 +id: libretranslate +category: ai +name: LibreTranslate +version: "1.5.7" +tagline: Free and Open Source machine translation API +description: >- + ⚠️ This app may take up to 10 minutes or more to become accessible after installation, depending on your hardware and internet connection. LibreTranslate must first download around 10 GB of translation models in the background before the UI becomes available. Please be patient. + + + LibreTranslate is a free and Open Source Machine Translation API, entirely self-hosted. + Unlike other APIs, it doesn't rely on proprietary providers such as Google or Azure to perform translations. + Instead, its translation engine is powered by the open source Argos Translate library. + +developer: LibreTranslate Contributors +website: https://libretranslate.com +dependencies: [] +repo: https://github.com/LibreTranslate/LibreTranslate +support: https://github.com/LibreTranslate/LibreTranslate/discussions +port: 7017 +gallery: + - 1.jpg + - 2.jpg + - 3.jpg +path: "" +defaultUsername: "" +defaultPassword: "" +submitter: highghlow +submission: https://github.com/getumbrel/umbrel/pull/1040