Files
truf-server/docs/remote-worker-cheatsheet-docker-ru.md
2026-09-30 20:30:56 +03:00

78 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TRUF worker: шпаргалка Docker
Откройте Bash или PowerShell в корне bundle с `compose.yaml`, worker image archive
и helper scripts. Нужен Docker Engine с Compose v2 либо Docker Desktop.
## Один раз
Создайте локальный `worker-install.yaml` через текстовый редактор:
```yaml
server: https://pregnant.horsecock.store
token: PASTE_DEVICE_TOKEN_HERE
parallelism: 1
```
Bash:
```sh
chmod 600 ./worker-install.yaml
chmod 700 ./workerctl.sh
docker load -i truf-worker-linux-x86_64.tar.gz
docker compose run --rm -T worker install --config - < ./worker-install.yaml
rm -- ./worker-install.yaml
docker compose run --rm worker doctor --json
```
PowerShell:
```powershell
docker load -i .\truf-worker-linux-x86_64.tar.gz
Get-Content -Raw .\worker-install.yaml |
docker compose run --rm -T worker install --config -
Remove-Item -LiteralPath .\worker-install.yaml
docker compose run --rm worker doctor --json
```
## Каждый день
Bash:
```sh
docker compose up -d
./workerctl.sh status
./workerctl.sh attach --follow-seconds 300
./workerctl.sh watch --follow-seconds 300
./workerctl.sh stop --timeout 120 --json
docker compose down
```
PowerShell:
```powershell
docker compose up -d
.\workerctl.ps1 status
.\workerctl.ps1 attach --follow-seconds 300
.\workerctl.ps1 watch --follow-seconds 300
.\workerctl.ps1 stop --timeout 120 --json
docker compose down
```
`q` или `Ctrl-C` отсоединяет `attach`/`watch`, но не останавливает worker.
`docker compose down` без `--volumes` сохраняет identity, token, незавершённую
работу и history в `truf-worker-data`.
## Диагностика
```sh
./workerctl.sh status --json
./workerctl.sh logs --tail 200
./workerctl.sh logs --follow --follow-seconds 300
./workerctl.sh history --limit 50
./workerctl.sh doctor --json
```
Не используйте `docker compose down --volumes`. Clean stop должен вернуть
`state: stopped`, `drained: true`, `exit_code: 0`; только после этого выполняйте
`docker compose down`.