Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(auth): make multiuser mode the default (#10316)
Lincoln Steineb480691a931
diff --git a/docker/.env.sample b/docker/.env.sampleindex 7b10af936e..15a2cb1214 100644--- a/docker/.env.sample+++ b/docker/.env.sample@@ -19,8 +19,12 @@## INVOKEAI_PORT is the port on which the InvokeAI web interface will be available# INVOKEAI_PORT=9090-## GPU_DRIVER can be set to either `cuda` or `rocm` to enable GPU support in the container accordingly.-# GPU_DRIVER=cuda #| rocm+## HOST_INVOKEAI_IP selects the Docker host interface that publishes the port.+## Create the first administrator on loopback before setting this to the host's LAN IP.+# HOST_INVOKEAI_IP=127.0.0.1++## GPU_DRIVER selects the Compose service: cuda (default), rocm or cpu.+# GPU_DRIVER=cuda## If you are using ROCM, you will need to ensure that the render group within the container and the host system use the same group ID.## To obtain the group ID of the render group on the host system, run `getent group render` and grab the number.diff --git a/docker/README.md b/docker/README.mdindex 6a740378f3..db3cb079e0 100644--- a/docker/README.md+++ b/docker/README.md@@ -8,12 +8,14 @@ First things first:## Quickstart-No `docker compose`, no persistence, single command, using the official images:+Choose the command for your GPU. New installations store accounts, images and models in the `invokeai-data` Docker volume. For an existing installation, replace `invokeai-data` with the volume name or absolute host directory that holds your InvokeAI data.+If your data lives inside the old container, [recover it before replacing the container](https://v7.invoke.ai/configuration/docker/#recover-data-before-replacing-a-container).**CUDA (NVIDIA GPU):**```bash-docker run --runtime=nvidia --gpus=all --publish 9090:9090 ghcr.io/invoke-ai/invokeai+docker run --runtime=nvidia --gpus=all --volume invokeai-data:/invokeai \+ --publish 127.0.0.1:9090:9090 ghcr.io/invoke-ai/invokeai```**ROCm (AMD GPU):**@@ -21,27 +23,18 @@ docker run --runtime=nvidia --gpus=all --publish 9090:9090 ghcr.io/invoke-ai/inv```bashdocker run --device /dev/kfd --device /dev/dri \--env RENDER_GROUP_ID=$(getent group render | cut -d: -f3) \- --publish 9090:9090 ghcr.io/invoke-ai/invokeai:main-rocm+ --volume invokeai-data:/invokeai --publish 127.0.0.1:9090:9090 ghcr.io/invoke-ai/invokeai:main-rocm````RENDER_GROUP_ID` must match the host's `render` group. Without it, Invoke can't access the GPU.-Open `http://localhost:9090` in your browser once the container finishes booting, install some models, and generate away!--### Data persistence--To persist your generated images and downloaded models outside of the container, add a `--volume/-v` flag to the above command, e.g.:--```bash-docker run --volume /some/local/path:/invokeai {...etc...}-```--`/some/local/path/invokeai` will contain all your data.-It can *usually* be reused between different installs of Invoke. Tread with caution and read the release notes!+Open `http://localhost:9090` on the Docker host and create the administrator account before giving other people access. Anyone who can reach a fresh installation can claim this account. If Docker runs on a remote host, run `ssh -N -L 127.0.0.1:9090:127.0.0.1:9090 user@docker-host` from your computer with your SSH login and host, then open the same URL locally.## Customize the container-The included `run.sh` script is a convenience wrapper around `docker compose`. It can be helpful for passing additional build arguments to `docker compose`. Alternatively, the familiar `docker compose` commands work just as well.+The included `run.sh` script passes build arguments to `docker compose` and checks the data mount before replacing a ROCm container. If you use Compose directly for a ROCm upgrade, [check the old container's data mount](https://v7.invoke.ai/configuration/docker/#recover-data-before-replacing-a-container) before running `up`, `down` or `rm`. Older containers may hold the only copy of your data in their writable layer.++For a new installation:```bashcd docker@@ -50,7 +43,11 @@ cp .env.sample .env./run.sh```-It will take a few minutes to build the image the first time. Once the application starts up, open `http://localhost:9090` in your browser to invoke!+Compose publishes the port on the Docker host's loopback address by default. Once the image builds and Invoke starts, open `http://localhost:9090` on the host or through the SSH tunnel above to create the administrator.++To share the installation after setup, keep multi-user mode enabled. Set `HOST_INVOKEAI_IP` in `.env` to the host's LAN IP and run `./run.sh` again with the same data directory. For `docker run`, recreate the container with the volume containing your administrator and replace `127.0.0.1` in the port mapping with the host's LAN IP. If you use a reverse proxy, enable its route to Invoke only after setup.++**Updating an existing Compose setup:** Compose publishes the port on `127.0.0.1` unless `HOST_INVOKEAI_IP` is set, so after you update, other devices can no longer connect. Create the administrator on the host first. Then set `HOST_INVOKEAI_IP` in `.env` to the host's LAN IP, or `0.0.0.0` for every interface, and run `./run.sh` again.>[!TIP]>When using the `run.sh` script, the container will continue running after Ctrl+C. To shut it down, use the `docker compose down` command.diff --git a/docker/docker-compose.yml b/docker/docker-compose.ymlindex 2e5bc91f26..56bd2ae4db 100644--- a/docker/docker-compose.yml+++ b/docker/docker-compose.yml@@ -12,12 +12,12 @@ x-invokeai: &invokeai- .env# variables without a default will automatically inherit from the host environment- environment:+ environment: &invokeai-environment# if set, CONTAINER_INVOKEAI_ROOT will override the Invoke runtime directory location *inside* the container- - INVOKEAI_ROOT=${CONTAINER_INVOKEAI_ROOT:-/invokeai}- - HF_HOME+ INVOKEAI_ROOT: ${CONTAINER_INVOKEAI_ROOT:-/invokeai}+ HF_HOME:ports:- - "${INVOKEAI_PORT:-9090}:${INVOKEAI_PORT:-9090}"+ - "${HOST_INVOKEAI_IP:-127.0.0.1}:${INVOKEAI_PORT:-9090}:${INVOKEAI_PORT:-9090}"volumes:- type: bindsource: ${HOST_INVOKEAI_ROOT:-${INVOKEAI_ROOT:-~/invokeai}}@@ -48,8 +48,9 @@ services:invokeai-rocm:<<: *invokeaienvironment:- - AMD_VISIBLE_DEVICES=all- - RENDER_GROUP_ID=${RENDER_GROUP_ID}+ <<: *invokeai-environment+ AMD_VISIBLE_DEVICES: all+ RENDER_GROUP_ID: ${RENDER_GROUP_ID}runtime: amdprofiles:- rocmdiff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.shindex 12f24a9352..9250867e98 100755--- a/docker/docker-entrypoint.sh+++ b/docker/docker-entrypoint.sh@@ -36,14 +36,26 @@ fi# We do not install openssh-server in the image by default to avoid bloat.# but it is useful to have the full SSH server e.g. on Runpod.# (use SCP to copy files to/from the image, etc)-if [[ -v "PUBLIC_KEY" ]] && [[ ! -d "${HOME}/.ssh" ]]; then- apt-get update- apt-get install -y openssh-server- pushd "$HOME"- mkdir -p .ssh- echo "${PUBLIC_KEY}" >.ssh/authorized_keys- chmod -R 700 .ssh- popd+if [[ "${PUBLIC_KEY:-}" =~ [^[:space:]] ]]; then+ authorized_keys="${HOME}/.ssh/authorized_keys"+ # Only append missing PUBLIC_KEY lines: keys added from a session must survive restarts.+ (+ umask 077+ mkdir -p "${HOME}/.ssh"+ # read trims surrounding spaces and tabs; CRs from Windows pastes are dropped first.+ while read -r key; do+ if [[ -n "$key" ]] && ! grep -Fxqs -- "$key" "$authorized_keys"; then+ if [[ -n "$(tail -c1 "$authorized_keys" 2>/dev/null)" ]]; then+ echo >>"$authorized_keys"+ fi+ printf '%s\n' "$key" >>"$authorized_keys"+ fi+ done <<<"${PUBLIC_KEY//$'\r'/}"+ )+ if ! command -v sshd >/dev/null; then+ apt-get update+ apt-get install -y openssh-server+ fiservice ssh startfidiff --git a/docker/run.sh b/docker/run.shindex 272d4e44a5..ffc72df640 100755--- a/docker/run.sh+++ b/docker/run.sh@@ -1,6 +1,27 @@#!/usr/bin/env bashset -e -o pipefail+check_rocm_data_mount() {+ local containers container mounted+ # Older ROCm services could write to a host path interpreted inside the container.+ local check_mount='+ {{- range .Mounts}}+ {{- if or (eq .Type "bind") (eq .Type "volume")}}+ {{- $setting := printf "INVOKEAI_ROOT=%s" .Destination}}+ {{- range $.Config.Env}}{{if eq . $setting}}mounted{{end}}{{end}}+ {{- end}}+ {{- end}}'+ containers=$(docker compose --profile rocm ps --all --quiet invokeai-rocm)+ for container in $containers; do+ mounted=$(docker inspect --format "$check_mount" "$container")+ if [[ "$mounted" != "mounted" ]]; then+ printf 'Container %s has no verified data mount at its INVOKEAI_ROOT. Recreating it could delete your data.\n' "$container" >&2+ printf '%s\n' 'Recover the data first: https://v7.invoke.ai/configuration/docker/#recover-data-before-replacing-a-container' >&2+ return 1+ fi+ done+}+run() {local scriptdir=$(dirname "${BASH_SOURCE[0]}")cd "$scriptdir" || exit 1@@ -13,13 +34,17 @@ run() {# parse .env file for build argsbuild_args=$(awk '$1 ~ /=[^$]/ && $0 !~ /^#/ {print "--build-arg " $0 " "}' .env) &&- profile="$(awk -F '=' '/GPU_DRIVER=/ {print $2}' .env)"+ profile="$(awk -F '=' '$1 == "GPU_DRIVER" {profile=$2} END {print profile}' .env)"# default to 'cuda' profile[[ -z "$profile" ]] && profile="cuda"local service_name="invokeai-$profile"+ if [[ "$profile" == "rocm" ]]; then+ check_rocm_data_mount+ fi+if [[ ! -z "$build_args" ]]; thenprintf "%s\n" "docker compose build args:"printf "%s\n" "$build_args"diff --git a/docker/runpod-readme.md b/docker/runpod-readme.mdindex c464480d46..dc7f6d252e 100644--- a/docker/runpod-readme.md+++ b/docker/runpod-readme.md@@ -12,12 +12,13 @@ Your working directory is mounted under the `/workspace` path inside the pod. Th## Quickstart-1. Launch a pod from this template. **It will take about 5-10 minutes to run through the initial setup**. Be patient.-1. Wait for the application to load.- - TIP: you know it's ready when the CPU usage goes idle- - You can also check the logs for a line that says "_Point your browser at..._"-1. Open the Invoke AI web UI: click the `Connect` => `connect over HTTP` button.-1. Generate some art!+1. Before launching, choose a pod with a public IP for SSH. In the template's port settings, clear the exposed HTTP ports and expose only TCP port 22. Anyone who can reach InvokeAI on a fresh installation can claim the first administrator account.+2. Set the pod's `PUBLIC_KEY` environment variable to your SSH **public** key so that the image starts its SSH server. Set `INVOKEAI_ROOT=/workspace/invokeai` so the administrator account persists on the volume. Launch the pod and wait for InvokeAI to start.+3. In the pod's **Connect** tab, copy the **SSH over exposed TCP** command. Insert `-N -L 127.0.0.1:9090:127.0.0.1:9090` immediately after `ssh` and run it on your computer. Leave that terminal open. See [RunPod's full SSH setup](https://docs.runpod.io/pods/configuration/use-ssh).+4. Open `http://localhost:9090` on your computer, create the administrator account and sign in.+5. Keep using the tunnel for private access. If you want to share InvokeAI through the pod's HTTP proxy, enable HTTP port 9090 only after setup, with multi-user mode enabled and the same `/workspace/invokeai` volume attached.++`PUBLIC_KEY` can hold several keys, one per line. On every start, each key that is not already a line of `/root/.ssh/authorized_keys` is appended to it. Existing lines are never changed or removed, so to retire a key, delete its line from that file in an SSH session and remove it from `PUBLIC_KEY`.## Other things you can do@@ -57,4 +58,4 @@ invoke --web --host 0.0.0.0 --no-nsfw_checker----Template ©2023 Eugene Brodsky [ebr](https://github.com/ebr)\ No newline at end of file+Template ©2023 Eugene Brodsky [ebr](https://github.com/ebr)diff --git a/docs/src/content/docs/Users Guide/02.Projects/introduction.mdx b/docs/src/content/docs/Users Guide/02.Projects/introduction.mdxindex 2bf08aba14..492727a4f4 100644--- a/docs/src/content/docs/Users Guide/02.Projects/introduction.mdx+++ b/docs/src/content/docs/Users Guide/02.Projects/introduction.mdx@@ -1,7 +1,7 @@---title: Working with Projectsdescription: Keep each piece of work in its own project, with its canvas, workflows, layout and boards, and switch between them without losing your place.-lastUpdated: 2026-10-08+lastUpdated: 2026-11-20sidebar:order: 0---@@ -38,7 +38,7 @@ Undo history is not saved. It lasts only while the project is open in your brows## Starting a project-The **Home** page is the first thing you see when Invoke opens. It shows the project you edited most recently under **Pick up where you left off**, a row of **Recent projects** with your pinned projects first, and tiles for starting something new. If your projects cannot be loaded, Home and **Projects** say so with a **Retry** button instead of showing an empty library.+The **Home** page is the first thing you see when Invoke opens, after you sign in. It shows the project you edited most recently under **Pick up where you left off**, a row of **Recent projects** with your pinned projects first, and tiles for starting something new. If your projects cannot be loaded, Home and **Projects** say so with a **Retry** button instead of showing an empty library.To skip Home, set **On startup, open** to **Most recent project** in Settings (**Behavior**). Invoke then reopens the projects you had open, or the project you edited last if you had none open. A link to a specific page still opens that page. While it opens them, the loading screen offers **Stay on the Launchpad**. If that work did not finish opening the last time Invoke started, Invoke opens the Launchpad instead, once, and says why, so a project that fails to open never traps every launch.diff --git a/docs/src/content/docs/configuration/01.invokeai-yaml.mdx b/docs/src/content/docs/configuration/01.invokeai-yaml.mdxindex 0af7fe60db..a5cb84df70 100644--- a/docs/src/content/docs/configuration/01.invokeai-yaml.mdx+++ b/docs/src/content/docs/configuration/01.invokeai-yaml.mdx@@ -49,6 +49,8 @@ InvokeAI searches for the root directory in this order:3. The directory containing the currently active virtual environment.4. Fallback: a directory in the current user's home directory named `invokeai`.+For a Launcher install, the root directory is the folder you installed Invoke into.+### InvokeAI Configuration FileInside the root directory, we read settings from the `invokeai.yaml` file.@@ -57,10 +59,10 @@ It has two sections - one for internal use and one for user settings:```yaml# Internal metadata - do not edit:-schema_version: 4.0.2+schema_version: 4.0.3# Put user settings here - see https://invoke.ai/configuration/invokeai-yaml/:-host: 0.0.0.0 # serve the app on your local network+host: 127.0.0.1 # serve the app on this computermodels_dir: D:\invokeai\models # store models on an external driveprecision: float16 # always use fp16 precision```@@ -69,6 +71,12 @@ The settings in this file will override the defaults. You only needto change this file if the default for a particular setting doesn'twork for you.+A new file gets `multiuser: true`. If an existing file has no `multiuser` line, InvokeAI adds the line `multiuser: true` to the end of the file when it starts. Nothing else in the file changes, so your comments and settings stay as you wrote them. If the file is read-only, or the line cannot be added without changing how the file reads, InvokeAI leaves the file alone and logs a warning at every start. When InvokeAI saves the file, for example after you change settings in the UI or when it updates an older file, it writes the whole file again. It keeps the file's `multiuser` value, but comments you added are lost. Environment variables never change what is written.++The line matters if you go back to an older release: v6.12 to v7.0.0-beta.2 default to single-user mode, so without it they would start without sign-in. v6.13 and later read the file and keep sign-in on. v6.12 and earlier refuse to start with a file that v7 has updated; they need the `invokeai.yaml.bak` that v7 saved next to it at its first start. See [Upgrading to v7](/start-here/upgrading/#which-backup-to-restore).++To share InvokeAI on your network, [create the first administrator privately](/configuration/multi-user-mode/admin-guide/#set-up-multi-user-mode) before changing the host address.+You'll find an example file next to `invokeai.yaml` that shows the default values.Some settings, like [Model Marketplace API Keys], require the YAMLdiff --git a/docs/src/content/docs/configuration/02.docker.mdx b/docs/src/content/docs/configuration/02.docker.mdxindex 046bff6fc7..5d0cfa9b6c 100644--- a/docs/src/content/docs/configuration/02.docker.mdx+++ b/docs/src/content/docs/configuration/02.docker.mdx@@ -25,13 +25,19 @@ import SystemRequirementsLink from '@components/SystemRequirmentsLink.astro'## TL;DR-Ensure your Docker setup is able to use your GPU. The CUDA image needs an Nvidia driver from the R580 series or newer on the host and a GPU with compute capability 7.5 or newer (GTX 16xx, RTX 20xx and later). Then:+Ensure your Docker setup is able to use your GPU. The CUDA image needs an Nvidia driver from the R580 series or newer on the host and a GPU with compute capability 7.5 or newer (GTX 16xx, RTX 20xx and later).++These commands store your accounts, images and models in the `invokeai-data` Docker volume. For an existing installation, replace `invokeai-data` with the volume name or absolute host directory that holds your InvokeAI data.+If the data lives inside the old container, [recover it before replacing the container](#recover-data-before-replacing-a-container).```bash-docker run --runtime=nvidia --gpus=all --publish 9090:9090 ghcr.io/invoke-ai/invokeai+docker run --runtime=nvidia --gpus=all --volume invokeai-data:/invokeai \+ --publish 127.0.0.1:9090:9090 ghcr.io/invoke-ai/invokeai```-Once the container starts up, open [http://localhost:9090](http://localhost:9090) in your browser, install some models, and start generating.+Open [http://localhost:9090](http://localhost:9090) on the Docker host and create the administrator account. Anyone who can reach a fresh installation can claim this account, so keep the port on loopback and any reverse proxy route closed during setup. If Docker runs on a remote host, run `ssh -N -L 127.0.0.1:9090:127.0.0.1:9090 user@docker-host` from your computer with your SSH login and host, then open the same URL locally.++After creating the administrator, you can share the installation by recreating the container with the volume containing your account and replacing `127.0.0.1` in the port mapping with the host's LAN IP. Keep multi-user mode enabled and use [HTTPS for network access](/configuration/multi-user-mode/admin-guide/#https-and-internet-access).### AMD GPUs (ROCm)@@ -40,17 +46,53 @@ Use a `-rocm` image: `main-rocm`, or `<version>-rocm` for a release. Pass both G```bashdocker run --device /dev/kfd --device /dev/dri \--env RENDER_GROUP_ID=$(getent group render | cut -d: -f3) \- --publish 9090:9090 ghcr.io/invoke-ai/invokeai:main-rocm+ --volume invokeai-data:/invokeai --publish 127.0.0.1:9090:9090 ghcr.io/invoke-ai/invokeai:main-rocm```- `/dev/kfd` is the ROCm compute interface and `/dev/dri` holds the GPU's render nodes. Invoke needs both.- Invoke runs as an unprivileged user inside the container, and the devices keep their host group. The entrypoint adds that user to a `render` group with the ID from `RENDER_GROUP_ID`. Without it, PyTorch can't open the GPU and Invoke runs on the CPU.- The image includes kernels for every GPU that AMD's ROCm 10 PyTorch build supports (see [AMD](/start-here/system-requirements/#amd)). Those GPUs don't need `HSA_OVERRIDE_GFX_VERSION`.+### Recover data before replacing a container++If you ran InvokeAI without a volume, the container itself can hold your accounts and images. This also affects older ROCm Compose services where `INVOKEAI_ROOT` from `.env` became a path inside the container. For example, the service may have written data to `/srv/invoke` while Docker mounted the host directory at `/invokeai`.++For a ROCm Compose upgrade, check the old container **before** running `docker compose up`, `down` or `rm`. From the original Compose project directory, run:++```bash+docker compose --profile rocm ps --all invokeai-rocm+```++Use the old container's name below. Find the absolute runtime path in its startup log (`Root directory = ...`) and compare it with its mount destinations:++```bash+old_container=old-invokeai+docker logs "$old_container" 2>&1 | grep 'Root directory ='+docker inspect --format '{{range .Mounts}}{{println .Type .Source "->" .Destination}}{{end}}' "$old_container"+```++If the runtime path matches the destination of a `bind` or `volume` mount, reuse the same host directory or volume for the replacement. Otherwise, keep the old container and copy the actual runtime directory. For a container created without `--rm`, set `old_root` to the absolute path from the log and run these commands on the Docker host:++```bash+old_root=/srv/invoke+docker stop "$old_container" &&+ recovered_dir=$(mktemp -d "$PWD/invokeai-recovered.XXXXXX") &&+ docker cp "$old_container:$old_root/." "$recovered_dir"+```++Check the copy for your data, including `databases/invokeai.db` with the default SQLite settings. Mount it at **the same absolute path inside the replacement container** so absolute database and model paths under the old root still work. If databases, models or outputs lived outside the old root, recover or reattach those directories separately at their original paths. Keep any external database settings.++- For **`docker run`**, replace the quickstart's volume option with `--volume "$recovered_dir:$old_root" --env "INVOKEAI_ROOT=$old_root"`. Keep the loopback port mapping and GPU options.+- For **ROCm Compose**, set `HOST_INVOKEAI_ROOT` in `.env` to the absolute path printed by `echo "$recovered_dir"` and `CONTAINER_INVOKEAI_ROOT` to the old absolute runtime path (for example, `/srv/invoke`). Set `GPU_DRIVER=rocm`, `HOST_INVOKEAI_IP=127.0.0.1` and `COMPOSE_PROJECT_NAME` to a new, unused project name so the old container stays intact. Run `./run.sh` to build and start the ROCm image. Keep these settings on subsequent starts.++Check the replacement's startup log and mounts with the same commands above. Confirm the logged root is the original container path and its mount source is the recovered directory. If you already had an administrator, confirm you can sign in with that account. If your old installation had no administrator, complete first-time setup privately. Verify your images and other expected data before enabling network access.+## Build-It-YourselfAll the docker materials are located inside the [docker](https://github.com/invoke-ai/InvokeAI/tree/main/docker) directory in the Git repo.+For an existing ROCm installation, keep your `.env` file and [check the old data mount](#recover-data-before-replacing-a-container) before starting Compose. For a new installation:+```bashcd dockercp .env.sample .env@@ -79,23 +121,26 @@ The image includes the driver for a [MySQL or MariaDB database](/configuration/e| Environment Variable | Default value | Description || --- | --- | --- || `INVOKEAI_ROOT` | `~/invokeai` | **Required** - the location of your InvokeAI root directory. It will be created if it does not exist. |+| `HOST_INVOKEAI_IP` | `127.0.0.1` | Interface on the Docker host where Compose publishes the web port. || `HUGGING_FACE_HUB_TOKEN` | | InvokeAI will work without it, but some of the integrations with HuggingFace (like downloading from models from private repositories) may not work |-| `GPU_DRIVER` | `cuda` | Optionally change this to `rocm` to build the image for AMD GPUs, or `cpu` for CPU-only builds (required on ARM64 / `aarch64` hosts such as the Raspberry Pi 5). NOTE: Use the `build.sh` script to build the image for this to take effect. |+| `GPU_DRIVER` | `cuda` | Selects the image build and Compose service when using `./run.sh`. Use `rocm` for AMD GPUs or `cpu` for CPU-only builds (required on ARM64 / `aarch64` hosts such as the Raspberry Pi 5). || `RENDER_GROUP_ID` | | AMD GPUs only. The ID of the host's `render` group, from `getent group render`. Without it, Invoke can't access the GPU. |#### Build the ImageUse the standard `docker compose build` command from within the `docker` directory.-If using an AMD GPU:-a: set the `GPU_DRIVER=rocm` environment variable in `docker-compose.yml` and continue using `docker compose build` as usual, or-b: set `GPU_DRIVER=rocm` in the `.env` file and use the `build.sh` script, provided for convenience+For an AMD GPU, set `GPU_DRIVER=rocm` and the host's `RENDER_GROUP_ID` in `.env`, then run `./run.sh` to build and start the ROCm service.#### Run the ContainerUse the standard `docker compose up` command, and generally the `docker compose` [CLI](https://docs.docker.com/compose/reference/) as usual.-Once the container starts up (and configures the InvokeAI root directory if this is a new installation), you can access InvokeAI at [http://localhost:9090](http://localhost:9090)+Open [http://localhost:9090](http://localhost:9090) on the Docker host or through the SSH tunnel above to create the administrator. To share the installation after setup, set `HOST_INVOKEAI_IP` in `.env` to the host's LAN IP and rerun the command you used to start the service with the same data directory.++:::note[Updating an existing Compose setup]+The supplied Compose file publishes the port on `127.0.0.1` unless `HOST_INVOKEAI_IP` is set, so after you update, other devices can no longer connect. Create the administrator on the Docker host first. Then set `HOST_INVOKEAI_IP` in `.env` to the host's LAN IP, or `0.0.0.0` for every interface, and start the service again.+:::## Troubleshooting / FAQdiff --git a/docs/src/content/docs/configuration/03.external-database.mdx b/docs/src/content/docs/configuration/03.external-database.mdxindex f1a9cc4f34..f36239a984 100644--- a/docs/src/content/docs/configuration/03.external-database.mdx+++ b/docs/src/content/docs/configuration/03.external-database.mdx@@ -48,13 +48,15 @@ db_url: mariadb+pymysql://invokeai:[email protected]:3306/invokeaiUse `mysql+pymysql://` for MySQL and `mariadb+pymysql://` for MariaDB. Characters in the password that have a meaning in a URL (`@`, `:`, `/`, `%`, `#`) must be percent-encoded, e.g. `@` as `%40`. InvokeAI reads `db_url` when it starts, and shows it without the password in its settings. `db_dir` and `db_synchronous` apply to a SQLite database only.-On its first start InvokeAI creates the tables. On later starts it updates them to its version, as it does a SQLite database. It makes no backup of a server database before an update: back the database up yourself, e.g. with `mysqldump` or `mariadb-dump`, before upgrading InvokeAI.+For a **new installation**, follow the [private administrator setup instructions](/configuration/multi-user-mode/admin-guide/#set-up-multi-user-mode) before starting InvokeAI against the empty database. The database user in the SQL above is separate from the InvokeAI administrator. InvokeAI creates the tables at startup. Verify the database host and name in the startup log, create the first InvokeAI administrator privately and confirm sign-in before enabling network access.++For an **existing installation**, leave the target empty until you have copied the source database. On later starts InvokeAI updates the active database to its version. [Back it up before upgrading InvokeAI](/configuration/multi-user-mode/admin-guide/#backups).## Moving an existing install`invoke-db-copy` copies an install's SQLite database into a new, empty server database. It copies the database only: images, models and the other files stay where they are, in the root directory. The SQLite database is not changed.-1. Stop InvokeAI. What it writes during the copy is not copied.+1. Stop InvokeAI and [back up the installation](/configuration/multi-user-mode/admin-guide/#backups). If the SQLite database needs an update, leave `db_url` and `INVOKEAI_DB_URL` unset. [Start the upgraded release privately](/start-here/upgrading/#first-start-after-switching-databases) against the source SQLite file, verify the database and administrator, then stop InvokeAI again. Keep external routes closed through the copy.2. Set `db_url` in `invokeai.yaml` (or `INVOKEAI_DB_URL`) to the new database. Do not start InvokeAI yet: it would start the new database empty.3. Check the copy, which copies nothing yet:@@ -68,11 +70,11 @@ On its first start InvokeAI creates the tables. On later starts it updates theminvoke-db-copy```-5. Start InvokeAI.+5. [Start InvokeAI privately and verify the copied database](/start-here/upgrading/#first-start-after-switching-databases). Check that the startup log names the intended MySQL or MariaDB database and that administrator sign-in and the expected data are present before restoring network access.`invoke-db-copy` takes the install it runs in, or the one `--root` names, and copies into the database its `db_url` names. `--target URL` names another one; a password on the command line is visible to the other users of the computer and stays in the shell's history.-It copies from a snapshot of the SQLite database, which it makes in the database's directory and deletes afterwards: that needs free space as large as the database. It brings the snapshot to no newer version: if InvokeAI has not started since an upgrade, start it once first. The target must be empty, for the check too, and no InvokeAI process may use it.+It copies from a snapshot of the SQLite database, which it makes in the database's directory and deletes afterwards: that needs free space as large as the database. The target must be empty, for the check too, and no InvokeAI process may use it.It stops before copying anything when the server would refuse a row:@@ -90,15 +92,15 @@ After copying, `invoke-db-copy` compares every table of the copy with its source`invoke-db-copy --to-sqlite FILE` copies the server database back into a new SQLite file. Removing `db_url` alone is not a way back: InvokeAI then opens the SQLite database it used before the move, as it was then. The boards, image records, workflows and accounts made since are not in it, and the gallery no longer shows the images made since, although their files are in the outputs folder.-1. Stop InvokeAI. `invoke-db-copy` refuses to copy a database an InvokeAI process uses.+1. Stop InvokeAI and [back up the installation, including the server database](/configuration/multi-user-mode/admin-guide/#backups). If the source needs an update, keep `db_url` pointing at the server database, [start the upgraded release privately](/start-here/upgrading/#first-start-after-switching-databases), verify the database and administrator, then stop InvokeAI again. Keep external routes closed through the copy. `invoke-db-copy` refuses to copy a server database an InvokeAI process uses.2. Copy into a new file:```bashinvoke-db-copy --to-sqlite invokeai-from-server.db```-3. In the install's database directory (`db_dir`, by default `databases` in the root), rename `invokeai.db`, which holds the state before the move, and put the new file in its place, named `invokeai.db`.-4. Remove `db_url` from `invokeai.yaml`, and `INVOKEAI_DB_URL` from the environment, and start InvokeAI.+3. In the install's database directory (`db_dir`, by default `databases` in the root), move the previous `invokeai.db` and any matching `invokeai.db-wal` and `invokeai.db-shm` together to a separate backup directory. Put the new file in place as `invokeai.db`.+4. Remove `db_url` from `invokeai.yaml` and `INVOKEAI_DB_URL` from the environment. [Start InvokeAI privately and verify the copied database](/start-here/upgrading/#first-start-after-switching-databases). Check the active SQLite path, administrator sign-in and the data you expect from the server database before restoring network access.The source is the database `db_url` names, unless `--source URL` names another; it is not changed. The new file appears only once every table matches its source, so a copy that fails leaves no file behind, and `invoke-db-copy` never overwrites an existing file. Ids continue as they did on the server: a queue item gets no id the server already gave out.@@ -107,4 +109,4 @@ The source is the database `db_url` names, unless `--source URL` names another;- **One InvokeAI process per database.** At startup a process cancels the queue items left running and updates its bundled workflows and style presets, which a second process would undo. The first process holds a lock on the database; a second one refuses to start. If a process ends without closing its connection, because its computer crashed or lost the network, the server releases its lock within ten minutes; the refusal names the query that finds the connection to end sooner with `KILL`.- **One database server.** Setups with several writing servers (Galera, group replication with several primaries) are not supported.- **Busy database.** When a request waits too long for a lock held by another, finds no free connection, or cannot reach the server, it fails with HTTP 503 and `Retry-After: 1`, and can be repeated. If this happens often, the server is overloaded or another program holds locks in InvokeAI's database.-- **Command-line tools.** The account commands (`invoke-useradd`, `invoke-userdel`, `invoke-usermod`, `invoke-userlist`) and the maintenance scripts use the database `invokeai.yaml` names. They refuse a database InvokeAI has not updated to their version: start InvokeAI once after an upgrade before using them.+- **Command-line tools.** The account commands (`invoke-useradd`, `invoke-userdel`, `invoke-usermod`, `invoke-userlist`) and the maintenance scripts use the configured database. They refuse a database InvokeAI has not updated to their version. After an upgrade, [start InvokeAI privately and verify the active database](/start-here/upgrading/#first-start-after-switching-databases) before using them.diff --git a/docs/src/content/docs/configuration/Multi-User Mode/admin-guide.mdx b/docs/src/content/docs/configuration/Multi-User Mode/admin-guide.mdxindex 3c7000b043..61a7cdd809 100644--- a/docs/src/content/docs/configuration/Multi-User Mode/admin-guide.mdx+++ b/docs/src/content/docs/configuration/Multi-User Mode/admin-guide.mdx@@ -1,7 +1,7 @@---title: Multi-User Administrator Guide-description: Turn on multi-user mode, manage accounts, and keep a shared InvokeAI server safe.-lastUpdated: 2026-10-26+description: Set up the first administrator, manage accounts, and keep a shared InvokeAI server safe.+lastUpdated: 2026-11-20sidebar:order: 4---@@ -26,30 +26,26 @@ There are two roles. Any number of accounts can be administrators.Roles are read from the database on every request, so promoting or demoting someone takes effect on their next action. See [When changes take effect](#when-changes-take-effect).-## Turn on multi-user mode+## Set up multi-user mode-<Steps>--1. **Back up.** Stop InvokeAI and copy the `databases` folder in your root directory. See [Backups](#backups).+Multi-user mode is on by default. See [Upgrading from single-user mode](#upgrading-from-single-user-mode) if your install predates this default.-2. **Edit `invokeai.yaml`** in your root directory and add `multiuser: true`. To let other computers on your network reach the server, also add `host: 0.0.0.0`:+<Steps>- ```yaml- multiuser: true- host: 0.0.0.0 # optional: listen on the network, not only this computer- strict_password_checking: true # optional: require strong passwords- ```+1. **Keep setup private.** Stop InvokeAI. On an existing install, [back up the installation](#backups). Disable any reverse proxy, tunnel or port forward that gives others access to InvokeAI. Configure [local-only access](#verify-local-only-access) for your installation. Anyone who can reach the setup page can create the first administrator.-3. **Start InvokeAI** from the launcher or with `invokeai-web`. With `host: 0.0.0.0`, other computers open `http://<server-address>:9090`.+2. **Start in multi-user mode.** Set `multiuser: true` in `invokeai.yaml` or use the default. Remove any `INVOKEAI_MULTIUSER=false` environment override. To require strong passwords, set `strict_password_checking: true`. Start InvokeAI, verify the listener as described below, then open `http://localhost:9090` on the server. On a remote server, use a private SSH tunnel to its loopback address.-4. **Create the first administrator.** The first browser to open InvokeAI shows **Set up Invoke**. Enter:+3. **Create the first administrator.** On **Set up Invoke**, enter:- **Email**: the sign-in name. It cannot be changed later. It must look like an email address, though `admin@localhost` also works; nothing is ever sent to it.- **Display name** (optional): shown to other users instead of the email.- **Password** and **Confirm password**.- Select **Create administrator account**, then sign in.+ Select **Create administrator account**, then sign in. If an administrator already exists, sign in with that account. If the installation has projects, wildcards, private prompt templates or private uploaded fonts from single-user mode, a **Your earlier work is kept** notice above the button links to [If you have already upgraded](#if-you-have-already-upgraded).++4. **Add the other users** from the Launchpad's **Users** page or with `invoke-useradd`. See [Manage users](#manage-users).-5. **Add the other users** from the Launchpad's **Users** page, or with `invoke-useradd`. See [Manage users](#manage-users).+5. **Enable network access if needed.** After confirming administrator sign-in, configure [HTTPS](#https-and-internet-access) and enable the intended network route. With a reverse proxy on the same host, keep InvokeAI on loopback. For a direct LAN connection, bind to the server's LAN address and restart. If you change Docker's port mapping, reuse the data volume that contains the administrator account.</Steps>@@ -61,20 +57,103 @@ Browsers turn off the clipboard and Web Locks for plain-HTTP pages at a networkInvokeAI cannot recover a password. If you lose the last administrator's password, reset it from the command line with [`invoke-usermod`](#troubleshooting).:::-To go back to single-user mode, set `multiuser: false` (or remove the line) and restart. Browsers that had InvokeAI open may need a hard refresh.+### Verify local-only access++- **Native install.** Set `host: 127.0.0.1` in `invokeai.yaml`. The server process's `INVOKEAI_HOST` environment variable takes precedence, so unset it or set it to `127.0.0.1` in your launcher or service environment. After starting, inspect the listening socket for your port. For example, on Linux run `ss -ltn 'sport = :9090'`, on macOS run `lsof -nP -iTCP:9090 -sTCP:LISTEN`, or on Windows run `Get-NetTCPConnection -LocalPort 9090 -State Listen`. The local address should be loopback only (`127.0.0.1` or `::1`). A wildcard or LAN address accepts network connections.+- **Docker.** Leave the listener inside the container on `0.0.0.0`. With the supplied Compose file, set `HOST_INVOKEAI_IP=127.0.0.1` in `.env`. For older Compose files, set the port mapping itself to `127.0.0.1:9090:9090`. With `docker run`, use `--publish 127.0.0.1:9090:9090`. Keep untrusted containers off the same Docker network. After starting, run `docker port <container> 9090/tcp` on the host and confirm the published address is `127.0.0.1:9090`. Substitute your configured port in these checks.++### Single-user mode++Before disabling sign-in, disconnect external routes and [verify local-only access](#verify-local-only-access) with sign-in still enabled. Every visitor in single-user mode has full administrator control. Set `multiuser: false` in `invokeai.yaml` or set `INVOKEAI_MULTIUSER=false` in the container environment. Restart with the same network configuration. Browsers that had InvokeAI open may need a hard refresh.++:::caution[Single-user mode is deprecated]+Single-user mode will be removed in a future release.+:::++### Upgrading from single-user mode++Already upgraded, for example because **Set up Invoke** shows **Your earlier work is kept**? See [If you have already upgraded](#if-you-have-already-upgraded).++Earlier versions ran in single-user mode by default. Upgrading with no `multiuser` setting now enables sign-in, even on localhost. New accounts, including the first administrator, have their own projects, wildcards, private prompt templates and private fonts. If you want to keep working without accounts, check that the effective setting is explicitly `multiuser: false` and keep the server [local only](#single-user-mode). Earlier versions dropped `multiuser: false` from `invokeai.yaml` when they rewrote it, so check the file even if you set it before. The current version keeps the line.++1. **Before switching, finish queued work.** Stop submitting jobs and let pending and running jobs finish in single-user mode. In particular, **Prompts from File** checks the submitting account when the node runs. Old jobs belong to `system`, which has no administrator role in multi-user mode, so that node fails after the switch.+2. **Export the work you want to carry across.** While still in single-user mode, use the export instructions in the table below.+3. **Set up accounts privately.** Follow [Set up multi-user mode](#set-up-multi-user-mode) to back up, restart and create the administrator before allowing network access. Hard-refresh any browser tabs left open across the switch. Update API clients to [sign in and send a token](/configuration/multi-user-mode/api-guide/).+4. **Import as the intended owner.** Sign in to the destination account and follow the import instructions below.++| Data | Before switching, in single-user mode | After switching, in the destination account |+| --- | --- | --- |+| [Workbench projects](/users-guide/projects/introduction/#exporting-and-importing) | In **Launchpad → Projects**, choose **Export** from each project's menu. Save the `.invk` file and check for missing-media warnings. | Select the file in **Launchpad → Projects → Import…**. Review warnings and check the project's boards, media and references. |+| Private fonts | **Include font files** is off by default. Select it during project export if you can redistribute the fonts used by that project's text layers. Keep original files for fonts you leave out, including fonts unused by any exported project. | Importing the `.invk` installs embedded fonts privately. For other fonts, upload the original files to **My fonts** with **Launchpad → Fonts → Add Fonts**. Check text layers that use them. |+| [Wildcards](/users-guide/image-generation/prompting-guide/#importing-and-exporting-wildcards) | In the prompt panel, select **Dynamic → Wildcards → Export** and save the whole collection as YAML or JSON. | Choose **Dynamic → Wildcards → Import → From files…**. |+| [Private prompt templates](/users-guide/image-generation/prompting-guide/#importing-and-exporting-templates) | In the prompt toolbar, choose **Templates → Export**. The CSV contains every user-created template's name, positive prompt and negative prompt. It omits thumbnails, so keep the preview images separately. | An administrator can use **Templates → Import** to create copies owned by that administrator. For an ordinary user, recreate the desired rows with **Templates → New template** while signed in as that user. Add the preview image in each template's editor. |++Each project import creates a new project ID and copies the archived boards and their media. Missing media can leave broken references. The archive includes the project's workflows and referenced media. It leaves out Library workflows, unrelated Library boards, models, queue history, temporary intermediates and account preferences. Older canvas-only `.invk` files require the legacy frontend.++Workbench limits each archive to 2 GiB both packed and unpacked, 20,000 entries and 1,000 boards. If a project exceeds a limit, [back up the original installation](#backups). You can still open the original project in a local-only single-user session using the [steps below](#if-you-have-already-upgraded).++### If you have already upgraded++Invoke now asks for an account. The Workbench projects, wildcards, private prompt templates and private uploaded fonts you made before that are still on your computer, but accounts do not show them. Shared prompt templates and shared fonts stay visible. Your boards, images and videos are kept too, and administrators can see them.++- **You do not need that work in your account:** create the account while only you can reach Invoke, as [Set up multi-user mode](#set-up-multi-user-mode) describes, or keep using the one you made; there is nothing else to do.+- **You want that work in your account:** follow these steps. You turn sign-in off for a short time, export your work, then turn sign-in back on and import it.++The steps change `invokeai.yaml`, which is in your [root directory](/configuration/invokeai-yaml/#invokeai-root-directory). For a Launcher install, that is the folder you installed Invoke into.++<Steps>++1. **Close outside access.** Turn off any reverse proxy, tunnel or port forward that lets others reach Invoke.++2. **Stop Invoke.** If you already created an account, stop submitting jobs and let that account's jobs finish first.++3. **Back up the installation.** See [Backups](#backups).++4. **Allow access only from this computer.** Keep sign-in on. Set up [local-only access](#verify-local-only-access) for the same root directory and database.++5. **Check local-only access.** Start Invoke and check the listener as [Verify local-only access](#verify-local-only-access) describes.++6. **Stop Invoke.**++7. **Turn sign-in off for now.** In `invokeai.yaml`, change `multiuser: true` to `multiuser: false`. If the file has no `multiuser` line, add `multiuser: false`. With Docker, you can set `INVOKEAI_MULTIUSER=false` in the container environment instead. Recreate the container (`./run.sh` or `docker compose up -d`) to apply it; a plain restart keeps the old environment. While sign-in is off, anyone who can reach Invoke has full control of it.++8. **Start Invoke** with the same network settings.++9. **Hard-refresh the browser** (`Ctrl+Shift+R`, or `Cmd+Shift+R` on a Mac). Invoke opens without asking you to sign in and shows your earlier work.++10. **Let queued work finish.** Do not start new jobs. Open the queue and wait until no jobs are pending or running.++11. **Export your work.** Follow the **Before switching, in single-user mode** column of the [table above](#upgrading-from-single-user-mode).++12. **Stop Invoke.**++13. **Turn sign-in back on.** If you changed `invokeai.yaml`, change the line back to `multiuser: true`. If you set `INVOKEAI_MULTIUSER=false`, remove it and recreate the container again.++14. **Start Invoke** with access still limited to this computer.++15. **Sign in.** If **Set up Invoke** appears, create the administrator account first, as in [Set up multi-user mode](#set-up-multi-user-mode). If Invoke opens without asking you to sign in, sign-in is still off: stop and repeat step 13 before going on.++16. **Import your work.** Follow the **After switching, in the destination account** column of the table.++17. **Check the imports.** Check that your projects, wildcards, prompt templates and fonts are there. In each project, check its boards, media, references and text layers.++18. **Restore outside access.** Only now turn your proxy, tunnel or port forward back on, or [enable network access](#set-up-multi-user-mode).++</Steps>### What happens to existing data-Switching modes changes no data. Every record keeps its owner, and the mode decides who can see it. In single-user mode everything you create belongs to an internal account named `system`, which cannot sign in.+Switching modes preserves ownership. Work created in single-user mode belongs to the internal `system` account, which cannot sign in. Creating the first administrator does not transfer that work.| Data | Single-user → multi-user | Multi-user → single-user || --- | --- | --- |-| Boards, images, videos | Owned by `system`: only administrators can open them | All visible: the single-user mode user is an administrator |-| Projects | Owned by `system`: no account can open them. They come back when you return to single-user mode | Only projects created in single-user mode are listed. Each account's projects come back when you return to multi-user mode |-| Library workflows | Public, owned by `system`: every user can open, duplicate or download them from **Shared with me** | All visible |-| Accounts | Kept. Created in multi-user mode only | Kept, unused until you switch back |--Content that accounts create in multi-user mode stays theirs across any number of switches. There is no tool yet to move `system`-owned content to another account.+| Boards, images, videos | Administrators can access them. Other accounts can view media on boards they can read | All visible to the single-user administrator |+| Projects | The originals are visible only in single-user mode. Each recipient can import an exported copy | Only projects created in single-user mode are listed |+| Wildcards | Each account has its own collection, including administrators. Import the exported file into the intended account | Only the single-user collection is listed |+| Private prompt templates | The originals stay out of new accounts' Workbench template lists. Import or recreate copies as described above | User-created templates appear under **Your templates** |+| Private uploaded fonts | The originals stay in the single-user font library | Only single-user private uploads appear under **My fonts** |+| Library workflows | Public by default, owned by `system`. Users can open, duplicate or download public workflows from **Shared with me** | All visible |+| Accounts | Existing accounts retain their work | Kept for the next switch back to multi-user mode |### Upgrading from v6@@ -375,14 +454,16 @@ InvokeAI has had no security audit and has no login rate limiting or lockout. Pr## Backups-The `databases` folder holds the accounts, the signing key and every record; `outputs` holds the image and video files.+Stop InvokeAI and leave it stopped until both the database and the files have been backed up. This keeps account and project records in sync with the files they reference.++1. Copy the complete InvokeAI root and any configured storage or configuration files outside it. Include image and video files (`outputs_dir`), uploaded fonts including private fonts (`fonts_storage_dir`), prompt-template preview images (`style_presets_dir`) and workflow thumbnails (`workflow_thumbnails_dir`). Keep original models you cannot download again.+2. Back up the **active database**, which holds the accounts, signing key, projects and other records.+ - **SQLite.** Copy the whole `db_dir` (by default `databases/` under the root) with all writers stopped. Keep any `invokeai.db-wal` and `invokeai.db-shm` beside `invokeai.db`. Recent commits may still be in the write-ahead log. A complete root copy already covers the default location.+ - **MySQL or MariaDB.** Take a consistent dump of the database named by `db_url`, for example with `mysqldump --single-transaction` or `mariadb-dump --single-transaction` for its InnoDB tables. Keep schema changes paused until the dump completes. You need this dump alongside the root copy. InvokeAI makes no automatic backup of a server database.-- **What to copy:** `databases/`, `outputs/` and `invokeai.yaml`. `models/` is optional, since models can be downloaded again.-- **Stop InvokeAI first.** The database runs in write-ahead log mode, and a running server can hold recent changes in `invokeai.db-wal` beside the database file. Copy the whole folder, never the `.db` file alone while the server runs.-- **Automatic backups.** Before every database update, such as an upgrade, InvokeAI saves `databases/invokeai_backup_<YYYYMMDD>-<HHMMSS>.db`. Gallery maintenance saves its own in `databases/backup/`. InvokeAI never deletes either.-- **MySQL or MariaDB.** InvokeAI makes no backups of a server database. Use `mysqldump` or `mariadb-dump`.+Before a SQLite database update, InvokeAI saves `invokeai_backup_<YYYYMMDD>-<HHMMSS>.db` in `db_dir`. To roll back an upgrade, follow [Restore a backup](/start-here/upgrading/#restore-a-backup) to select and restore the pre-upgrade snapshot. Gallery maintenance saves its SQLite snapshots in `db_dir/backup/`. Those snapshots contain the database records only.-To restore, follow [Restore a backup](/start-here/upgrading/#restore-a-backup): it explains which file to pick and how to handle the `-wal` and `-shm` files.+To restore a **manual backup**, stop InvokeAI and keep all writers stopped throughout the restore. For SQLite, first move the destination's `invokeai.db` and any `invokeai.db-wal` and `invokeai.db-shm` together to a separate directory. Restore the root and external files from the same backup, placing its `invokeai.db` and any accompanying `-wal` and `-shm` files together in the configured `db_dir`. For MySQL or MariaDB, restore the root and external files and load the matching dump with the database server's tools. [Restart privately and verify the active database and administrator](/start-here/upgrading/#first-start-after-switching-databases) before restoring network access.## Troubleshooting@@ -394,7 +475,7 @@ To restore, follow [Restore a backup](/start-here/upgrading/#restore-a-backup):| "Cannot remove the last administrator" | Promote another account first. || "The system user cannot be deleted, deactivated, promoted to administrator, or given a password" | `system` owns the content created in single-user mode. Leave it as it is. || **Set up Invoke** appears again | The server found no active administrator in its database. Check that it uses the same root and database as before (`--root`, `INVOKEAI_ROOT`, `db_dir`, `db_url`). |-| Other computers cannot connect | Set `host: 0.0.0.0`, restart, and allow port 9090 (or your `port`) through the server's firewall. |+| Other computers cannot connect | Confirm administrator sign-in locally, then check the listener, port mapping or proxy for your intended network route. See [Set up multi-user mode](#set-up-multi-user-mode). After updating a Docker Compose setup, see [Run the Container](/configuration/docker/#run-the-container). || "Database is locked" | InvokeAI already uses write-ahead logging and waits 5 seconds for a lock. Another program is holding the database: an open `sqlite3` shell, a backup or sync tool. Find it with `fuser databases/invokeai.db` on Linux. Keep the database on a local disk: write-ahead logging may not engage on network file systems. || Database update fails at startup | Set `log_level: debug` in `invokeai.yaml` and start again to see the error. With SQLite, the database was backed up first and each migration rolls back when it fails; see [Upgrading](/start-here/upgrading/) to restore the backup. With MySQL or MariaDB there is no automatic backup, and a failed migration's changes are not rolled back: it runs again from the start at the next start. Restore your own backup if it keeps failing. || Slow on a large library | An administrator can run **Compact database** under **Settings → Data & workspace**. It can take a long time and pauses database activity while it runs. |diff --git a/docs/src/content/docs/configuration/Multi-User Mode/api-guide.mdx b/docs/src/content/docs/configuration/Multi-User Mode/api-guide.mdxindex 3fd2916205..ed14cdb02d 100644--- a/docs/src/content/docs/configuration/Multi-User Mode/api-guide.mdx+++ b/docs/src/content/docs/configuration/Multi-User Mode/api-guide.mdx@@ -12,14 +12,12 @@ This guide explains how to interact with InvokeAI's API in both single-user and### Single-User vs Multi-User Mode-**Single-User Mode** (`multiuser: false` or option absent):+**Single-User Mode** (`multiuser: false`; deprecated):-- No authentication required-- All API endpoints accessible without tokens-- Direct API access like previous InvokeAI versions-- All content visible in unified view+- Project, generation and gallery requests use the internal `system` account without a token.+- Keep the server accessible only on your computer, since anyone who can reach it has administrator privileges.-**Multi-User Mode** (`multiuser: true`):+**Multi-User Mode** (`multiuser: true` or option absent, the default):- JWT token authentication required- User-scoped access to resources@@ -42,7 +40,7 @@ When multi-user mode is enabled, most API endpoints require authentication using</Steps>:::note[Single-User Mode]-When running in single-user mode (`multiuser: false`), authentication endpoints are not available and authentication headers are not required.+In single-user mode, `GET /api/v1/auth/status` reports `multiuser_enabled: false`. Login and initial setup return `403`.:::### Login Endpoint@@ -506,16 +504,14 @@ curl -X POST "http://localhost:9090/api/v1/boards/?board_name=My%20API%20Board"### Authentication Required-All endpoints now require authentication except:+In multi-user mode, clients can use the following endpoints without a token:- `GET /api/v1/auth/status` — Check whether multi-user setup is required- `POST /api/v1/auth/setup` — Initial admin setup- `POST /api/v1/auth/login` — User login-- `GET /api/v1/images/i/{image_name}/full` — Full-resolution image file-- `GET /api/v1/images/i/{image_name}/thumbnail` — Image thumbnail- `GET /api/v1/workflows/i/{workflow_id}/thumbnail` — Workflow thumbnail-The image and thumbnail endpoints are intentionally unauthenticated because browsers load these resources via `<img src>` tags, which cannot send `Authorization` headers. Security relies on the fact that image and workflow IDs are UUIDs and therefore unguessable.+Full images (`GET /api/v1/images/i/{image_name}/full`) and image thumbnails (`GET /api/v1/images/i/{image_name}/thumbnail`) require authentication and read access to the image. API clients can send their bearer token. Browsers can use the path-scoped HttpOnly media cookie set at login.### User-Scoped Resources@@ -650,7 +646,8 @@ Occurs when:"setup_required": true,"multiuser_enabled": true,"strict_password_checking": true,- "admin_email": "[email protected]"+ "admin_email": null,+ "has_single_user_work": true}```@@ -660,15 +657,20 @@ Occurs when:"setup_required": false,"multiuser_enabled": true,"strict_password_checking": true,- "admin_email": null+ "admin_email": null,+ "has_single_user_work": false}```:::note-`admin_email` is only populated while `setup_required` is `true` (to help locate the pre-seeded-administrator account during initial setup). Once an admin has been created — and whenever-multiuser mode is disabled — it is returned as `null` to avoid leaking administrator identity on-public deployments.+`admin_email` is `null` in both cases. The server fills it in only while `setup_required` is `true`, and setup is+required only while no active administrator exists, so there is no address to return. Once an administrator exists,+and whenever multiuser mode is disabled, it stays `null` so a public server does not reveal an administrator's+address.++`has_single_user_work` is `true` only while `setup_required` is `true` and the internal `system` account owns a+Workbench project, a wildcard, a private prompt template or a private uploaded font. The setup screen then shows the+**Your earlier work is kept** notice.:::@@ -1063,16 +1065,10 @@ boards = client.get_boards()InvokeAI supports both single-user and multi-user modes via the `multiuser` configuration option.-**Configuration:**+Multi-user mode is the default. For a deprecated single-user install accessible only from this computer, set the option explicitly in `invokeai.yaml`:```yaml-# invokeai.yaml--# Single-user mode (no authentication)-multiuser: false # or omit the option entirely--# Multi-user mode (authentication required)-multiuser: true+multiuser: false```**Checking Mode Programmatically:**diff --git a/docs/src/content/docs/configuration/Multi-User Mode/user-guide.mdx b/docs/src/content/docs/configuration/Multi-User Mode/user-guide.mdxindex 7d8f24670b..e876aface8 100644--- a/docs/src/content/docs/configuration/Multi-User Mode/user-guide.mdx+++ b/docs/src/content/docs/configuration/Multi-User Mode/user-guide.mdx@@ -1,7 +1,7 @@---title: Multi-User Guidedescription: Sign in to a shared InvokeAI server, share boards and workflows, and work alongside other users.-lastUpdated: 2026-10-26+lastUpdated: 2026-11-20sidebar:order: 3---@@ -10,7 +10,7 @@ import { LinkCard, Badge } from '@astrojs/starlight/components';In multi-user mode, several people share one InvokeAI server. Everyone signs in with their own account and has their own projects, boards, workflows and settings. This guide is for everyone who uses such a server.-<LinkCard title="Setting up a server?" href="/configuration/multi-user-mode/admin-guide/" description="The administrator guide covers turning on multi-user mode, creating the first administrator, and adding, editing or removing users." />+<LinkCard title="Setting up a server?" href="/configuration/multi-user-mode/admin-guide/" description="The administrator guide covers creating the first administrator, and adding, editing or removing users." />## Signing indiff --git a/docs/src/content/docs/development/Guides/family-e2e.mdx b/docs/src/content/docs/development/Guides/family-e2e.mdxindex 4a0719cb60..65c5f78378 100644--- a/docs/src/content/docs/development/Guides/family-e2e.mdx+++ b/docs/src/content/docs/development/Guides/family-e2e.mdx@@ -1,6 +1,6 @@---title: Family E2E Runs-lastUpdated: 2026-11-05+lastUpdated: 2026-11-20---`scripts/family_e2e` runs model families end to end through the HTTP API of a server it launches itself. Per case and size it records the image, the run time, the time per denoise step and the VRAM the server process used, measured at driver level. The report compares them with an explicitly accepted reference and with the previous run of the same profile.@@ -10,13 +10,14 @@ It is a developer tool. It runs on Windows with NVIDIA and AMD (ROCm) GPUs, wher## How a run works1. **Scratch root.** The template root's `invokeai.yaml` and a snapshot of its SQLite database go to `<data_dir>/scratch-roots/<run_id>-default/`. The template's database files (with a WAL left by an unclean stop) are copied, and the copy is backed up through InvokeAI's database layer, so the WAL's contents are included and the template's files are only read.+ - The runner uses the API without signing in, so the template must run single-user. Use a template whose data you can expose to local processes, and set `multiuser: false` in its `invokeai.yaml`. The runner refuses a template with `multiuser: true` before copying its database, even when the manifest sets `INVOKEAI_MULTIUSER: "false"` under `server.env`. That override works only for a template whose `invokeai.yaml` has no `multiuser` line. Starting the template root's own server on the current version adds `multiuser: true` to such a file, even with `INVOKEAI_MULTIUSER=false` set, and from then on the runner refuses the template.- The tool refuses while the database file is open in any process (Windows only), or while anything listens on the template's configured port. Either means its server is still running.- It also refuses while a model install is unfinished (see [Shared paths](#shared-paths)).- Stores whose files the database owns start empty in the scratch root: outputs, uploaded fonts, style preset images, workflow thumbnails and profiles. The scratch server reconciles them with its own database; at the template it would, for example, delete uploaded fonts its database does not list.- Every other path setting points back at the template root as an absolute path, so models, custom nodes and memory settings are the template's own.- The tool overrides a few settings: a free port on `127.0.0.1`, a plain-format log file in the run directory, the image index off, and the queue cleared at startup. SSL and `base_url` are dropped. On Linux the server sees only the selected GPU, as `cuda:0`, so a `device` of `cuda:N` becomes `cuda:0` and a `generation_devices` list with a CUDA device becomes `auto`.- - `INVOKEAI_*` variables of the calling environment are not passed on. Put settings the server needs into the manifest's `server.env`.-2. **Server.** The tool checks that `server.python` imports `invokeai` from `server.code_dir`. It then starts `<python> <code_dir>/scripts/invokeai-web.py --root <scratch root>` and reads the actual port from the server log. Multiuser mode is refused.+ - `INVOKEAI_*` variables of the calling environment are not passed on. Put settings the server needs into the manifest's `server.env`. The runner reserves the host, port, database URL and database-owned storage paths so a manifest cannot redirect the scratch server to a network listener or live store.+2. **Server.** The tool checks that `server.python` imports `invokeai` from `server.code_dir`. It then starts `<python> <code_dir>/scripts/invokeai-web.py --root <scratch root>` and reads the actual port from the server log. The server always runs single-user: a template that would run in multiuser mode is refused in step 1.- On Windows the server runs in a job object of the runner, so it dies with the runner however the runner ends. On Linux it runs in a session of its own. `stop`, an interrupt or a plain kill (SIGTERM) of the runner ends it; a runner killed with SIGKILL leaves it running. The runner writes the launched process into `heartbeat.json` before it waits for the server to start, so `stop` and `resume` also find a server whose runner was killed during the startup. While it holds more than 1 GiB on that GPU, `start` and `resume` name it as foreign load and refuse; `stop RUN` ends it. Otherwise the resumed runner stops it first, before it replaces `heartbeat.json`, which names the server for `stop`, or touches the scratch root and a calibration store in it. If it cannot stop the server, the runner refuses and leaves the scratch root with its store and the server's entries in `heartbeat.json` as they are; `runner.log` names the pid and the run shows as failed.3. **Graphs.** The real webv2 graph builders produce each case's batch through `pnpm graphs:export`, run in the tool checkout. Run `pnpm install` in `invokeai/frontend/webv2` there first.- The runner disables the invocation cache on every node and saves the batch as `graphs/<case_key>.json`.@@ -56,7 +57,7 @@ A YAML file per machine, operating system and GPU, kept with the data rather tha| `profile` | Names runs and references. || `data_dir` | The data directory above. || `gpu` | Substring of the adapter name that matches exactly one adapter, e.g. `RTX 4090` or `9060`. `Radeon` alone also matches an AMD integrated GPU. On Linux it can also be an NVML UUID (`GPU-…`, listed by `nvidia-smi -L` and by the error for a name that matches several cards), which tells identical cards apart. A GPU NVML cannot query is left out with a warning. |-| `server.template_root` | The root whose settings and database are copied. The scratch server shares its other paths; see [Shared paths](#shared-paths). |+| `server.template_root` | The root whose settings and database are copied. Set `multiuser: false` in its `invokeai.yaml`; see [How a run works](#how-a-run-works). The scratch server shares its other paths; see [Shared paths](#shared-paths). || `server.python` | The interpreter that runs the server. || `server.code_dir` | The checkout the server runs. Defaults to the tool's checkout. || `server.env` | Extra server environment, e.g. `HIP_VISIBLE_DEVICES`. On Linux the runner sets `CUDA_VISIBLE_DEVICES` to the selected GPU's UUID itself, so the server sees exactly that card, as `cuda:0`, and neither spreads its workers over the others nor borrows an idle one. A `CUDA_VISIBLE_DEVICES` here with any other value than that UUID is refused. The scratch root's `device: cuda:N` becomes `cuda:0` and a `generation_devices` list with a CUDA device becomes `auto` (see [How a run works](#how-a-run-works)). On Windows pin the server to the manifest's `gpu` here when the machine has several. Either way the first completed step fails the run when the server holds no memory on the selected card. |diff --git a/docs/src/content/docs/development/Guides/recall-api.mdx b/docs/src/content/docs/development/Guides/recall-api.mdxindex 771f1d917d..d322e54699 100644--- a/docs/src/content/docs/development/Guides/recall-api.mdx+++ b/docs/src/content/docs/development/Guides/recall-api.mdx@@ -260,6 +260,8 @@ the currently-selected main model, matching the behavior of a manual drag-and-dr## Usage Examples+Sign-in is on by default, so add an `Authorization: Bearer <token>` header to each request. See the [Multi-User API Guide](/configuration/multi-user-mode/api-guide/) for getting a token. The examples leave it out.+### cURL```bashdiff --git a/docs/src/content/docs/development/Guides/video-recall-api.mdx b/docs/src/content/docs/development/Guides/video-recall-api.mdxindex 6d4aec3d16..ebce7c62ce 100644--- a/docs/src/content/docs/development/Guides/video-recall-api.mdx+++ b/docs/src/content/docs/development/Guides/video-recall-api.mdx@@ -303,7 +303,7 @@ curl -X POST "http://localhost:9090/api/v1/recall/video/default/image?image_namecurl -X POST "http://localhost:9090/api/v1/recall/video/default/image?image_name=9d2a….png&append=true"```-In multi-user mode, add `-H "Authorization: Bearer <token>"`.+Sign-in is on by default, so add `-H "Authorization: Bearer <token>"` to each request. See the [Multi-User API Guide](/configuration/multi-user-mode/api-guide/) for getting a token.### Pythondiff --git a/docs/src/content/docs/development/Guides/workflow-api.mdx b/docs/src/content/docs/development/Guides/workflow-api.mdxindex effe66a352..53098b19de 100644--- a/docs/src/content/docs/development/Guides/workflow-api.mdx+++ b/docs/src/content/docs/development/Guides/workflow-api.mdx@@ -12,7 +12,7 @@ InvokeAI's HTTP API can be used programmatically from external clients, but oneThis is a common source of confusion when a client can successfully read workflow records but cannot execute them.-If you are using multi-user mode, include your `Authorization: Bearer <token>` header on these requests.+Sign-in is on by default, so include an `Authorization: Bearer <token>` header on these requests. The [Multi-User API Guide](/configuration/multi-user-mode/api-guide/) shows how to get a token. The examples below leave it out.## Minimal `enqueue_batch` Examplediff --git a/docs/src/content/docs/development/Setup/dev-environment.mdx b/docs/src/content/docs/development/Setup/dev-environment.mdxindex 2c41647385..dd0939c552 100644--- a/docs/src/content/docs/development/Setup/dev-environment.mdx+++ b/docs/src/content/docs/development/Setup/dev-environment.mdx@@ -1,6 +1,6 @@---title: Development Environment-lastUpdated: 2026-11-06+lastUpdated: 2026-11-20---import { LinkCard, Steps, Tabs, TabItem, FileTree, LinkButton } from '@astrojs/starlight/components'@@ -89,7 +89,7 @@ import SystemRequirementsLink from '@components/SystemRequirmentsLink.astro'pnpm build```- 9. Restart the server and navigate to the URL. You should get a UI. After making changes to the python code, restart the server to see those changes.+ 9. Restart the server and navigate to the URL. You should get a UI. On a new root directory, the first screen is **Set up Invoke**, where you create the administrator account. After making changes to the python code, restart the server to see those changes.</Steps>## Backend Development@@ -233,8 +233,7 @@ It's also highly recommended to install the Jupyter extensions if you plan on wo"request": "launch","program": "scripts/invokeai-web.py","args": [- "--root", "/path/to/invokeai_root",- "--host", "0.0.0.0"+ "--root", "/path/to/invokeai_root"],"justMyCode": true},diff --git a/docs/src/content/docs/start-here/installation.mdx b/docs/src/content/docs/start-here/installation.mdxindex 5cd3555a94..04495e1a91 100644--- a/docs/src/content/docs/start-here/installation.mdx+++ b/docs/src/content/docs/start-here/installation.mdx@@ -1,6 +1,6 @@---title: Simple Installation-lastUpdated: 2026-10-20+lastUpdated: 2026-11-20---import { LinkCard, Tabs, TabItem, Steps } from '@astrojs/starlight/components'@@ -60,6 +60,8 @@ The Launcher manages your Invoke install. Follow these instructions to downloadRun the Launcher you just set up if you haven't already. Click **Install** and follow the instructions to install (or update) Invoke.+The first time you open Invoke, **Set up Invoke** asks you to [create the administrator account](/configuration/multi-user-mode/admin-guide/#set-up-multi-user-mode).+If you have an existing Invoke installation, you can select it and let the launcher manage the install. You'll be able to update or launch the installation. Installing v7 into an existing installation upgrades it in place, and older versions cannot use its database afterwards: read [Upgrading to v7](/start-here/upgrading/) first. To try a pre-release, install it into a new, empty folder instead, which leaves your current installation as it is.### Updatingdiff --git a/docs/src/content/docs/start-here/manual.mdx b/docs/src/content/docs/start-here/manual.mdxindex ea13ef35be..35958554b3 100644--- a/docs/src/content/docs/start-here/manual.mdx+++ b/docs/src/content/docs/start-here/manual.mdx@@ -1,6 +1,6 @@---title: Manual Installation-lastUpdated: 2026-10-25+lastUpdated: 2026-11-20---import { LinkCard, Steps, LinkButton } from '@astrojs/starlight/components'@@ -324,6 +324,8 @@ The following commands vary depending on the version of Invoke being installed ainvokeai-web --root ~/invokeai```+ Open `http://localhost:9090` in your browser. On first start, **Set up Invoke** asks you to [create the administrator account](/configuration/multi-user-mode/admin-guide/#set-up-multi-user-mode).+To keep an existing install as it is, give v7 a directory of its own: see [Run v7 alongside v6](/start-here/upgrading/#run-v7-alongside-v6).</Steps>diff --git a/docs/src/content/docs/start-here/upgrading.mdx b/docs/src/content/docs/start-here/upgrading.mdxindex 79ea10c249..2d64252f80 100644--- a/docs/src/content/docs/start-here/upgrading.mdx+++ b/docs/src/content/docs/start-here/upgrading.mdx@@ -1,12 +1,24 @@---title: Upgrading to v7-lastUpdated: 2026-10-20+lastUpdated: 2026-11-20---import { Tabs, TabItem, Steps } from '@astrojs/starlight/components'Upgrading an existing install to v7 is one-way. This page covers what the upgrade changes, where the backup of your database is, how to go back to an older version and return to v7, and how to try v7 without touching your current install.+:::caution[Before replacing a Docker container]+An older ROCm Compose service with a custom `INVOKEAI_ROOT` may have stored your database and files in the container's writable layer, outside its volume. Before running `docker compose up`, `docker compose down` or `./run.sh`, check the root in the old container's startup log against its mounts. Compose can remove or recreate the only container holding that data. If the root is outside the mounts, [recover it before replacing the container](/configuration/docker/#recover-data-before-replacing-a-container).+:::++## Before upgrading a single-user installation++InvokeAI now requires sign-in by default, including on localhost. If you previously worked without an account, finish queued jobs and save the Workbench projects, wildcards, private prompt templates and private fonts you want to use with your new account **before switching modes**. Create the first administrator while only you can reach the server: until it exists, anyone who can reach the server sees **Set up Invoke** and can claim the account. With `host: 0.0.0.0` in `invokeai.yaml`, that includes everyone on your network, so set it to `127.0.0.1` first. The [single-user upgrade instructions](/configuration/multi-user-mode/admin-guide/#upgrading-from-single-user-mode) cover export, private setup and import. If you have already upgraded, follow [these steps](/configuration/multi-user-mode/admin-guide/#if-you-have-already-upgraded) to bring your earlier work over.++## Docker Compose network access++After you update the Compose files, other devices can no longer connect to Invoke. To share it again, see [Run the Container](/configuration/docker/#run-the-container).+## The upgrade is one-wayThe first time v7 starts on an existing install, it updates the database at `<root>/databases/invokeai.db` in place. After that, older versions cannot use it:@@ -49,9 +61,11 @@ Nothing you did in v7 after that start is in the backup. Images you generated inv6 lists the models you installed in v7 as orphaned, and its **Sync Models** in the Model Manager offers to delete them. Keep them if you may go back to v7: the v7 database you set aside, `invokeai.db.v7`, still uses them.:::+v7 adds `multiuser: true` to an `invokeai.yaml` that has no `multiuser` line, and v6.13 and later read it. So if you worked without an account before, they now ask you to sign in or create an administrator too. To work without accounts there, set `multiuser: false` and keep the server [local only](/configuration/multi-user-mode/admin-guide/#single-user-mode). v6.12 and earlier refuse to start with that file: copy `invokeai.yaml.bak`, which v7 saved next to it at its first start, to `invokeai.yaml`.+### MySQL and MariaDB-Invoke makes no backup of a server database. Back it up yourself before upgrading, as [MySQL and MariaDB](/configuration/external-database/) describes. To go back, restore that backup.+Invoke makes no backup of a server database. Back it up yourself before upgrading, as [MySQL and MariaDB](/configuration/external-database/) describes. To go back, restore that backup and follow the same private startup and sign-in checks described below.## Restore a backup@@ -67,7 +81,7 @@ Invoke makes no backup of a server database. Back it up yourself before upgradin5. Copy the backup you chose to `invokeai.db`. Copy it rather than rename it, so the backup stays as it is.-6. Start the older version.+6. [Start the older release privately and verify the restored database](#first-start-after-switching-databases).</Steps>@@ -112,7 +126,7 @@ To return to v7 after restoring a backup, put the v7 database you set aside back5. **Required:** if `invokeai.db.v7-wal` or `invokeai.db.v7-shm` exist, rename them to `invokeai.db-wal` and `invokeai.db-shm`. The write-ahead log can hold changes not yet written to the database file, and SQLite finds it only under the database's name.-6. Start v7.+6. [Start v7 privately and verify the restored database](#first-start-after-switching-databases). An administrator you created while using the v6 database exists only in that database. The v7 database may still need its first administrator.</Steps>@@ -143,9 +157,17 @@ Steps 3 to 5 as commands:</TabItem></Tabs>+### First start after switching databases++Use these steps in either direction. Each database has its own accounts and setup state.++1. Before starting InvokeAI, disconnect external reverse proxy routes, tunnels and port forwards. Configure the server or Docker host to [listen only on loopback](/configuration/multi-user-mode/admin-guide/#verify-local-only-access). On releases that support accounts, check that `invokeai.yaml` contains `multiuser: true` and remove any `INVOKEAI_MULTIUSER=false` environment override, or set `INVOKEAI_MULTIUSER=true` in the server environment. Without that line, v6.12 to v7.0.0-beta.2 start without sign-in. The current version adds the line to the end of the file when it starts. If it cannot, for example because the file is read-only, it logs a warning instead, so check that the line is there.+2. Start the intended release and verify local-only access. Check that the database path in the startup log matches the file you restored, or the configured server database for MySQL or MariaDB. For Docker, also check that the data mount points to the restored data.+3. For releases with accounts, open InvokeAI in a fresh browser session and confirm it requires sign-in. Sign in with an administrator from the active database, or complete first-administrator setup privately if that database predates setup. If setup appears when you expected an existing account, recheck the database and Docker mount. Restore network access only after verifying administrator sign-in and the expected data. For older releases without accounts, keep the server private or require authentication at a reverse proxy and allow remote access only through that proxy.+## Run v7 alongside v6-Each install's root directory holds its own database, images and models. Give v7 a root of its own, and your v6 install stays as it is. The v7 install starts with an empty gallery and no models.+Give v7 its own root directory **and database** before its first start. To use SQLite in the new root, unset any inherited `INVOKEAI_DB_URL`, remove `db_url` from the v7 configuration and check that `db_dir` resolves inside the new root. For MySQL or MariaDB, point v7 at a separate, empty database. Check that any absolute storage paths or environment overrides for v7 point to its own files, including outputs and models.- **Launcher:** install v7 into a new, empty folder. Do not select your existing install: that upgrades it in place. The folder you install into is v7's root directory.- **Manual install:** install v7 into a new directory, as [Manual Installation](/start-here/manual/) describes, and start it with `--root` set to that directory, or set the `INVOKEAI_ROOT` environment variable. `--root` takes precedence over `INVOKEAI_ROOT`, which takes precedence over the directory of the active virtual environment; see [InvokeAI Root Directory](/configuration/invokeai-yaml/#invokeai-root-directory).@@ -153,3 +175,5 @@ Each install's root directory holds its own database, images and models. Give v7:::caution[Keep the models folders apart]Do not point both installs' `models_dir` at the same folder. Each install knows only the models it installed itself, so **Clean up orphaned models** in one install's Model Manager lists the other install's models as orphaned and offers to delete them.:::++[Start v7 privately and set up its first administrator](/configuration/multi-user-mode/admin-guide/#set-up-multi-user-mode). Check the startup log for v7's root and database, then confirm administrator sign-in and the new, empty gallery before enabling network access.diff --git a/docs/src/generated/settings.json b/docs/src/generated/settings.jsonindex 141579491c..70037347a4 100644--- a/docs/src/generated/settings.json+++ b/docs/src/generated/settings.json@@ -1081,8 +1081,8 @@},{"category": "MULTIUSER",- "default": false,- "description": "Enable multiuser support. When disabled, the application runs in single-user mode using a default system account with administrator privileges. When enabled, requires user authentication and authorization.",+ "default": true,+ "description": "Enable multiuser support (the default). Requires user authentication and authorization; the first visitor creates the administrator account. Set to false for single-user mode, which uses a default system account with administrator privileges and no sign-in: anyone who can reach the server then has full control of it. Single-user mode is deprecated.","env_var": "INVOKEAI_MULTIUSER","literal_values": [],"name": "multiuser",diff --git a/docs/src/lib/components/DownloadPage.astro b/docs/src/lib/components/DownloadPage.astroindex 5be23d08af..0f94d04da8 100644--- a/docs/src/lib/components/DownloadPage.astro+++ b/docs/src/lib/components/DownloadPage.astro@@ -401,8 +401,8 @@ const cloudProviders = [<div class="ways__panel" data-way="docker"><h3 class="ways__heading">Run with Docker</h3>- <p class="ways__lede">Run Invoke in a container, without installing its dependencies on your system.</p>- <pre class="ways__code"><code>docker run --runtime=nvidia --gpus=all --publish 9090:9090 ghcr.io/invoke-ai/invokeai</code></pre>+ <p class="ways__lede">Use the <code>invokeai-data</code> volume for a new installation. For an existing installation, use the volume or host directory that holds your InvokeAI data.</p>+ <pre class="ways__code"><code>docker run --runtime=nvidia --gpus=all --volume invokeai-data:/invokeai --publish 127.0.0.1:9090:9090 ghcr.io/invoke-ai/invokeai</code></pre><div class="ways__cards"><a class="docs-link-card way-card" href={href('/configuration/docker/')}><Container class="docs-link-card__icon" aria-hidden="true" />@@ -414,7 +414,7 @@ const cloudProviders = [<div class="ways__panel" data-way="cloud"><h3 class="ways__heading">No GPU? Run it on a rented one</h3>- <p class="ways__lede">These services run Invoke on their GPUs and bill you for the time you use.</p>+ <p class="ways__lede">These services run Invoke on their GPUs and bill you for the time you use. Before opening public access, <a href={href('/configuration/multi-user-mode/admin-guide/#set-up-multi-user-mode')}>create the first administrator privately</a>.</p><div class="ways__cards ways__cards--three">{cloudProviders.map(({ title, description, href: providerHref }) => (@@ -432,7 +432,7 @@ const cloudProviders = [<ul class="trust" aria-label="About Invoke"><li><Scale aria-hidden="true" /> Apache 2.0 licensed</li><li><WifiOff aria-hidden="true" /> Runs offline</li>- <li><UserRoundX aria-hidden="true" /> No account needed</li>+ <li><UserRoundX aria-hidden="true" /> No cloud account needed</li><li><a href="https://github.com/invoke-ai/InvokeAI"><CodeXml aria-hidden="true" /> Source on GitHub</a></li>diff --git a/invokeai/app/api/auth_dependencies.py b/invokeai/app/api/auth_dependencies.pyindex 9de32998d9..72a5aa7448 100644--- a/invokeai/app/api/auth_dependencies.py+++ b/invokeai/app/api/auth_dependencies.py@@ -157,7 +157,7 @@ def get_current_user_or_default(This dependency is useful for endpoints that should work in both single-user and multiuser modes.- When multiuser mode is disabled (default), this always returns a system user with admin privileges,+ When multiuser mode is disabled, this always returns a system user with admin privileges,allowing unrestricted access to all operations.When multiuser mode is enabled, authentication is required and this function validates the token,@@ -247,7 +247,7 @@ def require_admin_or_default(This dependency is useful for admin-only endpoints that should work in both single-user and multiuser modes.- When multiuser mode is disabled (default), this always returns a system user with admin privileges.+ When multiuser mode is disabled, this always returns a system user with admin privileges.When multiuser mode is enabled, this validates that the authenticated user has admin privileges.Args:diff --git a/invokeai/app/api/routers/auth.py b/invokeai/app/api/routers/auth.pyindex bdde3ab5fd..02ddca2da3 100644--- a/invokeai/app/api/routers/auth.py+++ b/invokeai/app/api/routers/auth.py@@ -154,6 +154,10 @@ class SetupStatusResponse(BaseModel):multiuser_enabled: bool = Field(description="Whether multiuser mode is enabled")strict_password_checking: bool = Field(description="Whether strict password requirements are enforced")admin_email: str | None = Field(default=None, description="Email of the first active admin user, if any")+ has_single_user_work: bool = Field(+ default=False,+ description="Whether work made in single-user mode exists that new accounts will not see; only during setup",+ )@auth_router.get("/status", response_model=SetupStatusResponse)@@ -178,15 +182,17 @@ def get_setup_status() -> SetupStatusResponse:user_service = ApiDependencies.invoker.services.userssetup_required = not user_service.has_admin()- # Only expose admin_email during initial setup to avoid leaking- # administrator identity on public deployments.+ # Only expose admin_email and has_single_user_work during initial setup, to avoid leaking+ # them on public deployments and querying for them on every app load.admin_email = user_service.get_admin_email() if setup_required else None+ has_single_user_work = setup_required and user_service.has_single_user_work()return SetupStatusResponse(setup_required=setup_required,multiuser_enabled=True,strict_password_checking=config.strict_password_checking,admin_email=admin_email,+ has_single_user_work=has_single_user_work,)diff --git a/invokeai/app/services/config/config_default.py b/invokeai/app/services/config/config_default.pyindex aadd328ac5..4ab24a91d1 100644--- a/invokeai/app/services/config/config_default.py+++ b/invokeai/app/services/config/config_default.py@@ -158,7 +158,7 @@ class InvokeAIAppConfig(BaseSettings):download_proxy: Optional HTTP proxy for model downloads. The proxy must enforce the public-address policy because proxy-side DNS cannot be checked by InvokeAI.unsafe_disable_picklescan: UNSAFE. Disable the picklescan security check during model installation. Recommended only for development and testing purposes. This will allow arbitrary code execution during model installation, so should never be used in production.allow_unknown_models: Allow installation of models that we are unable to identify. If enabled, models will be marked as `unknown` in the database, and will not have any metadata associated with them. If disabled, unknown models will be rejected during installation.- multiuser: Enable multiuser support. When disabled, the application runs in single-user mode using a default system account with administrator privileges. When enabled, requires user authentication and authorization.+ multiuser: Enable multiuser support (the default). Requires user authentication and authorization; the first visitor creates the administrator account. Set to false for single-user mode, which uses a default system account with administrator privileges and no sign-in: anyone who can reach the server then has full control of it. Single-user mode is deprecated.strict_password_checking: Enforce strict password requirements. When True, passwords must contain uppercase, lowercase, and numbers. When False (default), any password is accepted but its strength (weak/moderate/strong) is reported to the user.image_index_enabled: Maintain a semantic embedding index of gallery images and videos, used by the image map and semantic search features.image_index_model: Name of the installed CLIP Vision or SigLIP model used to embed gallery images and video thumbnails. Changing the model discards embeddings computed by the previous model.@@ -304,7 +304,7 @@ class InvokeAIAppConfig(BaseSettings):allow_unknown_models: bool = Field(default=True, description="Allow installation of models that we are unable to identify. If enabled, models will be marked as `unknown` in the database, and will not have any metadata associated with them. If disabled, unknown models will be rejected during installation.")# MULTIUSER- multiuser: bool = Field(default=False, description="Enable multiuser support. When disabled, the application runs in single-user mode using a default system account with administrator privileges. When enabled, requires user authentication and authorization.")+ multiuser: bool = Field(default=True, description="Enable multiuser support (the default). Requires user authentication and authorization; the first visitor creates the administrator account. Set to false for single-user mode, which uses a default system account with administrator privileges and no sign-in: anyone who can reach the server then has full control of it. Single-user mode is deprecated.")strict_password_checking: bool = Field(default=False, description="Enforce strict password requirements. When True, passwords must contain uppercase, lowercase, and numbers. When False (default), any password is accepted but its strength (weak/moderate/strong) is reported to the user.")# IMAGE INDEX@@ -405,19 +405,15 @@ class InvokeAIAppConfig(BaseSettings):"""if isinstance(config, dict):- new_config = self.model_validate(config)+ new_config = DefaultInvokeAIAppConfig.model_validate(config)else:new_config = configfor field_name in new_config.model_fields_set:- new_value = getattr(new_config, field_name)- current_value = getattr(self, field_name)-if field_name in self.model_fields_set and not clobber:continue- if new_value != current_value:- setattr(self, field_name, new_value)+ setattr(self, field_name, getattr(new_config, field_name))def write_file(self, dest_path: Path, as_example: bool = False) -> None:"""Write the current configuration to file. This will overwrite the existing file.@@ -440,6 +436,8 @@ class InvokeAIAppConfig(BaseSettings):exclude_none=True if as_example else False,exclude={"schema_version", "legacy_models_yaml_path"},)+ # Older releases default to single-user mode, so always state the choice: a rollback then keeps sign-in on.+ config_dict["multiuser"] = self.multiuserif as_example:file.write("# This is an example file with default and example settings.\n")@@ -673,8 +671,8 @@ def migrate_v4_0_2_to_4_0_3_config_dict(config_dict: dict[str, Any]) -> dict[strreturn parsed_config_dict-def load_and_migrate_config(config_path: Path) -> InvokeAIAppConfig:- """Load and migrate a config file to the latest version.+def load_and_migrate_config(config_path: Path) -> DefaultInvokeAIAppConfig:+ """Load and migrate a config file to the latest version, without applying environment overrides.Args:config_path: Path to the config file.@@ -704,22 +702,19 @@ def load_and_migrate_config(config_path: Path) -> InvokeAIAppConfig:if migrated:shutil.copy(config_path, config_path.with_suffix(".yaml.bak"))- try:- # load and write without environment variables- migrated_config = DefaultInvokeAIAppConfig.model_validate(loaded_config_dict)- migrated_config.write_file(config_path)- except Exception as e:- shutil.copy(config_path.with_suffix(".yaml.bak"), config_path)- raise RuntimeError(f"Failed to load and migrate v3 config file {config_path}: {e}") from etry:- # Meta is not included in the model fields, so we need to validate it separately- config = InvokeAIAppConfig.model_validate(loaded_config_dict)+ config = DefaultInvokeAIAppConfig.model_validate(loaded_config_dict)assert config.schema_version == CONFIG_SCHEMA_VERSION, (f"Invalid schema version, expected {CONFIG_SCHEMA_VERSION}: {config.schema_version}")+ if migrated:+ config.write_file(config_path)return configexcept Exception as e:+ if migrated:+ shutil.copy(config_path.with_suffix(".yaml.bak"), config_path)+ raise RuntimeError(f"Failed to load and migrate config file {config_path}: {e}") from eraise RuntimeError(f"Failed to load config file {config_path}: {e}") from e@@ -800,6 +795,34 @@ def load_config_from_root(root: Path) -> InvokeAIAppConfig:return config+def _state_multiuser_in_config_file(config_path: Path, multiuser: bool) -> None:+ """Append `multiuser` to a config file that does not state it, leaving the existing text untouched."""+ # Older releases default to single-user mode, so state the choice once: a rollback then keeps sign-in on.+ encoding = locale.getpreferredencoding()+ try:+ text = config_path.read_text(encoding=encoding)+ settings = yaml.safe_load(text)+ if not isinstance(settings, dict) or "multiuser" in settings:+ return+ addition = ("" if text.endswith("\n") else "\n") + yaml.safe_dump({"multiuser": multiuser})+ try:+ safe = yaml.safe_load(text + addition) == {**settings, "multiuser": multiuser}+ except yaml.YAMLError:+ safe = False+ if safe:+ with open(config_path, "at", encoding=encoding) as file:+ file.write(addition)+ return+ reason = "appending a line would change how the file reads"+ except OSError as e:+ reason = str(e)+ logger.warning(+ "Unable to add the multiuser setting to %s (%s); an older release would start without sign-in",+ config_path,+ reason,+ )++@lru_cache(maxsize=1)def get_config() -> InvokeAIAppConfig:"""Get the global singleton app config.@@ -871,6 +894,7 @@ def get_config() -> InvokeAIAppConfig:if config.config_file_path.exists():config_from_file = load_and_migrate_config(config.config_file_path)+ _state_multiuser_in_config_file(config.config_file_path, config_from_file.multiuser)# Clobbering here will overwrite any settings that were set via environment variablesconfig.update_config(config_from_file, clobber=False)else:diff --git a/invokeai/app/services/shared/database/queries/users.py b/invokeai/app/services/shared/database/queries/users.pyindex 0c9a02060f..486016029e 100644--- a/invokeai/app/services/shared/database/queries/users.py+++ b/invokeai/app/services/shared/database/queries/users.py@@ -5,11 +5,31 @@ from collections.abc import Collection, Sequencefrom datetime import datetimefrom typing import Any, Optional-from sqlalchemy import Connection, Row, bindparam, delete, func, insert, select, true, update+from sqlalchemy import (+ Connection,+ Row,+ bindparam,+ delete,+ exists,+ false,+ func,+ insert,+ literal,+ or_,+ select,+ true,+ update,+)+from invokeai.app.services.fonts.fonts_common import FontScope, FontSourcefrom invokeai.app.services.shared.database.dialect import fixed_limitfrom invokeai.app.services.shared.database.queries.base import IN_CHUNK, QueryModule, mapped, read, write+from invokeai.app.services.shared.database.schema.fonts import fonts+from invokeai.app.services.shared.database.schema.projects import projects+from invokeai.app.services.shared.database.schema.style_presets import style_presetsfrom invokeai.app.services.shared.database.schema.users import users+from invokeai.app.services.shared.database.schema.wildcards import wildcards+from invokeai.app.services.style_preset_records.style_preset_records_common import PresetTypefrom invokeai.app.services.users.users_common import UserDTO# Every query that yields a `UserDTO` selects these columns and maps them with `_user`. A projection copied@@ -42,6 +62,24 @@ _COUNT_ACTIVE_ADMINS = select(func.count()).select_from(users).where(*_IS_ACTIVE_FIRST_ACTIVE_ADMIN_EMAIL = (select(users.c.email).where(*_IS_ACTIVE_ADMIN).order_by(users.c.created_at, users.c.user_id).limit(fixed_limit(1)))+_OWNS_PRIVATE_WORK = select(+ or_(+ exists().where(projects.c.user_id == bindparam("user_id")),+ exists().where(wildcards.c.user_id == bindparam("user_id")),+ # Bundled templates are `system`'s too, but every account sees them.+ exists().where(+ style_presets.c.user_id == bindparam("user_id"),+ style_presets.c.type == literal(PresetType.User.value),+ style_presets.c.is_public == false(),+ ),+ # An owner implies a private upload; source and scope are there to match `idx_fonts_uploaded_hash`.+ exists().where(+ fonts.c.owner_id == bindparam("user_id"),+ fonts.c.source == literal(FontSource.UPLOADED.value),+ fonts.c.scope == literal(FontScope.PRIVATE.value),+ ),+ )+)_INSERT = insert(users)# An UPDATE reserves bind names that equal column names for its SET clause._RECORD_LOGIN = update(users).where(users.c.user_id == bindparam("target_user_id"))@@ -120,6 +158,12 @@ class UserQueries(QueryModule):def first_active_admin_email(self, conn: Connection) -> Optional[str]:return conn.execute(_FIRST_ACTIVE_ADMIN_EMAIL).scalar_one_or_none()+ @read+ def owns_private_work(self, conn: Connection, user_id: str) -> bool:+ """Whether the account owns work no other account sees: a project, a wildcard, a private template it made,+ or a private uploaded font."""+ return bool(conn.execute(_OWNS_PRIVATE_WORK, {"user_id": user_id}).scalar_one())+@writedef insert(self,diff --git a/invokeai/app/services/users/users_base.py b/invokeai/app/services/users/users_base.pyindex 21a3a9270f..b7dca0ddbb 100644--- a/invokeai/app/services/users/users_base.py+++ b/invokeai/app/services/users/users_base.py@@ -157,6 +157,15 @@ class UserServiceBase(ABC):"""pass+ @abstractmethod+ def has_single_user_work(self) -> bool:+ """Whether work made in single-user mode exists that no signed-in account sees.++ Returns:+ True if the internal `system` account owns a project, wildcard, private template or private font+ """+ pass+@abstractmethoddef count_admins(self) -> int:"""Count active admin users.diff --git a/invokeai/app/services/users/users_default.py b/invokeai/app/services/users/users_default.pyindex 755aeb306b..d409cc4318 100644--- a/invokeai/app/services/users/users_default.py+++ b/invokeai/app/services/users/users_default.py@@ -224,6 +224,10 @@ class UserService(UserServiceBase):"""Get the email address of the first active admin user."""return self._queries.users.first_active_admin_email()+ def has_single_user_work(self) -> bool:+ """Whether work made in single-user mode exists that no signed-in account sees."""+ return self._queries.users.owns_private_work(SYSTEM_USER_ID)+def count_admins(self) -> int:"""Count active admin users."""return self._queries.users.count_active_admins()diff --git a/invokeai/frontend/api/openapi.json b/invokeai/frontend/api/openapi.jsonindex b00dddf91e..02d1c601bb 100644--- a/invokeai/frontend/api/openapi.json+++ b/invokeai/frontend/api/openapi.json@@ -66654,8 +66654,8 @@"multiuser": {"type": "boolean","title": "Multiuser",- "description": "Enable multiuser support. When disabled, the application runs in single-user mode using a default system account with administrator privileges. When enabled, requires user authentication and authorization.",- "default": false+ "description": "Enable multiuser support (the default). Requires user authentication and authorization; the first visitor creates the administrator account. Set to false for single-user mode, which uses a default system account with administrator privileges and no sign-in: anyone who can reach the server then has full control of it. Single-user mode is deprecated.",+ "default": true},"strict_password_checking": {"type": "boolean",@@ -66818,7 +66818,7 @@"additionalProperties": false,"type": "object","title": "InvokeAIAppConfig",- "description": "Invoke's global app configuration.\n\nTypically, you won't need to interact with this class directly. Instead, use the `get_config` function from `invokeai.app.services.config` to get a singleton config object.\n\nAttributes:\n host: IP address to bind to. Use `0.0.0.0` to serve to your local network.\n port: Port to bind to.\n allow_origins: Allowed CORS origins.\n allow_credentials: Allow CORS credentials.\n allow_methods: Methods allowed for CORS.\n allow_headers: Headers allowed for CORS.\n ssl_certfile: SSL certificate file for HTTPS. See https://www.uvicorn.dev/settings/#https.\n ssl_keyfile: SSL key file for HTTPS. See https://www.uvicorn.dev/settings/#https.\n show_donation_link: Show the Donate to InvokeAI link in the frontend menus.\n log_tokenization: Enable logging of parsed prompt tokens.\n patchmatch: Enable patchmatch inpaint code.\n models_dir: Path to the models directory.\n convert_cache_dir: Path to the converted models cache directory (DEPRECATED, but do not delete because it is needed for migration from previous versions).\n download_cache_dir: Path to the directory that contains dynamically downloaded models.\n legacy_conf_dir: Path to directory of legacy checkpoint config files.\n db_dir: Path to InvokeAI databases directory.\n db_url: URL of a MySQL 8.4+ or MariaDB 10.11+ database to use instead of the SQLite database in `db_dir`, e.g. `mariadb+pymysql://invokeai:[email protected]/invokeai`. Needs the `mysql` extra. One InvokeAI process uses a database at a time. Read at startup only.\n db_synchronous: SQLite durability setting. `full`, the default and what InvokeAI has always used, flushes every commit to disk. `normal` acknowledges commits without waiting for that flush - measured at roughly 12x shorter commits on an SSD - and cannot corrupt the database under WAL, which is why it is refused, with a warning, when WAL is unavailable for the database file. What `normal` gives up is the most recent transactions on a power loss or OS crash: a just-written image record or queue status, not the image file itself.<br>Valid values: `full`, `normal`\n outputs_dir: Path to directory for outputs.\n image_subfolder_strategy: Strategy for organizing images into subfolders. 'flat' stores all images in a single folder. 'date' organizes by YYYY/MM/DD. 'type' organizes by image category. 'hash' uses first 2 characters of UUID for filesystem performance.<br>Valid values: `flat`, `date`, `type`, `hash`\n custom_nodes_dir: Path to directory for custom nodes.\n style_presets_dir: Path to directory for style presets.\n prompt_files_dir: Path to the directory holding prompt list files readable by the Prompts from File node. The node cannot read outside this directory.\n workflow_thumbnails_dir: Path to directory for workflow thumbnails.\n log_handlers: Log handler. Valid options are \"console\", \"file=<path>\", \"syslog=path|address:host:port\", \"http=<url>\".\n log_format: Log format. Use \"plain\" for text-only, \"color\" for colorized output, \"legacy\" for 2.3-style logging and \"syslog\" for syslog-style.<br>Valid values: `plain`, `color`, `syslog`, `legacy`\n log_level: Emit logging messages at this level or higher.<br>Valid values: `debug`, `info`, `warning`, `error`, `critical`\n log_sql: Log SQL queries. `log_level` must be `debug` for this to do anything. Extremely verbose.\n log_level_network: Log level for network-related messages. 'info' and 'debug' are very verbose.<br>Valid values: `debug`, `info`, `warning`, `error`, `critical`\n use_memory_db: Use in-memory database. Useful for development.\n dev_reload: Automatically reload when Python sources are changed. Does not reload node definitions.\n profile_graphs: Enable graph profiling using `cProfile`.\n profile_prefix: An optional prefix for profile output files.\n profiles_dir: Path to profiles output directory.\n max_cache_ram_gb: The maximum amount of CPU RAM to use for model caching in GB. If unset, the limit will be configured based on the available RAM. In most cases, it is recommended to leave this unset.\n max_cache_vram_gb: The amount of VRAM to use for model caching in GB. If unset, the limit will be configured based on the available VRAM and the device_working_mem_gb. In most cases, it is recommended to leave this unset.\n reserve_vram_gb: The amount of VRAM (in GB) to subtract from the model cache's available memory budget. Defaults to 0.\n log_memory_usage: If True, a memory snapshot will be captured before and after every model cache operation, and the result will be logged (at debug level). There is a time cost to capturing the memory snapshots, so it is recommended to only enable this feature if you are actively inspecting the model cache's behaviour.\n model_cache_keep_alive_min: How long to keep models in cache after last use, in minutes. A value of 0 (the default) means models are kept in cache indefinitely. If no model generations occur within the timeout period, the model cache is cleared using the same logic as the 'Clear Model Cache' button.\n device_working_mem_gb: The amount of working memory to keep available on the compute device (in GB). Has no effect if running on CPU. If you are experiencing OOM errors, try increasing this value.\n enable_partial_loading: Enable partial loading of models. This enables models to run with reduced VRAM requirements (at the cost of slower speed) by streaming the model from RAM to VRAM as its used. In some edge cases, partial loading can cause models to run more slowly if they were previously being fully loaded into VRAM.\n keep_ram_copy_of_weights: Whether to keep a full RAM copy of a model's weights when the model is loaded in VRAM. Keeping a RAM copy increases average RAM usage, but speeds up model switching and LoRA patching (assuming there is sufficient RAM). Set this to False if RAM pressure is consistently high.\n offload_on_architecture_switch: When a session uses main models of another architecture than the previous one on the same GPU, move every model it does not use from VRAM to RAM before it runs. Models both sessions use stay. Switching back reloads the moved models from RAM, which costs a few seconds per switch when both architectures would have fit in VRAM together; turn this off if you alternate between such models.\n clear_vram_after_session: After every queue item (each image of a batch), move the models held in VRAM to RAM and return the freed memory to the GPU driver. The models stay cached in RAM; the next item reloads them from there, which costs a few seconds (more with keep_ram_copy_of_weights off). Changes nothing where VRAM is system memory (CPU, MPS, integrated GPUs). Turn this on if a generation that runs fine the first time runs out of memory, or slows down sharply because the GPU spills into shared memory, when it is repeated.\n fp8_compute: Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU, or a ROCm GPU that passes an fp8 matmul probe; falls back automatically otherwise). Speeds up denoising and keeps the transformer at fp8 size - FP8 Storage alone also keeps it at that size, without the speedup - but quantizes activations as well, so images will differ from previous versions at the same seed. Reproducibility also requires the model to be FULLY resident in VRAM: a layer whose weights are still in RAM falls back to the dequantized path, and since which layers are resident shifts from run to run, the same seed then yields visibly different images. For repeatable output, ensure the model loads at 100% (e.g. enable_partial_loading=false with enough free VRAM).\n fp8_compute_full_precision_hints: Honor the per-layer 'full_precision_matrix_mult' flags that some scaled-fp8 checkpoints ship. Those layers then dequantize on every forward instead of using the fp8 tensor cores, which can cost a large part of the fp8_compute speedup - on checkpoints that mark many layers, most of it. Set to false to run every quantized layer on the fp8 tensor cores, ignoring the producer's instruction; faster, but the marked layers were flagged as numerically sensitive, so quality may suffer. Only has an effect when fp8_compute is enabled.\n int8_compute: Run the matmuls of ComfyUI int8 builds quantized with convrot ('int8_tensorwise' with 'convrot') on the int8 tensor cores instead of dequantizing their weights on every forward (requires an NVIDIA GPU with compute capability 8.0 or newer and Triton; falls back automatically otherwise, including on AMD, Apple and Intel GPUs and the CPU). Speeds up denoising with these builds, but quantizes activations per token as well, so images will differ from the dequantized path at the same seed. The kernels are tuned once per layer shape and token-count bucket: about 35 seconds for the first image after enabling it, about 1-5 seconds for a later size in a new token-count bucket, cached on disk across restarts.\n ram: DEPRECATED: This setting is no longer used. It has been replaced by `max_cache_ram_gb`, but most users will not need to use this config since automatic cache size limits should work well in most cases. This config setting will be removed once the new model cache behavior is stable.\n vram: DEPRECATED: This setting is no longer used. It has been replaced by `max_cache_vram_gb`, but most users will not need to use this config since automatic cache size limits should work well in most cases. This config setting will be removed once the new model cache behavior is stable.\n lazy_offload: DEPRECATED: This setting is no longer used. Lazy-offloading is enabled by default. This config setting will be removed once the new model cache behavior is stable.\n pytorch_cuda_alloc_conf: Configure the Torch CUDA memory allocator. This will impact peak reserved VRAM usage and performance. Setting to \"backend:cudaMallocAsync\" works well on many systems. The optimal configuration is highly dependent on the system configuration (device type, VRAM, CUDA driver version, etc.), so must be tuned experimentally. Unset on a ROCm build of PyTorch on Windows, \"expandable_segments:True\" is used.\n device: Preferred execution device. `auto` will choose the device depending on the hardware platform and the installed torch capabilities.<br>Valid values: `auto`, `cpu`, `cuda`, `mps`, `xpu`, `cuda:N`, `xpu:N` (where N is a device number)\n precision: Floating point precision. `float16` will consume half the memory of `float32` but produce slightly lower-quality images. The `auto` setting will guess the proper precision based on your video card and operating system.<br>Valid values: `auto`, `float16`, `bfloat16`, `float32`\n rocm_aotriton_experimental: Use AOTriton's fused (flash and memory-efficient) attention kernels on AMD GPUs that PyTorch marks experimental for them, such as the RX 7600/7700/7800 series, Ryzen AI 300/Max and the RX 9060 series, by setting TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL. Without them, attention on those GPUs runs on the slower math kernel, which also needs far more memory. `auto` turns them on only with a ROCm 10 build of PyTorch, and only when every GPU used for generation is one they were measured correct on (so far gfx1200, the RX 9060 series); `on` and `off` decide for any build and GPU. A TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL value already set in the environment takes precedence. Has no effect on other GPUs.<br>Valid values: `auto`, `on`, `off`\n sequential_guidance: Whether to calculate guidance in serial instead of in parallel, lowering memory requirements.\n noise_dtype: The dtype seeded noise is drawn in for SD1.5/SDXL, SD3, FLUX.1, FLUX.2, CogView4 and the Z-Image seed variance enhancer. `float32` draws the same noise on every platform. `float16` is the half-precision draw of earlier versions: on macOS it keeps the images your seeds gave before this update; on Windows and Linux both values give (nearly) the same images, and images made before the update cannot be reproduced there.<br>Valid values: `float32`, `float16`\n wan_memory_optimization: Enable experimental Wan memory optimizations at the cost of slower generation.\n pid_memory_optimization: Enable experimental PiD decode memory optimizations. Roughly halves the peak activation memory of a PiD decode; in exchange the decoded image changes slightly, because neither the chunked pixel pathway nor the float32 sampler intermediates are bit-exact with the default path.\n tiny_autoencoder_previews: Render denoising previews with an installed Tiny AutoEncoder instead of the linear latent projection. Install the matching Tiny AutoEncoder starter model; families without one keep linear previews. A preview costs a few tens of ms and up to about 1.1 GB of transient VRAM on an RTX 4090 (image decoders 0.15-0.65 GB, Wan video windows up to 1.1 GB); a TAE that does not fit in VRAM next to the running model can instead run on the CPU (its `Decode previews on CPU` setting in the model manager): previews are capped at 512 px there and a frame takes about 0.3-0.4 s (TAESDXL, TAEF2), 0.8-1.1 s (TAEW2.1, one frame) or 1.0-1.9 s (Wan two-frame window) on a Ryzen 9 7900 with 8 threads in float32, so previews update less often.\n attention_type: Attention type.<br>Valid values: `auto`, `normal`, `xformers`, `sliced`, `torch-sdp`\n attention_slice_size: Slice size, valid when attention_type==\"sliced\".<br>Valid values: `auto`, `balanced`, `max`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`\n attention_backend: Attention kernel for the attention inside diffusion models. `auto` uses PyTorch's exact SDPA kernels ranked flash, cuDNN, memory-efficient, math, taking the first one the GPU and build support for each call; it never selects a quantized one. `sage` uses SageAttention 2 for the models listed in the SageAttention docs: faster, most at high resolutions and for video, but quantized, so images differ slightly from `auto` at the same seed. SageAttention is installed separately and needs an NVIDIA GPU with compute capability 8.0 or newer; masked attention, text encoders and VAEs keep PyTorch SDPA. `cudnn`, `flash`, `efficient` and `math` rank that PyTorch kernel first for all attention on CUDA and ROCm GPUs, ahead of the `auto` order. That is never exclusive: a call the kernel cannot serve runs on the next kernel, and the log reports that once per node type and reason (not for the PiD decoder, whose attention is ranked the same but not reported). `math` materializes the full attention score matrix, so it is slow and needs much more memory, which the working-memory estimates of most model families do not reserve, so generations can run out of memory; it is meant for debugging. Images can differ slightly between kernels.<br>Valid values: `auto`, `sage`, `cudnn`, `flash`, `efficient`, `math`\n force_tiled_decode: Whether to enable tiled VAE decode (reduces memory consumption with some performance penalty). A tiled decode is not pixel-identical to a single-pass one: a VAE decoder normalises and attends over the whole image, so the difference is spread across it rather than confined to the tile seams. Also tiles the encode. Read by the SD1.5/SDXL, FLUX.1, FLUX.2, Z-Image, Qwen-Image and Qwen-Image-2.1 VAE nodes, the Anima encode, the Z-Image control encode and the Krea-2 style reference; other model families ignore it.\n auto_tiled_decode: Decode large images in tiles when an untiled decode's estimated working memory would take most of the GPU's memory (FLUX.1, FLUX.2, Z-Image, Qwen-Image, Qwen-Image-2.1, Krea-2 and Wan decodes, and Qwen-Image-2.1 encodes). Turn off to decode untiled unless tiling is requested; the FLUX.1, FLUX.2 and Z-Image decodes then still retry tiled after running out of memory. Anima keeps tiling a decode too large for its GPU either way, because tiling is what makes that case fast there.\n pil_compress_level: The compress_level setting of PIL.Image.save(), used for PNG encoding. All settings are lossless. 0 = no compression, 1 = fastest with slightly larger filesize, 9 = slowest with smallest filesize. 1 is typically the best setting.\n max_queue_size: Maximum number of items in the session queue.\n session_queue_mode: Session queue mode. Use 'FIFO' for traditional first-in-first-out, or 'round_robin' to serve each user's jobs in turn. In single-user mode, FIFO is always used regardless of this setting.<br>Valid values: `FIFO`, `round_robin`\n clear_queue_on_startup: Empties session queue on startup. If true, disables `max_queue_history`.\n max_queue_history: Keep the last N completed, failed, and canceled queue items. Older items are deleted on startup. Set to 0 to prune all terminal items. Ignored if `clear_queue_on_startup` is true.\n allow_nodes: List of nodes to allow. Omit to allow all.\n deny_nodes: List of nodes to deny. Omit to deny none.\n node_cache_size: How many cached nodes to keep in memory.\n hashing_algorithm: Model hashing algorthim for model installs. 'blake3_multi' is best for SSDs. 'blake3_single' is best for spinning disk HDDs. 'random' disables hashing, instead assigning a UUID to models. Useful when using a memory db to reduce model installation time, or if you don't care about storing stable hashes for models. Alternatively, any other hashlib algorithm is accepted, though these are not nearly as performant as blake3.<br>Valid values: `blake3_multi`, `blake3_single`, `random`, `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, `blake2b`, `blake2s`, `sha3_224`, `sha3_256`, `sha3_384`, `sha3_512`, `shake_128`, `shake_256`\n remote_api_tokens: List of regular expression and token pairs used when downloading models from URLs. The download URL is tested against the regex, and if it matches, the token is provided in as a Bearer token.\n scan_models_on_startup: Scan the models directory on startup, registering orphaned models. This is typically only used in conjunction with `use_memory_db` for testing purposes.\n allow_private_download_urls: Allow the download queue to fetch from loopback, link-local and private-network addresses. Disabled by default so that a download URL cannot be used to reach services that are only reachable from the server. Enable this only if you install models from a mirror on your own network.\n download_proxy: Optional HTTP proxy for model downloads. The proxy must enforce the public-address policy because proxy-side DNS cannot be checked by InvokeAI.\n unsafe_disable_picklescan: UNSAFE. Disable the picklescan security check during model installation. Recommended only for development and testing purposes. This will allow arbitrary code execution during model installation, so should never be used in production.\n allow_unknown_models: Allow installation of models that we are unable to identify. If enabled, models will be marked as `unknown` in the database, and will not have any metadata associated with them. If disabled, unknown models will be rejected during installation.\n multiuser: Enable multiuser support. When disabled, the application runs in single-user mode using a default system account with administrator privileges. When enabled, requires user authentication and authorization.\n strict_password_checking: Enforce strict password requirements. When True, passwords must contain uppercase, lowercase, and numbers. When False (default), any password is accepted but its strength (weak/moderate/strong) is reported to the user.\n image_index_enabled: Maintain a semantic embedding index of gallery images and videos, used by the image map and semantic search features.\n image_index_model: Name of the installed CLIP Vision or SigLIP model used to embed gallery images and video thumbnails. Changing the model discards embeddings computed by the previous model.\n image_index_device: Set to `cpu` to compute image embeddings on the CPU with a service-local copy of the model - avoids VRAM use and lets indexing run during generations. Any other value is ignored: embeddings otherwise run on the model cache's device, pausing while generations are in progress.\n image_index_batch_size: Number of gallery items embedded per batch by the image index worker.\n external_alibabacloud_api_key: API key for Alibaba Cloud DashScope image generation.\n external_alibabacloud_base_url: Base URL override for Alibaba Cloud DashScope image generation.\n external_atlascloud_api_key: API key for Atlas Cloud image generation.\n external_atlascloud_base_url: Base URL override for Atlas Cloud image generation.\n external_gemini_api_key: API key for Gemini image generation.\n external_openai_api_key: API key for OpenAI image generation.\n external_gemini_base_url: Base URL override for Gemini image generation.\n external_openai_base_url: Base URL override for OpenAI image generation.\n external_seedream_api_key: API key for Seedream image generation.\n external_seedream_base_url: Base URL override for Seedream image generation.\n base_url: Public base path when running behind a reverse proxy under a sub-path, e.g. `/invoke`. Set only when the proxy PRESERVES the sub-path (the backend receives `/invoke/api/...`). Leave unset when the proxy strips the sub-path or when serving at the domain root.\n forwarded_allow_ips: Comma-separated list of IPs (or `*`) allowed to set X-Forwarded-* headers. Set to the reverse proxy's IP. Only used when `base_url` is set.\n http_compression_level: Compression level for gzipped HTTP API responses. 0 disables response compression entirely, 1 is fastest, 9 (the default) is smallest. Compression runs on the event loop and blocks the whole server while it works, and level 9 costs about 5.5x the time of level 1 for 0.4 percentage points of extra compression, so lowering this makes the app noticeably more responsive on large libraries. Set to 0 when a reverse proxy already compresses responses."+ "description": "Invoke's global app configuration.\n\nTypically, you won't need to interact with this class directly. Instead, use the `get_config` function from `invokeai.app.services.config` to get a singleton config object.\n\nAttributes:\n host: IP address to bind to. Use `0.0.0.0` to serve to your local network.\n port: Port to bind to.\n allow_origins: Allowed CORS origins.\n allow_credentials: Allow CORS credentials.\n allow_methods: Methods allowed for CORS.\n allow_headers: Headers allowed for CORS.\n ssl_certfile: SSL certificate file for HTTPS. See https://www.uvicorn.dev/settings/#https.\n ssl_keyfile: SSL key file for HTTPS. See https://www.uvicorn.dev/settings/#https.\n show_donation_link: Show the Donate to InvokeAI link in the frontend menus.\n log_tokenization: Enable logging of parsed prompt tokens.\n patchmatch: Enable patchmatch inpaint code.\n models_dir: Path to the models directory.\n convert_cache_dir: Path to the converted models cache directory (DEPRECATED, but do not delete because it is needed for migration from previous versions).\n download_cache_dir: Path to the directory that contains dynamically downloaded models.\n legacy_conf_dir: Path to directory of legacy checkpoint config files.\n db_dir: Path to InvokeAI databases directory.\n db_url: URL of a MySQL 8.4+ or MariaDB 10.11+ database to use instead of the SQLite database in `db_dir`, e.g. `mariadb+pymysql://invokeai:[email protected]/invokeai`. Needs the `mysql` extra. One InvokeAI process uses a database at a time. Read at startup only.\n db_synchronous: SQLite durability setting. `full`, the default and what InvokeAI has always used, flushes every commit to disk. `normal` acknowledges commits without waiting for that flush - measured at roughly 12x shorter commits on an SSD - and cannot corrupt the database under WAL, which is why it is refused, with a warning, when WAL is unavailable for the database file. What `normal` gives up is the most recent transactions on a power loss or OS crash: a just-written image record or queue status, not the image file itself.<br>Valid values: `full`, `normal`\n outputs_dir: Path to directory for outputs.\n image_subfolder_strategy: Strategy for organizing images into subfolders. 'flat' stores all images in a single folder. 'date' organizes by YYYY/MM/DD. 'type' organizes by image category. 'hash' uses first 2 characters of UUID for filesystem performance.<br>Valid values: `flat`, `date`, `type`, `hash`\n custom_nodes_dir: Path to directory for custom nodes.\n style_presets_dir: Path to directory for style presets.\n prompt_files_dir: Path to the directory holding prompt list files readable by the Prompts from File node. The node cannot read outside this directory.\n workflow_thumbnails_dir: Path to directory for workflow thumbnails.\n log_handlers: Log handler. Valid options are \"console\", \"file=<path>\", \"syslog=path|address:host:port\", \"http=<url>\".\n log_format: Log format. Use \"plain\" for text-only, \"color\" for colorized output, \"legacy\" for 2.3-style logging and \"syslog\" for syslog-style.<br>Valid values: `plain`, `color`, `syslog`, `legacy`\n log_level: Emit logging messages at this level or higher.<br>Valid values: `debug`, `info`, `warning`, `error`, `critical`\n log_sql: Log SQL queries. `log_level` must be `debug` for this to do anything. Extremely verbose.\n log_level_network: Log level for network-related messages. 'info' and 'debug' are very verbose.<br>Valid values: `debug`, `info`, `warning`, `error`, `critical`\n use_memory_db: Use in-memory database. Useful for development.\n dev_reload: Automatically reload when Python sources are changed. Does not reload node definitions.\n profile_graphs: Enable graph profiling using `cProfile`.\n profile_prefix: An optional prefix for profile output files.\n profiles_dir: Path to profiles output directory.\n max_cache_ram_gb: The maximum amount of CPU RAM to use for model caching in GB. If unset, the limit will be configured based on the available RAM. In most cases, it is recommended to leave this unset.\n max_cache_vram_gb: The amount of VRAM to use for model caching in GB. If unset, the limit will be configured based on the available VRAM and the device_working_mem_gb. In most cases, it is recommended to leave this unset.\n reserve_vram_gb: The amount of VRAM (in GB) to subtract from the model cache's available memory budget. Defaults to 0.\n log_memory_usage: If True, a memory snapshot will be captured before and after every model cache operation, and the result will be logged (at debug level). There is a time cost to capturing the memory snapshots, so it is recommended to only enable this feature if you are actively inspecting the model cache's behaviour.\n model_cache_keep_alive_min: How long to keep models in cache after last use, in minutes. A value of 0 (the default) means models are kept in cache indefinitely. If no model generations occur within the timeout period, the model cache is cleared using the same logic as the 'Clear Model Cache' button.\n device_working_mem_gb: The amount of working memory to keep available on the compute device (in GB). Has no effect if running on CPU. If you are experiencing OOM errors, try increasing this value.\n enable_partial_loading: Enable partial loading of models. This enables models to run with reduced VRAM requirements (at the cost of slower speed) by streaming the model from RAM to VRAM as its used. In some edge cases, partial loading can cause models to run more slowly if they were previously being fully loaded into VRAM.\n keep_ram_copy_of_weights: Whether to keep a full RAM copy of a model's weights when the model is loaded in VRAM. Keeping a RAM copy increases average RAM usage, but speeds up model switching and LoRA patching (assuming there is sufficient RAM). Set this to False if RAM pressure is consistently high.\n offload_on_architecture_switch: When a session uses main models of another architecture than the previous one on the same GPU, move every model it does not use from VRAM to RAM before it runs. Models both sessions use stay. Switching back reloads the moved models from RAM, which costs a few seconds per switch when both architectures would have fit in VRAM together; turn this off if you alternate between such models.\n clear_vram_after_session: After every queue item (each image of a batch), move the models held in VRAM to RAM and return the freed memory to the GPU driver. The models stay cached in RAM; the next item reloads them from there, which costs a few seconds (more with keep_ram_copy_of_weights off). Changes nothing where VRAM is system memory (CPU, MPS, integrated GPUs). Turn this on if a generation that runs fine the first time runs out of memory, or slows down sharply because the GPU spills into shared memory, when it is repeated.\n fp8_compute: Keep ComfyUI 'scaled fp8' checkpoints quantized instead of dequantizing them at load, and run their matmuls on the fp8 tensor cores (requires an Ada/SM 8.9 or newer NVIDIA GPU, or a ROCm GPU that passes an fp8 matmul probe; falls back automatically otherwise). Speeds up denoising and keeps the transformer at fp8 size - FP8 Storage alone also keeps it at that size, without the speedup - but quantizes activations as well, so images will differ from previous versions at the same seed. Reproducibility also requires the model to be FULLY resident in VRAM: a layer whose weights are still in RAM falls back to the dequantized path, and since which layers are resident shifts from run to run, the same seed then yields visibly different images. For repeatable output, ensure the model loads at 100% (e.g. enable_partial_loading=false with enough free VRAM).\n fp8_compute_full_precision_hints: Honor the per-layer 'full_precision_matrix_mult' flags that some scaled-fp8 checkpoints ship. Those layers then dequantize on every forward instead of using the fp8 tensor cores, which can cost a large part of the fp8_compute speedup - on checkpoints that mark many layers, most of it. Set to false to run every quantized layer on the fp8 tensor cores, ignoring the producer's instruction; faster, but the marked layers were flagged as numerically sensitive, so quality may suffer. Only has an effect when fp8_compute is enabled.\n int8_compute: Run the matmuls of ComfyUI int8 builds quantized with convrot ('int8_tensorwise' with 'convrot') on the int8 tensor cores instead of dequantizing their weights on every forward (requires an NVIDIA GPU with compute capability 8.0 or newer and Triton; falls back automatically otherwise, including on AMD, Apple and Intel GPUs and the CPU). Speeds up denoising with these builds, but quantizes activations per token as well, so images will differ from the dequantized path at the same seed. The kernels are tuned once per layer shape and token-count bucket: about 35 seconds for the first image after enabling it, about 1-5 seconds for a later size in a new token-count bucket, cached on disk across restarts.\n ram: DEPRECATED: This setting is no longer used. It has been replaced by `max_cache_ram_gb`, but most users will not need to use this config since automatic cache size limits should work well in most cases. This config setting will be removed once the new model cache behavior is stable.\n vram: DEPRECATED: This setting is no longer used. It has been replaced by `max_cache_vram_gb`, but most users will not need to use this config since automatic cache size limits should work well in most cases. This config setting will be removed once the new model cache behavior is stable.\n lazy_offload: DEPRECATED: This setting is no longer used. Lazy-offloading is enabled by default. This config setting will be removed once the new model cache behavior is stable.\n pytorch_cuda_alloc_conf: Configure the Torch CUDA memory allocator. This will impact peak reserved VRAM usage and performance. Setting to \"backend:cudaMallocAsync\" works well on many systems. The optimal configuration is highly dependent on the system configuration (device type, VRAM, CUDA driver version, etc.), so must be tuned experimentally. Unset on a ROCm build of PyTorch on Windows, \"expandable_segments:True\" is used.\n device: Preferred execution device. `auto` will choose the device depending on the hardware platform and the installed torch capabilities.<br>Valid values: `auto`, `cpu`, `cuda`, `mps`, `xpu`, `cuda:N`, `xpu:N` (where N is a device number)\n precision: Floating point precision. `float16` will consume half the memory of `float32` but produce slightly lower-quality images. The `auto` setting will guess the proper precision based on your video card and operating system.<br>Valid values: `auto`, `float16`, `bfloat16`, `float32`\n rocm_aotriton_experimental: Use AOTriton's fused (flash and memory-efficient) attention kernels on AMD GPUs that PyTorch marks experimental for them, such as the RX 7600/7700/7800 series, Ryzen AI 300/Max and the RX 9060 series, by setting TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL. Without them, attention on those GPUs runs on the slower math kernel, which also needs far more memory. `auto` turns them on only with a ROCm 10 build of PyTorch, and only when every GPU used for generation is one they were measured correct on (so far gfx1200, the RX 9060 series); `on` and `off` decide for any build and GPU. A TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL value already set in the environment takes precedence. Has no effect on other GPUs.<br>Valid values: `auto`, `on`, `off`\n sequential_guidance: Whether to calculate guidance in serial instead of in parallel, lowering memory requirements.\n noise_dtype: The dtype seeded noise is drawn in for SD1.5/SDXL, SD3, FLUX.1, FLUX.2, CogView4 and the Z-Image seed variance enhancer. `float32` draws the same noise on every platform. `float16` is the half-precision draw of earlier versions: on macOS it keeps the images your seeds gave before this update; on Windows and Linux both values give (nearly) the same images, and images made before the update cannot be reproduced there.<br>Valid values: `float32`, `float16`\n wan_memory_optimization: Enable experimental Wan memory optimizations at the cost of slower generation.\n pid_memory_optimization: Enable experimental PiD decode memory optimizations. Roughly halves the peak activation memory of a PiD decode; in exchange the decoded image changes slightly, because neither the chunked pixel pathway nor the float32 sampler intermediates are bit-exact with the default path.\n tiny_autoencoder_previews: Render denoising previews with an installed Tiny AutoEncoder instead of the linear latent projection. Install the matching Tiny AutoEncoder starter model; families without one keep linear previews. A preview costs a few tens of ms and up to about 1.1 GB of transient VRAM on an RTX 4090 (image decoders 0.15-0.65 GB, Wan video windows up to 1.1 GB); a TAE that does not fit in VRAM next to the running model can instead run on the CPU (its `Decode previews on CPU` setting in the model manager): previews are capped at 512 px there and a frame takes about 0.3-0.4 s (TAESDXL, TAEF2), 0.8-1.1 s (TAEW2.1, one frame) or 1.0-1.9 s (Wan two-frame window) on a Ryzen 9 7900 with 8 threads in float32, so previews update less often.\n attention_type: Attention type.<br>Valid values: `auto`, `normal`, `xformers`, `sliced`, `torch-sdp`\n attention_slice_size: Slice size, valid when attention_type==\"sliced\".<br>Valid values: `auto`, `balanced`, `max`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`\n attention_backend: Attention kernel for the attention inside diffusion models. `auto` uses PyTorch's exact SDPA kernels ranked flash, cuDNN, memory-efficient, math, taking the first one the GPU and build support for each call; it never selects a quantized one. `sage` uses SageAttention 2 for the models listed in the SageAttention docs: faster, most at high resolutions and for video, but quantized, so images differ slightly from `auto` at the same seed. SageAttention is installed separately and needs an NVIDIA GPU with compute capability 8.0 or newer; masked attention, text encoders and VAEs keep PyTorch SDPA. `cudnn`, `flash`, `efficient` and `math` rank that PyTorch kernel first for all attention on CUDA and ROCm GPUs, ahead of the `auto` order. That is never exclusive: a call the kernel cannot serve runs on the next kernel, and the log reports that once per node type and reason (not for the PiD decoder, whose attention is ranked the same but not reported). `math` materializes the full attention score matrix, so it is slow and needs much more memory, which the working-memory estimates of most model families do not reserve, so generations can run out of memory; it is meant for debugging. Images can differ slightly between kernels.<br>Valid values: `auto`, `sage`, `cudnn`, `flash`, `efficient`, `math`\n force_tiled_decode: Whether to enable tiled VAE decode (reduces memory consumption with some performance penalty). A tiled decode is not pixel-identical to a single-pass one: a VAE decoder normalises and attends over the whole image, so the difference is spread across it rather than confined to the tile seams. Also tiles the encode. Read by the SD1.5/SDXL, FLUX.1, FLUX.2, Z-Image, Qwen-Image and Qwen-Image-2.1 VAE nodes, the Anima encode, the Z-Image control encode and the Krea-2 style reference; other model families ignore it.\n auto_tiled_decode: Decode large images in tiles when an untiled decode's estimated working memory would take most of the GPU's memory (FLUX.1, FLUX.2, Z-Image, Qwen-Image, Qwen-Image-2.1, Krea-2 and Wan decodes, and Qwen-Image-2.1 encodes). Turn off to decode untiled unless tiling is requested; the FLUX.1, FLUX.2 and Z-Image decodes then still retry tiled after running out of memory. Anima keeps tiling a decode too large for its GPU either way, because tiling is what makes that case fast there.\n pil_compress_level: The compress_level setting of PIL.Image.save(), used for PNG encoding. All settings are lossless. 0 = no compression, 1 = fastest with slightly larger filesize, 9 = slowest with smallest filesize. 1 is typically the best setting.\n max_queue_size: Maximum number of items in the session queue.\n session_queue_mode: Session queue mode. Use 'FIFO' for traditional first-in-first-out, or 'round_robin' to serve each user's jobs in turn. In single-user mode, FIFO is always used regardless of this setting.<br>Valid values: `FIFO`, `round_robin`\n clear_queue_on_startup: Empties session queue on startup. If true, disables `max_queue_history`.\n max_queue_history: Keep the last N completed, failed, and canceled queue items. Older items are deleted on startup. Set to 0 to prune all terminal items. Ignored if `clear_queue_on_startup` is true.\n allow_nodes: List of nodes to allow. Omit to allow all.\n deny_nodes: List of nodes to deny. Omit to deny none.\n node_cache_size: How many cached nodes to keep in memory.\n hashing_algorithm: Model hashing algorthim for model installs. 'blake3_multi' is best for SSDs. 'blake3_single' is best for spinning disk HDDs. 'random' disables hashing, instead assigning a UUID to models. Useful when using a memory db to reduce model installation time, or if you don't care about storing stable hashes for models. Alternatively, any other hashlib algorithm is accepted, though these are not nearly as performant as blake3.<br>Valid values: `blake3_multi`, `blake3_single`, `random`, `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, `blake2b`, `blake2s`, `sha3_224`, `sha3_256`, `sha3_384`, `sha3_512`, `shake_128`, `shake_256`\n remote_api_tokens: List of regular expression and token pairs used when downloading models from URLs. The download URL is tested against the regex, and if it matches, the token is provided in as a Bearer token.\n scan_models_on_startup: Scan the models directory on startup, registering orphaned models. This is typically only used in conjunction with `use_memory_db` for testing purposes.\n allow_private_download_urls: Allow the download queue to fetch from loopback, link-local and private-network addresses. Disabled by default so that a download URL cannot be used to reach services that are only reachable from the server. Enable this only if you install models from a mirror on your own network.\n download_proxy: Optional HTTP proxy for model downloads. The proxy must enforce the public-address policy because proxy-side DNS cannot be checked by InvokeAI.\n unsafe_disable_picklescan: UNSAFE. Disable the picklescan security check during model installation. Recommended only for development and testing purposes. This will allow arbitrary code execution during model installation, so should never be used in production.\n allow_unknown_models: Allow installation of models that we are unable to identify. If enabled, models will be marked as `unknown` in the database, and will not have any metadata associated with them. If disabled, unknown models will be rejected during installation.\n multiuser: Enable multiuser support (the default). Requires user authentication and authorization; the first visitor creates the administrator account. Set to false for single-user mode, which uses a default system account with administrator privileges and no sign-in: anyone who can reach the server then has full control of it. Single-user mode is deprecated.\n strict_password_checking: Enforce strict password requirements. When True, passwords must contain uppercase, lowercase, and numbers. When False (default), any password is accepted but its strength (weak/moderate/strong) is reported to the user.\n image_index_enabled: Maintain a semantic embedding index of gallery images and videos, used by the image map and semantic search features.\n image_index_model: Name of the installed CLIP Vision or SigLIP model used to embed gallery images and video thumbnails. Changing the model discards embeddings computed by the previous model.\n image_index_device: Set to `cpu` to compute image embeddings on the CPU with a service-local copy of the model - avoids VRAM use and lets indexing run during generations. Any other value is ignored: embeddings otherwise run on the model cache's device, pausing while generations are in progress.\n image_index_batch_size: Number of gallery items embedded per batch by the image index worker.\n external_alibabacloud_api_key: API key for Alibaba Cloud DashScope image generation.\n external_alibabacloud_base_url: Base URL override for Alibaba Cloud DashScope image generation.\n external_atlascloud_api_key: API key for Atlas Cloud image generation.\n external_atlascloud_base_url: Base URL override for Atlas Cloud image generation.\n external_gemini_api_key: API key for Gemini image generation.\n external_openai_api_key: API key for OpenAI image generation.\n external_gemini_base_url: Base URL override for Gemini image generation.\n external_openai_base_url: Base URL override for OpenAI image generation.\n external_seedream_api_key: API key for Seedream image generation.\n external_seedream_base_url: Base URL override for Seedream image generation.\n base_url: Public base path when running behind a reverse proxy under a sub-path, e.g. `/invoke`. Set only when the proxy PRESERVES the sub-path (the backend receives `/invoke/api/...`). Leave unset when the proxy strips the sub-path or when serving at the domain root.\n forwarded_allow_ips: Comma-separated list of IPs (or `*`) allowed to set X-Forwarded-* headers. Set to the reverse proxy's IP. Only used when `base_url` is set.\n http_compression_level: Compression level for gzipped HTTP API responses. 0 disables response compression entirely, 1 is fastest, 9 (the default) is smallest. Compression runs on the event loop and blocks the whole server while it works, and level 9 costs about 5.5x the time of level 1 for 0.4 percentage points of extra compression, so lowering this makes the app noticeably more responsive on large libraries. Set to 0 when a reverse proxy already compresses responses."},"InvokeAIAppConfigWithSetFields": {"properties": {@@ -116090,6 +116090,12 @@],"title": "Admin Email","description": "Email of the first active admin user, if any"+ },+ "has_single_user_work": {+ "type": "boolean",+ "title": "Has Single User Work",+ "description": "Whether work made in single-user mode exists that new accounts will not see; only during setup",+ "default": false}},"type": "object",diff --git a/invokeai/frontend/api/schema.ts b/invokeai/frontend/api/schema.tsindex 9e1d99f179..4b962627dd 100644--- a/invokeai/frontend/api/schema.ts+++ b/invokeai/frontend/api/schema.ts@@ -25310,7 +25310,7 @@ export type components = {* download_proxy: Optional HTTP proxy for model downloads. The proxy must enforce the public-address policy because proxy-side DNS cannot be checked by InvokeAI.* unsafe_disable_picklescan: UNSAFE. Disable the picklescan security check during model installation. Recommended only for development and testing purposes. This will allow arbitrary code execution during model installation, so should never be used in production.* allow_unknown_models: Allow installation of models that we are unable to identify. If enabled, models will be marked as `unknown` in the database, and will not have any metadata associated with them. If disabled, unknown models will be rejected during installation.- * multiuser: Enable multiuser support. When disabled, the application runs in single-user mode using a default system account with administrator privileges. When enabled, requires user authentication and authorization.+ * multiuser: Enable multiuser support (the default). Requires user authentication and authorization; the first visitor creates the administrator account. Set to false for single-user mode, which uses a default system account with administrator privileges and no sign-in: anyone who can reach the server then has full control of it. Single-user mode is deprecated.* strict_password_checking: Enforce strict password requirements. When True, passwords must contain uppercase, lowercase, and numbers. When False (default), any password is accepted but its strength (weak/moderate/strong) is reported to the user.* image_index_enabled: Maintain a semantic embedding index of gallery images and videos, used by the image map and semantic search features.* image_index_model: Name of the installed CLIP Vision or SigLIP model used to embed gallery images and video thumbnails. Changing the model discards embeddings computed by the previous model.@@ -25901,8 +25901,8 @@ export type components = {allow_unknown_models?: boolean;/*** Multiuser- * @description Enable multiuser support. When disabled, the application runs in single-user mode using a default system account with administrator privileges. When enabled, requires user authentication and authorization.- * @default false+ * @description Enable multiuser support (the default). Requires user authentication and authorization; the first visitor creates the administrator account. Set to false for single-user mode, which uses a default system account with administrator privileges and no sign-in: anyone who can reach the server then has full control of it. Single-user mode is deprecated.+ * @default true*/multiuser?: boolean;/**@@ -50852,6 +50852,12 @@ export type components = {* @description Email of the first active admin user, if any*/admin_email?: string | null;+ /**+ * Has Single User Work+ * @description Whether work made in single-user mode exists that new accounts will not see; only during setup+ * @default false+ */+ has_single_user_work?: boolean;};/*** Show Imagediff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex 1d4406592a..92dc143cb1 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -383,6 +383,9 @@"sessionExpired": "Your session expired. Sign in again to pick up where you left off.","sessionEndingTitle": "Your session ends soon","sessionEndingDescription": "You'll be signed out at {{time}} if nothing is edited, saved or queued before then. Signing back in returns you here.",+ "setupEarlierWorkDescription": "This installation has work made without an account. Projects, wildcards, your own prompt templates and uploaded fonts won't appear in the account you create here. Nothing is deleted: you can create the account now and bring that work over later.",+ "setupEarlierWorkGuide": "How to bring your earlier work over",+ "setupEarlierWorkTitle": "Your earlier work is kept","setupFooter": "You can add more users later from Users in the Launchpad.","setupSubtitle": "Create the administrator account to get started.","setupTitle": "Set up Invoke",diff --git a/invokeai/frontend/webv2/scripts/mock-backend.mjs b/invokeai/frontend/webv2/scripts/mock-backend.mjsindex a68ef70d2d..b9b044eb66 100644--- a/invokeai/frontend/webv2/scripts/mock-backend.mjs+++ b/invokeai/frontend/webv2/scripts/mock-backend.mjs@@ -1451,6 +1451,7 @@ export const startMockBackend = async (port, { clock = Date.now, profile = 'emptif (method === 'GET' && path === '/api/v1/auth/status') {return json(200, {admin_email: null,+ has_single_user_work: false,multiuser_enabled: isMultiuserCaller(faults),setup_required: false,strict_password_checking: false,diff --git a/invokeai/frontend/webv2/src/app/RouterErrorScreen.browser.test.tsx b/invokeai/frontend/webv2/src/app/RouterErrorScreen.browser.test.tsxindex ee661e7bfa..1d27104e38 100644--- a/invokeai/frontend/webv2/src/app/RouterErrorScreen.browser.test.tsx+++ b/invokeai/frontend/webv2/src/app/RouterErrorScreen.browser.test.tsx@@ -16,6 +16,7 @@ vi.mock('@features/identity/session', async (importOriginal) => {const singleUser: SessionModule.AuthSession = {accountEpoch: 1,expiredUserId: null,+ hasSingleUserWork: false,multiuserEnabled: false,phase: 'ready',sessionExpired: false,diff --git a/invokeai/frontend/webv2/src/features/identity/capabilities.test.ts b/invokeai/frontend/webv2/src/features/identity/capabilities.test.tsindex 85ef340cf7..3c8b19e4d3 100644--- a/invokeai/frontend/webv2/src/features/identity/capabilities.test.ts+++ b/invokeai/frontend/webv2/src/features/identity/capabilities.test.ts@@ -7,6 +7,7 @@ import { getCapabilities } from './capabilities';const session = (overrides: Partial<AuthSession>): AuthSession => ({accountEpoch: 0,expiredUserId: null,+ hasSingleUserWork: false,multiuserEnabled: true,phase: 'ready',sessionExpired: false,diff --git a/invokeai/frontend/webv2/src/features/identity/credential.test.ts b/invokeai/frontend/webv2/src/features/identity/credential.test.tsindex ec0521e0fd..8cf0a009c2 100644--- a/invokeai/frontend/webv2/src/features/identity/credential.test.ts+++ b/invokeai/frontend/webv2/src/features/identity/credential.test.ts@@ -123,6 +123,7 @@ const authRoutes = (request: SentRequest): Response => {case '/api/v1/auth/status':return json({admin_email: null,+ has_single_user_work: false,multiuser_enabled: true,setup_required: false,strict_password_checking: false,diff --git a/invokeai/frontend/webv2/src/features/identity/credentialSync.browser.test.ts b/invokeai/frontend/webv2/src/features/identity/credentialSync.browser.test.tsindex 4e41d127f0..64a344403a 100644--- a/invokeai/frontend/webv2/src/features/identity/credentialSync.browser.test.ts+++ b/invokeai/frontend/webv2/src/features/identity/credentialSync.browser.test.ts@@ -73,6 +73,7 @@ const backend = (request: SentRequest): Response | Promise<Response> => {case '/api/v1/auth/status':return json({admin_email: null,+ has_single_user_work: false,multiuser_enabled: true,setup_required: false,strict_password_checking: false,diff --git a/invokeai/frontend/webv2/src/features/identity/data/api.ts b/invokeai/frontend/webv2/src/features/identity/data/api.tsindex ad3de12b43..0c050d6ba5 100644--- a/invokeai/frontend/webv2/src/features/identity/data/api.ts+++ b/invokeai/frontend/webv2/src/features/identity/data/api.ts@@ -20,6 +20,7 @@ export interface AuthStatus {multiuser_enabled: boolean;strict_password_checking: boolean;admin_email: string | null;+ has_single_user_work: boolean;}export interface LoginRequest {diff --git a/invokeai/frontend/webv2/src/features/identity/session.test.ts b/invokeai/frontend/webv2/src/features/identity/session.test.tsindex 0191136066..c86ce91f94 100644--- a/invokeai/frontend/webv2/src/features/identity/session.test.ts+++ b/invokeai/frontend/webv2/src/features/identity/session.test.ts@@ -188,6 +188,7 @@ beforeEach(async () => {api.getAuthStatus.mockResolvedValue({admin_email: '[email protected]',+ has_single_user_work: false,multiuser_enabled: true,setup_required: false,strict_password_checking: true,diff --git a/invokeai/frontend/webv2/src/features/identity/session.ts b/invokeai/frontend/webv2/src/features/identity/session.tsindex e64e710e30..695270253b 100644--- a/invokeai/frontend/webv2/src/features/identity/session.ts+++ b/invokeai/frontend/webv2/src/features/identity/session.ts@@ -33,6 +33,8 @@ export interface AuthSession {phase: 'unknown' | 'unavailable' | 'ready';multiuserEnabled: boolean;setupRequired: boolean;+ /** During setup only: work made without an account exists, which the account being created will not see. */+ hasSingleUserWork: boolean;strictPasswordChecking: boolean;user: UserDTO | null;sessionExpired: boolean;@@ -46,6 +48,7 @@ const store = createExternalStore<AuthSession>({accountEpoch: 0,multiuserEnabled: false,expiredUserId: null,+ hasSingleUserWork: false,phase: 'unknown',sessionExpired: false,setupRequired: false,@@ -614,6 +617,7 @@ const publishUnavailableSession = (): AuthSession => {const accountEpoch = endLifetime();store.patchSnapshot({accountEpoch,+ hasSingleUserWork: false,multiuserEnabled: false,phase: 'unavailable',setupRequired: false,@@ -733,6 +737,7 @@ const resolveSession = async (): Promise<AuthSession> => {accountEpoch,multiuserEnabled: status.multiuser_enabled,expiredUserId: user === null ? expiredUserId : null,+ hasSingleUserWork: status.has_single_user_work,phase: 'ready',sessionExpired,setupRequired: status.setup_required,@@ -798,6 +803,7 @@ const followStoredPrincipal = async (token: string): Promise<void> => {const accountEpoch = activateAccount(principal.user, token);store.patchSnapshot({accountEpoch,+ hasSingleUserWork: false,sessionExpired: false,setupRequired: false,switchingAccount: false,@@ -994,7 +1000,7 @@ export const completeAdminSetup = async (password: string): Promise<void> => {await setupAdmin({ display_name: displayName, email, password });- store.patchSnapshot({ setupRequired: false });+ store.patchSnapshot({ hasSingleUserWork: false, setupRequired: false });await loginWithCredentials(email, password, false);};diff --git a/invokeai/frontend/webv2/src/features/identity/ui/AccountMenu.browser.test.tsx b/invokeai/frontend/webv2/src/features/identity/ui/AccountMenu.browser.test.tsxindex aeb358b4cc..bb68225a95 100644--- a/invokeai/frontend/webv2/src/features/identity/ui/AccountMenu.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/identity/ui/AccountMenu.browser.test.tsx@@ -14,6 +14,7 @@ vi.mock('@features/identity/session', async (importOriginal) => {const session: SessionModule.AuthSession = {accountEpoch: 1,expiredUserId: null,+ hasSingleUserWork: false,multiuserEnabled: true,phase: 'ready',sessionExpired: false,diff --git a/invokeai/frontend/webv2/src/features/identity/ui/LoginScreen.browser.test.tsx b/invokeai/frontend/webv2/src/features/identity/ui/LoginScreen.browser.test.tsxindex d269758564..d5cd809212 100644--- a/invokeai/frontend/webv2/src/features/identity/ui/LoginScreen.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/identity/ui/LoginScreen.browser.test.tsx@@ -25,6 +25,7 @@ const identity = vi.hoisted(() => ({ loginWithCredentials: vi.fn() }));const sessionStore = createExternalStore<AuthSession>({accountEpoch: 1,expiredUserId: null,+ hasSingleUserWork: false,multiuserEnabled: true,phase: 'ready',sessionExpired: false,diff --git a/invokeai/frontend/webv2/src/features/identity/ui/SetupScreen.browser.test.tsx b/invokeai/frontend/webv2/src/features/identity/ui/SetupScreen.browser.test.tsxnew file mode 100644index 0000000000..b9f5d6dde2--- /dev/null+++ b/invokeai/frontend/webv2/src/features/identity/ui/SetupScreen.browser.test.tsx@@ -0,0 +1,85 @@+import type { AuthSession } from '@features/identity/session';++import { ChakraProvider } from '@chakra-ui/react';+import { DOCS_URL } from '@platform/runtime/appMetadata';+import { createExternalStore } from '@platform/state/externalStore';+import { system } from '@theme/system';+import { createInstance } from 'i18next';+import { act } from 'react';+import { createRoot, type Root } from 'react-dom/client';+import { I18nextProvider, initReactI18next } from 'react-i18next';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { page } from 'vitest/browser';++import { SetupScreen } from './SetupScreen';++const sessionStore = createExternalStore<AuthSession>({+ accountEpoch: 0,+ expiredUserId: null,+ hasSingleUserWork: false,+ multiuserEnabled: true,+ phase: 'ready',+ sessionExpired: false,+ setupRequired: true,+ strictPasswordChecking: false,+ switchingAccount: false,+ user: null,+});++vi.mock('@features/identity/session', () => ({+ completeAdminSetup: vi.fn(),+ isLoginAttemptSupersededError: () => false,+ useAuthSession: () => sessionStore.useSnapshot(),+}));++const i18n = createInstance();+await i18n.use(initReactI18next).init({+ fallbackLng: 'en',+ interpolation: { escapeValue: false },+ lng: 'en',+ resources: { en: { translation: await fetch('/locales/en.json').then((response) => response.json()) } },+});+(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;++let host: HTMLDivElement;+let root: Root;++beforeEach(async () => {+ host = document.createElement('div');+ document.body.append(host);+ root = createRoot(host);+ await act(() =>+ root.render(+ <ChakraProvider value={system}>+ <I18nextProvider i18n={i18n}>+ <SetupScreen />+ </I18nextProvider>+ </ChakraProvider>+ )+ );+});++afterEach(async () => {+ await act(() => root.unmount());+ host.remove();+ sessionStore.patchSnapshot({ hasSingleUserWork: false });+});++describe('setup screen', () => {+ it('explains where earlier work went only when the server reports some', async () => {+ const guide = page.getByRole('link', { name: i18n.t('auth.setupEarlierWorkGuide') });+ const submit = page.getByRole('button', { name: i18n.t('auth.createAdminAccount') });++ expect(page.getByRole('note').query()).toBeNull();+ await expect.element(submit).not.toHaveAttribute('aria-describedby');++ await act(() => sessionStore.patchSnapshot({ hasSingleUserWork: true }));++ await expect.element(page.getByRole('note').getByText(i18n.t('auth.setupEarlierWorkDescription'))).toBeVisible();+ await expect.element(submit).toHaveAccessibleDescription(i18n.t('auth.setupEarlierWorkDescription'));+ await expect+ .element(guide)+ .toHaveAttribute('href', `${DOCS_URL}configuration/multi-user-mode/admin-guide/#if-you-have-already-upgraded`);+ await expect.element(guide).toHaveAttribute('target', '_blank');+ });+});diff --git a/invokeai/frontend/webv2/src/features/identity/ui/SetupScreen.tsx b/invokeai/frontend/webv2/src/features/identity/ui/SetupScreen.tsxindex 2fa24d1549..acfb973b48 100644--- a/invokeai/frontend/webv2/src/features/identity/ui/SetupScreen.tsx+++ b/invokeai/frontend/webv2/src/features/identity/ui/SetupScreen.tsx@@ -1,23 +1,27 @@-import { chakra, Input, Stack } from '@chakra-ui/react';+import { Alert, chakra, Icon, Input, Link, Stack } from '@chakra-ui/react';import { createSetupSchema, PASSWORD_RULES_HINT, type SetupFormValues } from '@features/identity/core/schemas';import { completeAdminSetup, isLoginAttemptSupersededError, useAuthSession } from '@features/identity/session';import { useZodForm } from '@platform/react/useZodForm';+import { DOCS_URL } from '@platform/runtime/appMetadata';import { getApiErrorMessage } from '@platform/transport/http';import { Button, Field } from '@platform/ui';import { Navigate } from '@tanstack/react-router';-import { useCallback, useMemo, type ChangeEvent, type FormEvent } from 'react';+import { ExternalLinkIcon } from 'lucide-react';+import { useCallback, useId, useMemo, type ChangeEvent, type FormEvent } from 'react';import { useTranslation } from 'react-i18next';import { AuthFormAlert, AuthScreen } from './AuthScreen';import { PasswordInput, PasswordStrengthMeter } from './PasswordInput';const INITIAL_VALUES: SetupFormValues = { confirmPassword: '', displayName: '', email: '', password: '' };+const EARLIER_WORK_GUIDE_URL = `${DOCS_URL}configuration/multi-user-mode/admin-guide/#if-you-have-already-upgraded`;export const SetupScreen = () => {const { t } = useTranslation();const session = useAuthSession();const schema = useMemo(() => createSetupSchema(session.strictPasswordChecking), [session.strictPasswordChecking]);const form = useZodForm(schema, INITIAL_VALUES);+ const earlierWorkDescriptionId = useId();const submit = useCallback(() =>@@ -112,10 +116,50 @@ export const SetupScreen = () => {onChange={handleConfirmPasswordChange}/></Field>- <Button loading={form.isSubmitting} size="lg" type="submit" variant="solid">+ {/* Above the submit, which it describes, so keyboard and screen-reader users hear it on reaching the button. */}+ {session.hasSingleUserWork ? <EarlierWorkNotice descriptionId={earlierWorkDescriptionId} /> : null}+ <Button+ aria-describedby={session.hasSingleUserWork ? earlierWorkDescriptionId : undefined}+ loading={form.isSubmitting}+ size="lg"+ type="submit"+ variant="solid"+ >{t('auth.createAdminAccount')}</Button></chakra.form></AuthScreen>);};++const EarlierWorkNotice = ({ descriptionId }: { descriptionId: string }) => {+ const { t } = useTranslation();++ return (+ <Alert.Root borderRadius="md" role="note" status="info" variant="surface">+ <Alert.Indicator />+ <Alert.Content gap="1.5">+ <Alert.Title fontSize="md" fontWeight="600">+ {t('auth.setupEarlierWorkTitle')}+ </Alert.Title>+ <Alert.Description fontSize="md" id={descriptionId}>+ {t('auth.setupEarlierWorkDescription')}+ </Alert.Description>+ {/* Inline, so a wrapped label keeps the icon after its last word. */}+ <Link+ alignSelf="flex-start"+ display="inline"+ fontSize="md"+ fontWeight="600"+ href={EARLIER_WORK_GUIDE_URL}+ rel="noreferrer"+ target="_blank"+ variant="underline"+ >+ {t('auth.setupEarlierWorkGuide')}+ <Icon as={ExternalLinkIcon} boxSize="3" ms="1" verticalAlign="-1px" />+ </Link>+ </Alert.Content>+ </Alert.Root>+ );+};diff --git a/invokeai/frontend/webv2/src/features/identity/ui/UsersPage.browser.test.tsx b/invokeai/frontend/webv2/src/features/identity/ui/UsersPage.browser.test.tsxindex 8526e69629..e3755aa850 100644--- a/invokeai/frontend/webv2/src/features/identity/ui/UsersPage.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/identity/ui/UsersPage.browser.test.tsx@@ -24,6 +24,7 @@ vi.mock('@features/identity/session', async (importOriginal) => {const session: SessionModule.AuthSession = {accountEpoch: 1,expiredUserId: null,+ hasSingleUserWork: false,multiuserEnabled: true,phase: 'ready',sessionExpired: false,diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/library/projectWorkflowEntries.test.ts b/invokeai/frontend/webv2/src/features/workflow/ui/library/projectWorkflowEntries.test.tsindex 1e4e3c5136..11ae456f68 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/library/projectWorkflowEntries.test.ts+++ b/invokeai/frontend/webv2/src/features/workflow/ui/library/projectWorkflowEntries.test.ts@@ -15,6 +15,7 @@ import {const session = (overrides: Partial<AuthSession> = {}): AuthSession => ({accountEpoch: 1,expiredUserId: null,+ hasSingleUserWork: false,multiuserEnabled: true,phase: 'ready',sessionExpired: false,diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/Launchpad.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/Launchpad.browser.test.tsxindex 29cfbfbf25..b492c5ee29 100644--- a/invokeai/frontend/webv2/src/workbench/launchpad/Launchpad.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/launchpad/Launchpad.browser.test.tsx@@ -249,6 +249,7 @@ describe('Launchpad shell', () => {auth.session = {accountEpoch: 1,expiredUserId: null,+ hasSingleUserWork: false,multiuserEnabled: true,phase: 'ready',sessionExpired: false,diff --git a/invokeai/frontend/webv2/src/workbench/palette/docsSearchIndex.json b/invokeai/frontend/webv2/src/workbench/palette/docsSearchIndex.jsonindex c3c83e738c..8843037aa6 100644--- a/invokeai/frontend/webv2/src/workbench/palette/docsSearchIndex.json+++ b/invokeai/frontend/webv2/src/workbench/palette/docsSearchIndex.json@@ -10,7 +10,7 @@{"s":"start-here/installation","t":"Simple Installation","c":0,"h":[["invoke-launcher","Invoke Launcher"],["download-and-set-up-the-launcher","Download and Set Up the Launcher"],["install-invoke","Install Invoke"],["updating","Updating"],["alternative-launchers","Alternative Launchers"]]},{"s":"start-here/manual","t":"Manual Installation","c":0,"h":[["are-you-in-the-right-place","Are you in the right place?"],["your-setup","Your setup"],["walkthrough","Walkthrough"]]},{"s":"start-here/system-requirements","t":"Hardware Requirements","c":0,"h":[["hardware","Hardware"],["windowslinux","Windows/Linux"],["python","Python"],["drivers","Drivers"],["intel","Intel"],["nvidia","Nvidia"],["amd","AMD"]]},-{"s":"start-here/upgrading","t":"Upgrading to v7","c":0,"h":[["the-upgrade-is-one-way","The upgrade is one-way"],["backups","Backups"],["which-backup-to-restore","Which backup to restore"],["mysql-and-mariadb","MySQL and MariaDB"],["restore-a-backup","Restore a backup"],["switch-back-to-the-v7-database","Switch back to the v7 database"],["run-v7-alongside-v6","Run v7 alongside v6"]]},+{"s":"start-here/upgrading","t":"Upgrading to v7","c":0,"h":[["before-upgrading-a-single-user-installation","Before upgrading a single-user installation"],["docker-compose-network-access","Docker Compose network access"],["the-upgrade-is-one-way","The upgrade is one-way"],["backups","Backups"],["which-backup-to-restore","Which backup to restore"],["mysql-and-mariadb","MySQL and MariaDB"],["restore-a-backup","Restore a backup"],["switch-back-to-the-v7-database","Switch back to the v7 database"],["first-start-after-switching-databases","First start after switching databases"],["run-v7-alongside-v6","Run v7 alongside v6"]]},{"s":"users-guide/canvas/canvas-guide","t":"Canvas guide","d":"A detailed guide to the Canvas — its tools and their options, navigation, the header buttons, the generation frame, selections, transform, filters, the staging area, menus, settings and keyboard shortcuts.","c":1,"h":[["tools","Tools"],["tool-options","Tool options"],["vector-layers-and-splines","Vector layers and splines"],["fonts","Fonts"],["navigating-the-canvas","Navigating the canvas"],["the-header","The header"],["the-generation-frame","The generation frame"],["what-the-model-sees","What the model sees"],["frame-size-and-processing-size","Frame size and processing size"],["transforming-layers","Transforming layers"],["filters-and-object-selection","Filters and object selection"],["running-a-workflow-on-a-layer","Running a workflow on a layer"],["the-staging-area","The staging area"],["the-canvas-menu","The canvas menu"],["canvas-settings","Canvas settings"],["saving-and-sharing-a-canvas","Saving and sharing a canvas"],["copying-and-pasting","Copying and pasting"],["keyboard-shortcuts","Keyboard shortcuts"]]},{"s":"users-guide/canvas/introduction","t":"Crafting images with the Canvas","d":"An introduction to the Canvas — layers and masks, sending generations to the Canvas, inpainting, outpainting, regional prompts, control layers, drawing and adding gallery images.","c":1,"h":[["canvas-concepts","Canvas concepts"],["layers","Layers"],["settings-live-in-the-properties-pane","Settings live in the Properties pane"],["the-generation-frame","The generation frame"],["what-invoke-does","What Invoke does"],["sending-generations-to-the-canvas","Sending generations to the Canvas"],["inpainting","Inpainting"],["outpainting","Outpainting"],["regional-prompts-and-reference-images","Regional prompts and reference images"],["control-layers","Control layers"],["drawing-on-a-raster-layer","Drawing on a raster layer"],["adding-a-gallery-image-to-a-layer","Adding a gallery image to a layer"]]},{"s":"users-guide/canvas/layers-panel","t":"Layers panel guide","d":"A detailed guide to the Canvas Layers panel — the color picker, managing layers, history, the layer menu, and every layer type's settings in the Properties pane.","c":1,"h":[["color","Color"],["layers","Layers"],["the-layer-list","The layer list"],["working-with-layers","Working with layers"],["history","History"],["the-layer-menu","The layer menu"],["properties","Properties"],["raster-layer","Raster layer"],["control-layer","Control layer"],["inpaint-mask","Inpaint mask"],["regional-guidance","Regional guidance"],["regional-reference-image","Regional reference image"],["transform-and-overview","Transform and Overview"],["keyboard-shortcuts","Keyboard shortcuts"]]},@@ -71,10 +71,10 @@{"s":"users-guide/models/local-models/z-image","t":"Z-Image","d":"Generate images with Z-Image Turbo and Z-Image Base, including the GGUF, NVFP4, int8 and SDNQ builds, ControlNets and regional prompting.","c":2,"h":[["license","License"],["hardware","Hardware"],["installing","Installing"],["choosing-components","Choosing components"],["generation-settings","Generation settings"],["controlnet","ControlNet"],["regional-prompting","Regional prompting"],["lora","LoRA"],["seed-variance-enhancer","Seed Variance Enhancer"],["pid-decoding","PiD decoding"]]},{"s":"users-guide/models/model-families","t":"Model Formats and Families","d":"An overview of the models InvokeAI supports — checkpoint, Diffusers and quantized formats, the components that make up a model, and the model families with their licenses.","c":2,"h":[["checkpoints-vs-diffusers-formats","Checkpoints vs Diffusers Formats"],["quantized-formats","Quantized formats"],["converting-to-diffusers","Converting to Diffusers"],["submodels","Submodels"],["model-families","Model Families"]]},{"s":"users-guide/models/model-format-support","t":"Model Format Support","d":"Which file formats and quantizations InvokeAI loads for every model family, text encoder, VAE and adapter.","c":2,"h":[["main-models","Main models"],["text-encoders","Text encoders"],["text-llms","Text LLMs"],["vaes","VAEs"],["preview-decoders-tiny-autoencoders","Preview decoders (Tiny AutoEncoders)"],["loras-and-adapters","LoRAs and adapters"]]},-{"s":"configuration/docker","t":"Docker","c":3,"h":[["tldr","TL;DR"],["amd-gpus-rocm","AMD GPUs (ROCm)"],["build-it-yourself","Build-It-Yourself"],["prerequisites","Prerequisites"],["setup","Setup"],["troubleshooting--faq","Troubleshooting / FAQ"]]},+{"s":"configuration/docker","t":"Docker","c":3,"h":[["tldr","TL;DR"],["amd-gpus-rocm","AMD GPUs (ROCm)"],["recover-data-before-replacing-a-container","Recover data before replacing a container"],["build-it-yourself","Build-It-Yourself"],["prerequisites","Prerequisites"],["setup","Setup"],["troubleshooting--faq","Troubleshooting / FAQ"]]},{"s":"configuration/external-database","t":"MySQL and MariaDB","c":3,"h":[["requirements","Requirements"],["creating-the-database","Creating the database"],["configuring-invokeai","Configuring InvokeAI"],["moving-an-existing-install","Moving an existing install"],["going-back-to-sqlite","Going back to SQLite"],["limits","Limits"]]},{"s":"configuration/invokeai-yaml","t":"YAML Config","c":3,"h":[["invokeai-root-directory","InvokeAI Root Directory"],["invokeai-configuration-file","InvokeAI Configuration File"],["environment-variables","Environment Variables"],["cli-args","CLI Args"],["low-vram-mode","Low-VRAM Mode"],["all-settings","All Settings"]]},-{"s":"configuration/multi-user-mode/admin-guide","t":"Multi-User Administrator Guide","d":"Turn on multi-user mode, manage accounts, and keep a shared InvokeAI server safe.","c":3,"h":[["roles","Roles"],["turn-on-multi-user-mode","Turn on multi-user mode"],["what-happens-to-existing-data","What happens to existing data"],["upgrading-from-v6","Upgrading from v6"],["manage-users","Manage users"],["deleting-a-user","Deleting a user"],["the-shared-queue","The shared queue"],["security","Security"],["passwords","Passwords"],["sessions","Sessions"],["signing-key","Signing key"],["model-downloads","Model downloads"],["node-filesystem-access","Node filesystem access"],["https-and-internet-access","HTTPS and internet access"],["backups","Backups"],["troubleshooting","Troubleshooting"],["not-supported","Not supported"],["more","More"]]},+{"s":"configuration/multi-user-mode/admin-guide","t":"Multi-User Administrator Guide","d":"Set up the first administrator, manage accounts, and keep a shared InvokeAI server safe.","c":3,"h":[["roles","Roles"],["set-up-multi-user-mode","Set up multi-user mode"],["verify-local-only-access","Verify local-only access"],["single-user-mode","Single-user mode"],["upgrading-from-single-user-mode","Upgrading from single-user mode"],["if-you-have-already-upgraded","If you have already upgraded"],["what-happens-to-existing-data","What happens to existing data"],["upgrading-from-v6","Upgrading from v6"],["manage-users","Manage users"],["deleting-a-user","Deleting a user"],["the-shared-queue","The shared queue"],["security","Security"],["passwords","Passwords"],["sessions","Sessions"],["signing-key","Signing key"],["model-downloads","Model downloads"],["node-filesystem-access","Node filesystem access"],["https-and-internet-access","HTTPS and internet access"],["backups","Backups"],["troubleshooting","Troubleshooting"],["not-supported","Not supported"],["more","More"]]},{"s":"configuration/multi-user-mode/api-guide","t":"Multi-User API Guide","d":"How to authenticate and interact with the InvokeAI API in multi-user mode.","c":3,"h":[["overview","Overview"],["single-user-vs-multi-user-mode","Single-User vs Multi-User Mode"],["authentication-multi-user-mode-only","Authentication (Multi-User Mode Only)"],["authentication-flow","Authentication Flow"],["login-endpoint","Login Endpoint"],["using-the-token","Using the Token"],["token-expiration","Token Expiration"],["logout-endpoint","Logout Endpoint"],["code-examples","Code Examples"],["python","Python"],["javascripttypescript","JavaScript/TypeScript"],["curl","cURL"],["api-endpoint-changes","API Endpoint Changes"],["authentication-required","Authentication Required"],["user-scoped-resources","User-Scoped Resources"],["administrator-endpoints","Administrator Endpoints"],["error-responses","Error Responses"],["multiuser-api-endpoints","Multiuser API Endpoints"],["authentication-endpoints","Authentication Endpoints"],["user-management-endpoints-admin-only","User Management Endpoints (Admin Only)"],["board-endpoints","Board Endpoints"],["project-endpoints","Project Endpoints"],["best-practices","Best Practices"],["token-storage","Token Storage"],["error-handling","Error Handling"],["rate-limiting","Rate Limiting"],["connection-management","Connection Management"],["migration-guide","Migration Guide"],["updating-existing-code","Updating Existing Code"],["backward-compatibility","Backward Compatibility"],["programmatic-graph-execution","Programmatic Graph Execution"],["openapiswagger-documentation","OpenAPI/Swagger Documentation"],["security-considerations","Security Considerations"],["https","HTTPS"],["token-security","Token Security"],["input-validation","Input Validation"],["troubleshooting","Troubleshooting"],["common-issues","Common Issues"],["additional-resources","Additional Resources"]]},{"s":"configuration/multi-user-mode/user-guide","t":"Multi-User Guide","d":"Sign in to a shared InvokeAI server, share boards and workflows, and work alongside other users.","c":3,"h":[["signing-in","Signing in"],["your-account","Your account"],["what-you-can-do","What you can do"],["working-with-your-content-in-multi-user-mode","Working with Your Content in Multi-User Mode"],["image-boards","Image Boards"],["workflows","Workflows"],["the-generation-queue","The Generation Queue"],["switching-between-single-user-and-multi-user-mode","Switching Between Single-User and Multi-User Mode"],["troubleshooting","Troubleshooting"]]},{"s":"configuration/optimization/fp8-compute","t":"FP8 Compute","d":"Run checkpoints published in FP8 on the FP8 tensor cores of RTX 40-series and newer GPUs, and what it means for repeatable images.","c":3,"h":[["requirements","Requirements"],["turning-it-on","Turning it on"],["when-the-model-asks-for-full-precision","When the model asks for full precision"]]},diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/AppMenu.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/AppMenu.browser.test.tsxindex 5cfc248b94..3b8c0b0d82 100644--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/AppMenu.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/AppMenu.browser.test.tsx@@ -15,6 +15,7 @@ vi.mock('@features/identity/session', async (importOriginal) => {const signedIn: SessionModule.AuthSession = {accountEpoch: 1,expiredUserId: null,+ hasSingleUserWork: false,multiuserEnabled: true,phase: 'ready',sessionExpired: false,diff --git a/scripts/family_e2e/manifest.example.yaml b/scripts/family_e2e/manifest.example.yamlindex dbb5134d95..8913536d28 100644--- a/scripts/family_e2e/manifest.example.yaml+++ b/scripts/family_e2e/manifest.example.yaml@@ -15,6 +15,8 @@ server:# The server's interpreter: <checkout>/.venv/Scripts/python.exe on Windows, <checkout>/.venv/bin/python on Linux.python: <python># code_dir: <checkout> # the checkout the server runs; default: the checkout this tool runs from+ # The template must run single-user: set multiuser: false in its invokeai.yaml. env: {INVOKEAI_MULTIUSER: "false"}+ # works only while that file has no multiuser line; starting the template's own server adds multiuser: true to it.env: {} # extra server environment, e.g. {HIP_VISIBLE_DEVICES: "0"} for ROCmdefaults:diff --git a/scripts/family_e2e/runner.py b/scripts/family_e2e/runner.pyindex 3df71b2e6a..28634d31bc 100644--- a/scripts/family_e2e/runner.py+++ b/scripts/family_e2e/runner.py@@ -573,7 +573,7 @@ def preflight(manifest: Manifest, gpu: Gpu) -> None:if not path.is_file():raise RunnerError(f"{path} does not exist")template_root = spec.template_root- settings = read_template_settings(template_root)+ settings = read_template_settings(spec)pending = pending_installs(template_root, settings)if pending:raise RunnerError(@@ -883,7 +883,7 @@ class _Session:survivors = "its stop did not finish"try:pin = device_env(self.gpu.adapter, self.manifest.server.env)- build_scratch_root(self.manifest.server.template_root, root, log_path, free_port(), bool(pin))+ build_scratch_root(self.manifest.server, root, log_path, free_port(), bool(pin))self.heartbeat("starting the server")try:self.server = launch_server(diff --git a/scripts/family_e2e/server.py b/scripts/family_e2e/server.pyindex d3e96a6b38..6c8a1cf4fc 100644--- a/scripts/family_e2e/server.py+++ b/scripts/family_e2e/server.py@@ -26,6 +26,7 @@ from typing import IO, Anyimport psutilimport requestsimport yaml+from pydantic import TypeAdapter, ValidationErrorfrom scripts.family_e2e.manifest import ServerSpec@@ -55,6 +56,8 @@ TEMPLATE_PATHS: dict[str, str | None] = {"prompt_files_dir": "prompt_files","legacy_models_yaml_path": None,}+# The scratch YAML must control the listener and the stores that belong to the copied database.+SCRATCH_ENV_KEYS = {f"INVOKEAI_{field.upper()}" for field in ("host", "port", "db_url", *SCRATCH_PATHS)}# The client speaks plain HTTP to the root path.DROPPED_SETTINGS = ("ssl_certfile", "ssl_keyfile", "base_url")# ModelInstallService's TMPDIR_PREFIX (invokeai/app/services/model_install/model_install_default.py).@@ -86,9 +89,9 @@ class TerminationError(ServerError):"""[pid, create time] of each process of the tree that still ran; empty when none could be identified."""-def read_template_settings(template_root: Path) -> dict[str, Any]:- """The template's `invokeai.yaml` settings (empty when the root has none), refusing what the tool cannot copy."""- path = template_root / CONFIG_FILE+def read_template_settings(spec: ServerSpec) -> dict[str, Any]:+ """Read the template and require an explicit single-user run before sharing its resources."""+ path = spec.template_root / CONFIG_FILEsettings: dict[str, Any] = {}if path.is_file():settings = yaml.safe_load(path.read_text(encoding="utf-8")) or {}@@ -96,6 +99,24 @@ def read_template_settings(template_root: Path) -> dict[str, Any]:raise ServerError(f"{path} has schema {settings.get('schema_version')!r}; start its server once to migrate")if settings.get("db_url"):raise ServerError(f"{path} uses db_url; only a SQLite database can be copied into a scratch root")+ # Settings from the manifest take precedence over the scratch YAML when the server starts.+ for key in spec.env:+ if key.upper() in SCRATCH_ENV_KEYS:+ raise ServerError(f"remove {key} from server.env; the runner sets the scratch listener and storage paths")++ choices = [value for key, value in spec.env.items() if key.upper() == "INVOKEAI_MULTIUSER" and value]+ if "multiuser" in settings:+ choices.append(settings["multiuser"])+ try:+ auth_settings = TypeAdapter(list[bool]).validate_python(choices)+ except ValidationError as e:+ raise ServerError(f"invalid multiuser setting in {path} or server.env") from e+ if not auth_settings or any(auth_settings):+ raise ServerError(+ f"single-user access requires multiuser: false in {path} or "+ 'INVOKEAI_MULTIUSER: "false" in server.env when the template omits multiuser; '+ "an explicitly authenticated template cannot be used"+ )return settings@@ -187,7 +208,7 @@ def free_port() -> int:def build_scratch_root(- template_root: Path, scratch_root: Path, log_file: Path, port: int, single_cuda_device: bool = False+ spec: ServerSpec, scratch_root: Path, log_file: Path, port: int, single_cuda_device: bool = False) -> None:"""(Re)creates the scratch root: the template's settings with absolute paths and a snapshot of its database.@@ -195,7 +216,8 @@ def build_scratch_root(template that names a CUDA device by index would then refuse to start, so its `device` becomes `cuda:0` and a`generation_devices` list with a CUDA device becomes `auto`."""- settings = read_template_settings(template_root)+ settings = read_template_settings(spec)+ template_root = spec.template_roottemplate_db = (template_root / settings.get("db_dir", "databases")).resolve() / DB_FILEif not template_db.is_file():raise ServerError(f"template root has no database at {template_db}")diff --git a/scripts/multigpu_ram_driver.py b/scripts/multigpu_ram_driver.pyindex 9d985b4d98..58587c3e93 100755--- a/scripts/multigpu_ram_driver.py+++ b/scripts/multigpu_ram_driver.py@@ -16,9 +16,14 @@ This automates the two manual checks from the test plan:------------------------------------------------------------------------------------------------Getting a batch file------------------------------------------------------------------------------------------------+Use a dedicated test instance with its own InvokeAI root. Bind the server to 127.0.0.1, or publish+its Docker port only on 127.0.0.1. Close reverse-proxy, tunnel and other external routes to it.+Then start that instance with INVOKEAI_MULTIUSER=false. This driver sends no sign-in token, and+anyone who can reach the single-user server has administrator access.+The script needs the exact body InvokeAI's UI sends to enqueue a generation. Easiest way to captureit:- 1. Open InvokeAI in the browser with devtools -> Network open.+ 1. Open the test instance in the browser with devtools -> Network open.2. Click Invoke once.3. Find the POST to `.../queue/default/enqueue_batch`, copy its JSON request body, save to a file(e.g. batch.json). It looks like {"prepend": false, "batch": {"graph": {...}, "runs": 1}}.@@ -199,7 +204,7 @@ def wait_drained(base: str, queue_id: str, timeout: float) -> None:def main() -> None:ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)ap.add_argument("--graph", required=True, help="Path to a captured enqueue_batch body (JSON).")- ap.add_argument("--url", default="http://127.0.0.1:9090", help="Server base URL.")+ ap.add_argument("--url", default="http://127.0.0.1:9090", help="Loopback URL of the private test instance.")ap.add_argument("--queue-id", default="default")ap.add_argument("--pairs", type=int, default=2, help="Concurrent batches per round (>= #GPUs).")ap.add_argument("--rounds", type=int, default=1, help="Number of rounds (use 25+ for leak soak).")diff --git a/tests/app/routers/test_app_info.py b/tests/app/routers/test_app_info.pyindex 7b8b24b86a..6573193797 100644--- a/tests/app/routers/test_app_info.py+++ b/tests/app/routers/test_app_info.py@@ -5,6 +5,7 @@ from typing import Anyfrom unittest.mock import Mockimport pytest+import yamlfrom fastapi import HTTPExceptionfrom fastapi.testclient import TestClient@@ -12,7 +13,12 @@ from invokeai.app.api.dependencies import ApiDependenciesfrom invokeai.app.api.routers import app_infofrom invokeai.app.api_app import appfrom invokeai.app.services.auth.token_service import TokenData-from invokeai.app.services.config.config_default import get_config, load_and_migrate_config, load_external_api_keys+from invokeai.app.services.config.config_default import (+ get_config,+ load_and_migrate_config,+ load_config_from_root,+ load_external_api_keys,+)from invokeai.app.services.external_generation.external_generation_common import ExternalProviderStatusfrom invokeai.app.services.image_files.image_subfolder_strategy import DateStrategy, create_subfolder_strategyfrom invokeai.app.services.invoker import Invoker@@ -405,6 +411,35 @@ def test_update_runtime_config_persists_generation_devices(assert get_config().generation_devices == "auto"[email protected]("file_multiuser", [None, True, False])+def test_saving_generation_settings_preserves_the_authentication_choice_in_yaml(+ file_multiuser: bool | None,+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ mock_invoker: Invoker,+ client: TestClient,+) -> None:+ config_path = tmp_path / "invokeai.yaml"+ settings: dict[str, str | bool] = {"schema_version": "4.0.3"}+ if file_multiuser is not None:+ settings["multiuser"] = file_multiuser+ config_path.write_text(yaml.safe_dump(settings))+ monkeypatch.setenv("INVOKEAI_MULTIUSER", "false")+ runtime_config = load_config_from_root(tmp_path)+ monkeypatch.setattr(mock_invoker.services, "configuration", runtime_config)+ monkeypatch.setattr(app_info, "get_config", lambda: runtime_config)+ monkeypatch.setattr("invokeai.app.api.auth_dependencies.ApiDependencies", MockApiDependencies(mock_invoker))++ response = client.patch("/api/v1/app/runtime_config", json={"max_queue_history": 12})++ assert response.status_code == 200+ assert response.json()["config"]["multiuser"] is False+ file_choice = file_multiuser is not False+ assert yaml.safe_load(config_path.read_text()) == {**settings, "multiuser": file_choice, "max_queue_history": 12}+ monkeypatch.delenv("INVOKEAI_MULTIUSER")+ assert load_config_from_root(tmp_path).multiuser is file_choice++def test_update_runtime_config_rejects_invalid_generation_device(monkeypatch: Any, mock_invoker: Invoker, client: TestClient) -> None:diff --git a/tests/app/routers/test_auth.py b/tests/app/routers/test_auth.pyindex 7c1c809af6..1196fe45b0 100644--- a/tests/app/routers/test_auth.py+++ b/tests/app/routers/test_auth.py@@ -2,8 +2,9 @@import osfrom pathlib import Path-from typing import Any+from typing import Any, Callablefrom unittest.mock import MagicMock+from uuid import uuid4import pytestfrom fastapi.testclient import TestClient@@ -11,8 +12,17 @@ from fastapi.testclient import TestClientfrom invokeai.app.api.dependencies import ApiDependenciesfrom invokeai.app.api_app import appfrom invokeai.app.services.auth.token_service import set_jwt_secret+from invokeai.app.services.fonts.fonts_common import FontScopefrom invokeai.app.services.invoker import Invoker-from invokeai.app.services.users.users_common import UserCreateRequest+from invokeai.app.services.shared.database.queries.fonts import UploadedFont+from invokeai.app.services.style_preset_records.style_preset_records_common import (+ PresetData,+ PresetType,+ StylePresetWithoutId,+)+from invokeai.app.services.style_preset_records.style_preset_records_default import StylePresetRecordsStorage+from invokeai.app.services.users.users_common import SYSTEM_USER_ID, UserCreateRequest+from invokeai.app.services.wildcard_records.wildcard_records_common import WildcardWithoutId@pytest.fixture(autouse=True, scope="module")@@ -551,3 +561,91 @@ class TestMediaCookieBehindSubPathProxy:assert len(set_cookies) == 1assert 'invokeai_media_token=""' in set_cookies[0]assert f"Path={self.BASE_PATH}/api/v1" in set_cookies[0]+++def _add_project(invoker: Invoker, user_id: str) -> None:+ invoker.services.project_records.create(user_id, "Project", {})+++def _add_wildcard(invoker: Invoker, user_id: str) -> None:+ invoker.services.wildcard_records.create(WildcardWithoutId(name="colors", values=["red"]), user_id)+++def _add_template(invoker: Invoker, user_id: str, *, is_public: bool = False) -> None:+ template = StylePresetWithoutId(+ name="Template",+ preset_data=PresetData(positive_prompt="a {prompt}", negative_prompt=""),+ type=PresetType.User,+ is_public=is_public,+ )+ StylePresetRecordsStorage(invoker.services.database).create(template, user_id)+++def _add_font(invoker: Invoker, owner_id: str | None) -> None:+ font_id = f"font_{uuid4().hex}"+ invoker.services.database.queries.fonts.insert_upload(+ UploadedFont(+ id=font_id,+ owner_id=owner_id,+ scope=FontScope.PRIVATE if owner_id else FontScope.SHARED,+ filename="Font.ttf",+ storage_path=f"{font_id}.ttf",+ family="Font",+ label="Font Regular",+ style="normal",+ weight=400,+ content_hash="0" * 64,+ byte_size=1,+ axes=(),+ instances=(),+ )+ )+++class TestSingleUserWorkStatus:+ @pytest.fixture(autouse=True)+ def _dependencies(self, monkeypatch: Any, mock_invoker: Invoker) -> None:+ monkeypatch.setattr("invokeai.app.api.routers.auth.ApiDependencies", MockApiDependencies(mock_invoker))++ @pytest.mark.parametrize(+ "add_work",+ [+ _add_project,+ _add_wildcard,+ _add_template,+ _add_font,+ ],+ ids=["project", "wildcard", "private_template", "private_font"],+ )+ def test_reported_during_setup_when_system_owns_private_work(+ self, add_work: Callable[[Invoker, str], None], mock_invoker: Invoker, client: TestClient+ ) -> None:+ add_work(mock_invoker, SYSTEM_USER_ID)++ status = client.get("/api/v1/auth/status").json()++ assert status["setup_required"] is True+ assert status["has_single_user_work"] is True++ def test_not_reported_for_content_every_account_sees_or_another_account_owns(+ self, mock_invoker: Invoker, client: TestClient+ ) -> None:+ # Bundled templates, a public template and a shared font upload stay visible after setup.+ StylePresetRecordsStorage(mock_invoker.services.database).start(mock_invoker)+ _add_template(mock_invoker, SYSTEM_USER_ID, is_public=True)+ _add_font(mock_invoker, None)+ _add_project(mock_invoker, setup_test_user(mock_invoker, "[email protected]"))++ status = client.get("/api/v1/auth/status").json()++ assert status["setup_required"] is True+ assert status["has_single_user_work"] is False++ def test_not_reported_once_an_administrator_exists(self, mock_invoker: Invoker, client: TestClient) -> None:+ _add_project(mock_invoker, SYSTEM_USER_ID)+ setup_test_admin(mock_invoker, "[email protected]")++ status = client.get("/api/v1/auth/status").json()++ assert status["setup_required"] is False+ assert status["has_single_user_work"] is Falsediff --git a/tests/conftest.py b/tests/conftest.pyindex a175a77fb7..6da4a4d5a6 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -2,6 +2,11 @@# without needing to explicitly import them. (https://docs.pytest.org/en/6.2.x/fixture.html)import loggingimport os++# Multiuser is the app's default; the suite tests single-user behavior unless a test passes `multiuser=True`, which+# beats this environment value. Set before the imports below: some read `get_config()` at import time, which caches it.+os.environ.setdefault("INVOKEAI_MULTIUSER", "false")+import shutilimport sysimport warningsdiff --git a/tests/family_e2e/test_cli.py b/tests/family_e2e/test_cli.pyindex 6aa8f0dcc7..ecb973debe 100644--- a/tests/family_e2e/test_cli.py+++ b/tests/family_e2e/test_cli.py@@ -256,7 +256,9 @@ def startable(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:s.bind(("127.0.0.1", 0))free = s.getsockname()[1](tmp_path / "template").mkdir()- (tmp_path / "template" / "invokeai.yaml").write_text(yaml.safe_dump({"schema_version": "4.0.3", "port": free}))+ (tmp_path / "template" / "invokeai.yaml").write_text(+ yaml.safe_dump({"schema_version": "4.0.3", "multiuser": False, "port": free})+ )(tmp_path / "code" / "scripts").mkdir(parents=True)(tmp_path / "code" / "scripts" / "invokeai-web.py").write_text("")manifest = tmp_path / "manifest.yaml"diff --git a/tests/family_e2e/test_flow.py b/tests/family_e2e/test_flow.pyindex 53b17d51d8..06346d2dbf 100644--- a/tests/family_e2e/test_flow.py+++ b/tests/family_e2e/test_flow.py@@ -135,7 +135,9 @@ def setup(tmp_path: Path) -> tuple[Path, Path]:template = tmp_path / "template"(template / "databases").mkdir(parents=True)sqlite3.connect(template / "databases" / "invokeai.db").close()- (template / "invokeai.yaml").write_text(yaml.safe_dump({"schema_version": "4.0.3", "port": template_port}))+ (template / "invokeai.yaml").write_text(+ yaml.safe_dump({"schema_version": "4.0.3", "multiuser": False, "port": template_port})+ )data_dir = tmp_path / "data"(data_dir / "inputs").mkdir(parents=True)diff --git a/tests/family_e2e/test_runner.py b/tests/family_e2e/test_runner.pyindex a8081452ce..867532d40e 100644--- a/tests/family_e2e/test_runner.py+++ b/tests/family_e2e/test_runner.py@@ -256,7 +256,7 @@ def test_preflight_refuses_a_template_with_an_unfinished_model_install(template = tmp_path / "template"(template / "my-models").mkdir(parents=True)(template / "invokeai.yaml").write_text(- yaml.safe_dump({"schema_version": "4.0.3", "port": free, "models_dir": "my-models"})+ yaml.safe_dump({"schema_version": "4.0.3", "multiuser": False, "port": free, "models_dir": "my-models"}))code_dir = tmp_path / "code"(code_dir / "scripts").mkdir(parents=True)@@ -341,7 +341,9 @@ def killed_run(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:s.bind(("127.0.0.1", 0))free = s.getsockname()[1](tmp_path / "template").mkdir()- (tmp_path / "template" / "invokeai.yaml").write_text(yaml.safe_dump({"schema_version": "4.0.3", "port": free}))+ (tmp_path / "template" / "invokeai.yaml").write_text(+ yaml.safe_dump({"schema_version": "4.0.3", "multiuser": False, "port": free})+ )manifest = tmp_path / "manifest.yaml"manifest.write_text(yaml.safe_dump(diff --git a/tests/family_e2e/test_server.py b/tests/family_e2e/test_server.pyindex 39297c6c10..b441a06166 100644--- a/tests/family_e2e/test_server.py+++ b/tests/family_e2e/test_server.py@@ -14,7 +14,7 @@ import psutilimport pytestimport yaml-from invokeai.app.services.config.config_default import InvokeAIAppConfig+from invokeai.app.services.config.config_default import InvokeAIAppConfig, load_config_from_rootfrom scripts.family_e2e import serverfrom scripts.family_e2e.manifest import ServerSpecfrom scripts.family_e2e.server import (@@ -40,7 +40,7 @@ def _rows(database: str | Path, uri: bool = False) -> list[str]:return [row[0] for row in conn.execute("SELECT name FROM models ORDER BY name")]-def _template(tmp_path: Path, settings: dict) -> Path:+def _template(tmp_path: Path, settings: dict) -> ServerSpec:root = tmp_path / "template"(root / "databases").mkdir(parents=True)conn = sqlite3.connect(root / "databases" / "invokeai.db")@@ -50,7 +50,7 @@ def _template(tmp_path: Path, settings: dict) -> Path:conn.close()(root / "databases" / "invokeai_backup_1.db").write_bytes(b"old")(root / "invokeai.yaml").write_text(yaml.safe_dump({"schema_version": "4.0.3", **settings}))- return root+ return ServerSpec(template_root=root, python=Path(sys.executable))def test_scratch_root_points_back_at_the_template_and_keeps_run_output_local(tmp_path: Path) -> None:@@ -58,6 +58,7 @@ def test_scratch_root_points_back_at_the_template_and_keeps_run_output_local(tmptemplate = _template(tmp_path,{+ "multiuser": False,"models_dir": "my-models","custom_nodes_dir": str(elsewhere),"outputs_dir": "out",@@ -75,8 +76,8 @@ def test_scratch_root_points_back_at_the_template_and_keeps_run_output_local(tmpbuild_scratch_root(template, scratch, log_file, port=9321)config = yaml.safe_load((scratch / "invokeai.yaml").read_text())- assert config["models_dir"] == str((template / "my-models").resolve())- assert config["download_cache_dir"] == str((template / "models/.download_cache").resolve())+ assert config["models_dir"] == str((template.template_root / "my-models").resolve())+ assert config["download_cache_dir"] == str((template.template_root / "models/.download_cache").resolve())assert config["custom_nodes_dir"] == str(elsewhere.resolve())# Stores the database owns are reconciled with the scratch database, so they must not be the template's.for name, relative in (@@ -87,7 +88,7 @@ def test_scratch_root_points_back_at_the_template_and_keeps_run_output_local(tmp("workflow_thumbnails_dir", "workflow_thumbnails"),):assert config[name] == str(scratch / relative), name- assert (config["host"], config["port"]) == ("127.0.0.1", 9321)+ assert (config["host"], config["port"], config["multiuser"]) == ("127.0.0.1", 9321, False)assert config["log_handlers"] == ["console", f"file={log_file}"]assert (config["log_format"], config["log_level"]) == ("plain", "info")assert (config["image_index_enabled"], config["clear_queue_on_startup"]) == (False, True)@@ -97,12 +98,15 @@ def test_scratch_root_points_back_at_the_template_and_keeps_run_output_local(tmpassert [p.name for p in (scratch / "databases").iterdir()] == ["invokeai.db"]assert _rows(scratch / "databases" / "invokeai.db") == ["flux"]# The template's database was read immutable: SQLite left no -wal/-shm beside it.- assert sorted(p.name for p in (template / "databases").iterdir()) == ["invokeai.db", "invokeai_backup_1.db"]+ assert sorted(p.name for p in (template.template_root / "databases").iterdir()) == [+ "invokeai.db",+ "invokeai_backup_1.db",+ ]def test_snapshot_includes_the_wal_of_an_unclean_stop_without_changing_it(tmp_path: Path) -> None:- template = _template(tmp_path, {})- db_dir = template / "databases"+ template = _template(tmp_path, {"multiuser": False})+ db_dir = template.template_root / "databases"live = tmp_path / "live"live.mkdir()shutil.copy(db_dir / "invokeai.db", live / "invokeai.db")@@ -124,8 +128,8 @@ def test_snapshot_includes_the_wal_of_an_unclean_stop_without_changing_it(tmp_pa@pytest.mark.skipif(sys.platform != "win32", reason="open-file detection is Windows-only")def test_database_open_in_another_process_is_refused(tmp_path: Path) -> None:- template = _template(tmp_path, {})- conn = sqlite3.connect(template / "databases" / "invokeai.db")+ template = _template(tmp_path, {"multiuser": False})+ conn = sqlite3.connect(template.template_root / "databases" / "invokeai.db")try:conn.execute("SELECT 1").fetchall()with pytest.raises(ServerError, match="open in another process"):@@ -136,14 +140,16 @@ def test_database_open_in_another_process_is_refused(tmp_path: Path) -> None:def test_scratch_root_is_rebuilt_from_scratch(tmp_path: Path) -> None:- template = _template(tmp_path, {})+ template = _template(tmp_path, {"multiuser": False})scratch = tmp_path / "scratch"build_scratch_root(template, scratch, tmp_path / "a.log", port=1)(scratch / "outputs").mkdir()(scratch / "outputs" / "stale.png").write_bytes(b"x")build_scratch_root(template, scratch, tmp_path / "a.log", port=2)assert not (scratch / "outputs").exists()- assert yaml.safe_load((scratch / "invokeai.yaml").read_text())["models_dir"] == str((template / "models").resolve())+ assert yaml.safe_load((scratch / "invokeai.yaml").read_text())["models_dir"] == str(+ (template.template_root / "models").resolve()+ )@pytest.mark.parametrize(@@ -160,9 +166,54 @@ def test_templates_the_tool_cannot_copy_are_refused(tmp_path: Path, settings: diassert not (tmp_path / "scratch").exists()+ ("settings", "env"),+ [+ ({}, {}),+ ({"multiuser": True}, {"INVOKEAI_MULTIUSER": "false"}),+ ({"multiuser": False}, {"INVOKEAI_MULTIUSER": "true"}),+ ({}, {"INVOKEAI_MULTIUSER": "invalid"}),+ ],+)+def test_runner_requires_explicit_single_user_access_before_copying(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, settings: dict, env: dict[str, str]+) -> None:+ monkeypatch.setenv("INVOKEAI_MULTIUSER", "false")+ spec = _template(tmp_path, settings)+ spec.env.update(env)+ scratch = tmp_path / "scratch"+ with pytest.raises(ServerError, match="multiuser"):+ build_scratch_root(spec, scratch, tmp_path / "a.log", port=1)+ assert not scratch.exists()+++def test_manifest_can_opt_in_for_scratch_alone(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.delenv("INVOKEAI_MULTIUSER", raising=False)+ spec = _template(tmp_path, {})+ spec.env["INVOKEAI_MULTIUSER"] = "false"+ scratch = tmp_path / "scratch"+ build_scratch_root(spec, scratch, tmp_path / "a.log", port=1)+ assert load_config_from_root(spec.template_root).multiuser+ monkeypatch.setenv("INVOKEAI_MULTIUSER", server_env(spec)["INVOKEAI_MULTIUSER"])+ config = load_config_from_root(scratch)+ assert not config.multiuser+ assert config.host == "127.0.0.1"+ assert config.db_path == scratch / "databases" / "invokeai.db"++[email protected]("key", ["invokeai_host", "INVOKEAI_DB_URL", "INVOKEAI_OUTPUTS_DIR"])+def test_manifest_cannot_redirect_the_scratch_listener_or_storage(tmp_path: Path, key: str) -> None:+ spec = _template(tmp_path, {"multiuser": False})+ spec.env[key] = "elsewhere"+ scratch = tmp_path / "scratch"+ with pytest.raises(ServerError, match=key):+ build_scratch_root(spec, scratch, tmp_path / "a.log", port=1)+ assert not scratch.exists()++def test_template_without_database_is_refused(tmp_path: Path) -> None:- template = _template(tmp_path, {})- (template / "databases" / "invokeai.db").unlink()+ template = _template(tmp_path, {"multiuser": False})+ (template.template_root / "databases" / "invokeai.db").unlink()with pytest.raises(ServerError, match="no database"):build_scratch_root(template, tmp_path / "scratch", tmp_path / "a.log", port=1)@@ -211,7 +262,7 @@ def test_server_env_drops_inherited_invokeai_settings(tmp_path: Path, monkeypatcdef test_a_server_pinned_to_one_cuda_device_gets_no_other_cuda_index(tmp_path: Path, settings: dict, expected: dict) -> None:- template = _template(tmp_path, settings)+ template = _template(tmp_path, {**settings, "multiuser": False})build_scratch_root(template, tmp_path / "pinned", tmp_path / "a.log", port=1, single_cuda_device=True)build_scratch_root(template, tmp_path / "unpinned", tmp_path / "a.log", port=1)diff --git a/tests/test_config.py b/tests/test_config.pyindex d61f70a854..983d174517 100644--- a/tests/test_config.py+++ b/tests/test_config.py@@ -1,8 +1,10 @@+import osfrom pathlib import Pathfrom tempfile import TemporaryDirectoryfrom typing import Anyimport pytest+import yamlfrom pydantic import ValidationErrorfrom invokeai.app.invocations.baseinvocation import InvocationRegistry@@ -91,6 +93,16 @@ def test_wan_memory_optimization_defaults_to_false_and_loads_from_yaml(tmp_path:assert load_and_migrate_config(temp_config_file).wan_memory_optimization is True[email protected](("yaml_line", "expected"), [("", True), ("multiuser: false\n", False)])+def test_sign_in_is_required_unless_single_user_mode_is_set_explicitly(+ tmp_path: Path, patch_rootdir: None, yaml_line: str, expected: bool+) -> None:+ temp_config_file = tmp_path / "temp_invokeai.yaml"+ temp_config_file.write_text(f'schema_version: "4.0.3"\n{yaml_line}')++ assert load_and_migrate_config(temp_config_file).multiuser is expected++@pytest.mark.parametrize(("yaml_value", "expected"),[("on", "on"), ("off", "off"), ('"on"', "on"), ("auto", "auto")],@@ -270,6 +282,8 @@ def test_migrate_v4_0_2_to_4_0_3_config(tmp_path: Path, patch_rootdir: None):assert config.port == 8080# image_subfolder_strategy should have its default valueassert config.image_subfolder_strategy == "flat"+ # Older releases default to single-user mode, so the rewrite states sign-in explicitly.+ assert yaml.safe_load(temp_config_file.read_text())["multiuser"] is Truedef test_bails_on_invalid_config(tmp_path: Path, patch_rootdir: None):@@ -305,13 +319,15 @@ def test_write_config_to_file(patch_rootdir: None):assert "port: 8080" in content-def test_update_config_with_dict(patch_rootdir: None):+def test_update_config_with_dict(patch_rootdir: None, monkeypatch: pytest.MonkeyPatch):"""Test updating the config with a dictionary."""- config = InvokeAIAppConfig()+ monkeypatch.setenv("INVOKEAI_MULTIUSER", "false")+ config = InvokeAIAppConfig(multiuser=True)update_dict = {"host": "10.10.10.10", "port": 6060}config.update_config(update_dict)assert config.host == "10.10.10.10"assert config.port == 6060+ assert config.multiuser is Truedef test_update_config_with_object(patch_rootdir: None):@@ -365,6 +381,7 @@ def test_get_config_writing(patch_rootdir: None, monkeypatch: pytest.MonkeyPatchmonkeypatch.setenv("INVOKEAI_ROOT", str(tmp_path))monkeypatch.setenv("INVOKEAI_HOST", "1.2.3.4")+ monkeypatch.setenv("INVOKEAI_MULTIUSER", "false")get_config.cache_clear()config = get_config()get_config.cache_clear()@@ -384,14 +401,82 @@ def test_get_config_writing(patch_rootdir: None, monkeypatch: pytest.MonkeyPatch# It should also have the `remote_api_tokens` keyassert "remote_api_tokens" in example_file_content- # Neither env vars nor default values should be written to the config file+ # Neither env vars nor default values should be written to the config file, except the sign-in choice, which+ # older releases default differentlyconfig_file_content = config_file_path.read_text()assert "host" not in config_file_content+ assert yaml.safe_load(config_file_content)["multiuser"] is True# Undo our change to the singleton classInvokeAIArgs.did_parse = False+def _start(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> InvokeAIAppConfig:+ monkeypatch.setattr(InvokeAIArgs, "did_parse", True)+ monkeypatch.setenv("INVOKEAI_ROOT", str(tmp_path))+ get_config.cache_clear()+ try:+ return get_config()+ finally:+ get_config.cache_clear()++[email protected]("ending", ["\n", ""])+def test_startup_appends_sign_in_to_a_config_file_without_it(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, ending: str+) -> None:+ monkeypatch.setenv("INVOKEAI_MULTIUSER", "false")+ content = '# my notes\nschema_version: "4.0.3"\nport: 8080 # kept\n# last' + ending+ (tmp_path / "invokeai.yaml").write_text(content)++ config = _start(tmp_path, monkeypatch)++ assert config.multiuser is False+ assert config.port == 8080+ assert (tmp_path / "invokeai.yaml").read_text() == content + ("" if ending else "\n") + "multiuser: true\n"+++ ("content", "warns"),+ [+ ('# my notes\nschema_version: "4.0.3"\nport: 8080\nmultiuser: false\n', False),+ ('{schema_version: "4.0.3", port: 8080}\n', True),+ ],+ ids=["states-sign-in", "flow-style"],+)+def test_startup_leaves_a_config_file_untouched_when_it_states_sign_in_or_cannot_take_a_line(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, caplog: pytest.LogCaptureFixture, content: str, warns: bool+) -> None:+ (tmp_path / "invokeai.yaml").write_text(content)++ with caplog.at_level("WARNING"):+ config = _start(tmp_path, monkeypatch)++ assert config.port == 8080+ assert (tmp_path / "invokeai.yaml").read_text() == content+ assert ("Unable to add the multiuser setting" in caplog.text) is warns+++def test_startup_still_loads_a_read_only_config_file(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, caplog: pytest.LogCaptureFixture+) -> None:+ config_file = tmp_path / "invokeai.yaml"+ content = 'schema_version: "4.0.3"\nport: 8080\n'+ config_file.write_text(content)+ config_file.chmod(0o444)+ try:+ if os.access(config_file, os.W_OK):+ pytest.skip("this user can write read-only files")+ with caplog.at_level("WARNING"):+ config = _start(tmp_path, monkeypatch)+ finally:+ config_file.chmod(0o644)++ assert config.port == 8080+ assert config_file.read_text() == content+ assert "Unable to add the multiuser setting" in caplog.text++def test_ensure_fonts_dir_logs_warning_on_oserror(patch_rootdir: None, monkeypatch: pytest.MonkeyPatch, tmp_path: Path, caplog: pytest.LogCaptureFixture):