# Running TubeHaus with Flisk (optional) **docker compose stays the main way to run TubeHaus** (README, *Quick start*). If you already use [Flisk](https://flisk.sh), the same three containers (Caddy, TubeHaus, bgutil) are also described as one small `service.json` each under [`services/tubehaus/`](../services/tubehaus). They read the same `.env`. Contributed by @odykyi in #40. Pick one of the two for a server, not both: they use the same ports and different volume names. ## Start You need Docker and Flisk 1.4.26 or later (`npm install -g @flisk-sh/flisk`; `flisk doctor` checks the rest). ```sh git clone https://github.com/biolend83/tubehaus && cd tubehaus cp .env.example .env # set your domain, as for docker compose flisk up ``` | docker compose | Flisk | |---|---| | `docker compose ps` | `flisk status` | | `docker compose logs tubehaus` | `flisk logs --service tubehaus` | | `docker compose restart tubehaus` | `flisk restart tubehaus` | | `docker compose exec tubehaus python3 /app/server/tubehaus_server.py --doctor` | `flisk run tubehaus -- python3 /app/server/tubehaus_server.py --doctor` | | `docker compose down` | `flisk down` | Everything Flisk generates (`.tiltignore`, a root `package.json`, `shared-platform-engineering/`, `.autogenerated/`) is git-ignored. ## Differences from docker compose - **Caddy's host ports come from `.env`, the same as docker compose**: `TUBEHAUS_HTTP_BIND` (default 80) and `TUBEHAUS_HTTPS_BIND` (default 443), read in `services/tubehaus/caddy/service.json`. They hold a port or `address:port`. - Plain HTTP on a LAN: `TUBEHAUS_SITE=:80`, `TUBEHAUS_URL=http://192.168.1.10`. - Behind your own nginx/Traefik: set `TUBEHAUS_HTTP_BIND=127.0.0.1:8080` and `TUBEHAUS_HTTPS_BIND=127.0.0.1:8443` in `.env` before the first `flisk up`, or Caddy is reachable from the network and anyone could skip your proxy and its login. `flisk doctor` warns about any published address that is not `127.x`. - **Flisk starts its own router and a PostgreSQL** that TubeHaus doesn't use (PostgreSQL on 15432). The router's ports are picked at start and printed by `flisk up`: 8080/8443 with the default `.env` (Caddy holds 80 and 443), but 80/443 when Caddy is moved off them, as in the proxy setup above. If your own proxy needs 80 and 443, pin the router elsewhere: `FLISK_HTTP_PORT=8180 FLISK_HTTPS_PORT=8543 flisk up` (set them in the shell: Flisk does not read these two from `.env`). - **The volumes get a prefix**: `tubehaus-tubehaus-autogenerated_tubehaus-data` and so on (`docker volume ls`). A docker compose install's data isn't picked up by itself; see below. - To build the TubeHaus image yourself, replace `"image": "ghcr.io/biolend83/tubehaus:latest"` in `services/tubehaus/tubehaus/service.json` with `"buildContext": "../../.."` and `"dockerfile": "Dockerfile"`. - `deploy/docker-compose.public.yml` (a public instance with log limits and the Anubis check) has no Flisk version. ## Update ```sh git pull flisk down for image in ghcr.io/biolend83/tubehaus:latest brainicism/bgutil-ytdlp-pot-provider caddy:2; do docker pull "$image" done flisk up ``` Backups: the same volumes as in [UPGRADING.md](UPGRADING.md), with the prefix above, e.g. `docker cp tubehaus-tubehaus-autogenerated-tubehaus-1:/data/ytlib.json ./ytlib-backup.json`. Settings → Library → Export in the web page works the same either way. ## Moving a docker compose install to Flisk ```sh cd tubehaus docker compose down # never add -v: that deletes the volumes ``` If you ran behind your own proxy, change Caddy's ports first (above). Then copy each volume to its new name. The old names start with your Compose project name (the folder name, `tubehaus` if you cloned it that way; `docker volume ls` shows them): ```sh ( old_prefix=tubehaus_ new_prefix=tubehaus-tubehaus-autogenerated_ for v in tubehaus-data warp-data caddy-data; do # a wrong prefix would make docker create an empty volume instead of failing, so check the source first docker volume inspect "${old_prefix}${v}" > /dev/null || exit 1 docker volume create "${new_prefix}${v}" > /dev/null || exit 1 docker run --rm --mount "type=volume,src=${old_prefix}${v},dst=/from,readonly" --mount "type=volume,src=${new_prefix}${v},dst=/to" alpine cp -a /from/. /to/ || exit 1 done ) && flisk up ``` The old volumes stay as they are, so going back is `flisk down` then `docker compose up -d`. Remove them with `docker volume rm tubehaus_` once the Flisk setup works.