1 Commits
Author SHA1 Message Date
renovate-bot 0acd5b404d Add renovate.json 2026-09-27 20:12:08 +00:00
7 changed files with 18 additions and 171 deletions
+2 -8
View File
@@ -7,12 +7,6 @@ FRONTEND_TITLE="LibreTranslate"
# Choosing only some languages will drastically improve the time to download and update models
# For language options see https://www.argosopentech.com/argospm/index/
# Use the syntax from this example: "en,es,pt"
LANG="All"
LANG="all"
API_KEYS="True"
REQUIRE_API_KEY="True"
DISABLE_WEB_UI="False"
METRICS="False"
SECRET_METRICS_AUTH_TOKEN_VERSION=v1
API_KEYS="true"
+3 -48
View File
@@ -1,10 +1,10 @@
# LibreTranslate
# libretranslate
> Free and Open Source Machine Translation API. Self-hosted, offline capable and easy to setup.
<!-- metadata -->
* **Maintainer**: [brooke](https://git.coopcloud.tech/Brooke)
* **Maintainer**:
* **Category**: Apps
* **Status**: 0
* **Image**: [`libretranslate`](https://hub.docker.com/r/libretranslate/libretranslate), 4, upstream
@@ -12,7 +12,7 @@
* **Backups**: No
* **Email**: No
* **Tests**: No
* **SSO**: N/A
* **SSO**: No
<!-- endmetadata -->
@@ -23,48 +23,3 @@
* `abra app deploy <app-name>`
For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech).
## API Keys
Below is a list of commands you can use to generate/remove/view API keys. prefix any of the below commands with `abra app cmd <app-domain> app`
```sh
# Add a key (120 requests/minute by default)
key_add
# Add a key with a custom rate limit
key_add 60
# Add a key with a character limit
key_add 120 5000
# Remove a key
key_remove "api-key"
# View all keys
keys_view
```
## Metrics
Metrics are exported Prometheus-compatible, in this recipe they also require a key.
Once you set `METRICS` to `true` you can use `https://<app-domain>/metrics` in your `prometheus.yml` and `SECRET_METRICS_AUTH_TOKEN` which was generated when you setup the app.
## Selecting Languages
By default [all available languages](https://www.argosopentech.com/argospm/index/) are loaded. Even though the Argo Translate models are very efficient they are too large to include in the image.
Expect `All` languages to take up between 8-10 GB of storage space. Depending on the host this can take between 10-20 minutes to setup.
If you choose to load languages individually keep in mind there's no one "language file" each Argos model is a from *and* to model. So, if you set `LANG` to `en,es` you will need both the *from* `es` and *to* `es` model files. So two languages will require two model files, 3 languages will require 6 model files.
## Backups
Backups only preserve API keys for the purpose of ensuring authentication stays consistent across restorations.
## Further reading
Please refer to https://docs.libretranslate.com/
For an incomplete list of projects that the LibreTranslate API will work with see https://docs.libretranslate.com/guides/integrations/
+2 -25
View File
@@ -1,25 +1,2 @@
#!/bin/bash
export ENTRYPOINT_VERSION=v6
export PYTHONWARNINGS="ignore"
key_add() {
REQUESTS_PER_MINUTE=${1:-120}
CHAR_LIMIT=${2:-}
if [ -n "$CHAR_LIMIT" ]; then
ltmanage keys add "$REQUESTS_PER_MINUTE" --char-limit "$CHAR_LIMIT"
else
ltmanage keys add "$REQUESTS_PER_MINUTE"
fi
}
key_remove() {
API_KEY=$1
ltmanage keys remove "$API_KEY"
}
keys_view() {
ltmanage keys
}
# Set any config versions here
# Docs: https://docs.coopcloud.tech/maintainers/handbook/#manage-configs
+5 -28
View File
@@ -5,13 +5,6 @@ services:
networks:
- proxy
tty: true
configs:
- source: entrypoint
target: /app/scripts/custom-entrypoint.sh
mode: 0555
secrets:
- source: metrics_auth_token
mode: 0444
deploy:
restart_policy:
condition: on-failure
@@ -25,46 +18,30 @@ services:
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.scheme=https"
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.permanent=true"
## When you're ready for release, run "abra recipe sync <name>" to set this
- "coop-cloud.${STACK_NAME}.version=1.1.0+v1.9.6"
- "coop-cloud.${STACK_NAME}.version=0.1.0+v1.9.6"
## Enable backups: https://docs.coopcloud.tech/maintainers/handbook/#how-do-i-configure-backuprestore
- "backupbot.backup=true"
- "backupbot.backup.volumes.libretranslate_api_keys=true"
healthcheck:
test: ["CMD-SHELL", "./venv/bin/python scripts/healthcheck.py"]
test: ['CMD-SHELL', './venv/bin/python scripts/healthcheck.py']
interval: 10s
timeout: 4s
retries: 4
start_period: 5s
entrypoint: /app/scripts/custom-entrypoint.sh
environment:
- LT_FRONTEND_TITLE=${FRONTEND_TITLE}
- LT_API_KEYS=${API_KEYS}
- LT_UNDER_ATTACK=${REQUIRE_API_KEY}
- LT_DISABLE_WEB_UI=${DISABLE_WEB_UI}
- LT_METRICS=${METRICS}
- LT_API_KEYS_DB_PATH=/app/db/api_keys.db
- LT_UPDATE_MODELS=true
- LT_LOAD_ONLY=${LANG}
- ARGOS_CHUNK_TYPE=MINISBD
volumes:
- libretranslate_api_keys:/app/db
- libretranslate_models:/home/libretranslate/.local:rw
secrets:
metrics_auth_token:
networks:
proxy:
external: true
name: ${STACK_NAME}_metrics_auth_token_${SECRET_METRICS_AUTH_TOKEN_VERSION}
configs:
entrypoint:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang
volumes:
libretranslate_api_keys:
libretranslate_models:
networks:
proxy:
external: true
libretranslate_models:
-61
View File
@@ -1,61 +0,0 @@
#!/bin/bash
__dirname=$(cd "$(dirname "$0")"; pwd -P)
cd "${__dirname}/.."
echo ""
echo "░█░░░▀█▀░█▀▄░█▀▄░█▀▀░▀█▀░█▀▄░█▀█░█▀█░█▀▀░█░░░█▀█░▀█▀░█▀▀"
echo "░█░░░░█░░█▀▄░█▀▄░█▀▀░░█░░█▀▄░█▀█░█░█░▀▀█░█░░░█▀█░░█░░█▀▀"
echo "░▀▀▀░▀▀▀░▀▀░░▀░▀░▀▀▀░░▀░░▀░▀░▀░▀░▀░▀░▀▀▀░▀▀▀░▀░▀░░▀░░▀▀▀"
echo "v$(cat VERSION)"
echo ""
echo Booting...
touch /tmp/booting.flag
export PYTHONWARNINGS="ignore"
if [[ -f ./venv/bin/libretranslate ]]; then
LT_POWERCYCLE=1 ./venv/bin/libretranslate "$@"
else
echo "WARNING: Cannot powercycle LibreTranslate (if you are in development mode, that's fine..)"
fi
rm -f /tmp/booting.flag
eval $(./venv/bin/python ./scripts/print_args_env.py "$@")
if [[ $LT_HOST == "127.0.0.1" ]]; then
# Default
BIND_ADDR="0.0.0.0"
if [[ -f /proc/sys/net/ipv6/conf/all/disable_ipv6 ]]; then
IPV6_STATUS=$(cat /proc/sys/net/ipv6/conf/all/disable_ipv6)
if [[ $IPV6_STATUS -eq 0 ]]; then
BIND_ADDR="[::]"
fi
fi
else
BIND_ADDR="$LT_HOST"
fi
# Do not update models when workers restart
unset LT_UPDATE_MODELS
unset FORCE_UPDATE_MODELS
# Setup prometheus metrics db
export PROMETHEUS_MULTIPROC_DIR=$(realpath "${__dirname}/../db/prometheus")
if [[ -e "$PROMETHEUS_MULTIPROC_DIR" ]]; then
find "$PROMETHEUS_MULTIPROC_DIR" -name '*.db' -delete
else
mkdir -p "$PROMETHEUS_MULTIPROC_DIR"
fi
export OMP_NUM_THREADS=1
if [ -f /run/secrets/metrics_auth_token ]; then
export LT_METRICS_AUTH_TOKEN=$(cat /run/secrets/metrics_auth_token)
else
echo "Metrics secret not found, skipping."
fi
./venv/bin/gunicorn -c scripts/gunicorn_conf.py --workers $LT_THREADS --max-requests 250 --timeout ${LT_TIMEOUT:-2400} --bind $BIND_ADDR:$LT_PORT 'wsgi:app()'
-1
View File
@@ -1 +0,0 @@
fixed: warnings cluttering output when attempting to run abra cmd
+6
View File
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}