ai-dock / stable-diffusion-webui

AUTOMATIC1111 (A1111) Stable Diffusion Web UI docker images for use in GPU cloud and local environments. Includes AI-Dock base for authentication and improved user experience.
Other
110 stars 62 forks source link

Can't run more than one container on different ports #17

Closed andrey-genpracc closed 1 month ago

andrey-genpracc commented 5 months ago

When i started 3 containers with different ports and one workspace i am having stucking state of loading in all containers. Apparelently problem in syncthing . Should i make different configs for syncthing or smth else ?

logs :

Applying attention optimization: Doggettx... done.
Model loaded in 5.8s (load weights from disk: 1.0s, create model: 1.4s, apply weights to model: 3.0s, calculate empty prompt: 0.2s).

Waiting for syncthing server...
[start] 2024/04/18 11:51:21 INFO: syncthing v1.27.4 "Gold Grasshopper" (go1.22.0 linux-amd64) builder@github.syncthing.net 2024-02-27 12:05:19 UTC
[start] 2024/04/18 11:51:21 WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)
[monitor] 2024/04/18 11:51:21 INFO: Syncthing exited: exit status 1
Waiting for syncthing server...
[start] 2024/04/18 11:51:22 INFO: syncthing v1.27.4 "Gold Grasshopper" (go1.22.0 linux-amd64) builder@github.syncthing.net 2024-02-27 12:05:19 UTC
[start] 2024/04/18 11:51:22 WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)
[monitor] 2024/04/18 11:51:22 INFO: Syncthing exited: exit status 1
Waiting for syncthing server...
[start] 2024/04/18 11:51:23 INFO: syncthing v1.27.4 "Gold Grasshopper" (go1.22.0 linux-amd64) builder@github.syncthing.net 2024-02-27 12:05:19 UTC
[start] 2024/04/18 11:51:23 WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)
[monitor] 2024/04/18 11:51:23 INFO: Syncthing exited: exit status 1
Waiting for syncthing server...
[start] 2024/04/18 11:51:24 INFO: syncthing v1.27.4 "Gold Grasshopper" (go1.22.0 linux-amd64) builder@github.syncthing.net 2024-02-27 12:05:19 UTC
[start] 2024/04/18 11:51:24 WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)
[monitor] 2024/04/18 11:51:24 INFO: Syncthing exited: exit status 1
Waiting for syncthing server...
[monitor] 2024/04/18 11:51:25 WARNING: 4 restarts in 4.144379812s; not retrying further

my docker-compose :

version: "3.8"

x-settings: &common_settings
  platform: linux/amd64
  build:
    context: ./build
    args:
      IMAGE_BASE: ${IMAGE_BASE:-ghcr.io/ai-dock/jupyter-pytorch:2.2.1-py3.10-cuda-11.8.0-runtime-22.04}
    tags:
      - "ghcr.io/ai-dock/stable-diffusion-webui:${IMAGE_TAG:-jupyter-pytorch-2.2.1-py3.10-cuda-11.8.0-runtime-22.04}"
  image: ghcr.io/ai-dock/stable-diffusion-webui:${IMAGE_TAG:-jupyter-pytorch-2.2.1-py3.10-cuda-11.8.0-runtime-22.04}
  devices:
    - "/dev/dri:/dev/dri"
  volumes:
    - ./workspace:${WORKSPACE:-/workspace/}:rshared
    - ./config/authorized_keys:/root/.ssh/authorized_keys_mount
    - ./config/provisioning/default.sh:/opt/ai-dock/bin/provisioning.sh
  restart: always
  environment:
    - DIRECT_ADDRESS=${DIRECT_ADDRESS:-127.0.0.1}
    - DIRECT_ADDRESS_GET_WAN=${DIRECT_ADDRESS_GET_WAN:-false}
    - WORKSPACE=${WORKSPACE:-/workspace}
    - WORKSPACE_SYNC=${WORKSPACE_SYNC:-false}
    - CF_TUNNEL_TOKEN=${CF_TUNNEL_TOKEN:-}
    - CF_QUICK_TUNNELS=${CF_QUICK_TUNNELS:-true}
    - WEB_ENABLE_AUTH=${WEB_ENABLE_AUTH:-false}
    - WEB_USER=${WEB_USER:-user}
    - WEB_PASSWORD=${WEB_PASSWORD:-password}
    - SSH_PORT_HOST=${SSH_PORT_HOST:-2222}
    - SSH_PORT_LOCAL=${SSH_PORT_LOCAL:-22}
    - SERVICEPORTAL_PORT_HOST=${SERVICEPORTAL_PORT_HOST:-1111}
    - SERVICEPORTAL_METRICS_PORT=${SERVICEPORTAL_METRICS_PORT:-21111}
    - SERVICEPORTAL_URL=${SERVICEPORTAL_URL:-}
    - WEBUI_BRANCH=${WEBUI_BRANCH:-}
    - WEBUI_FLAGS=${WEBUI_FLAGS:-}
    - WEBUI_PORT_HOST=${WEBUI_PORT_HOST:-9090}
    - WEBUI_PORT_LOCAL=${WEBUI_PORT_LOCAL:-17860}
    - WEBUI_METRICS_PORT=${WEBUI_METRICS_PORT:-27860}
    - WEBUI_URL=${WEBUI_URL:-}
    - JUPYTER_PORT_HOST=${JUPYTER_PORT_HOST:-8888}
    - JUPYTER_METRICS_PORT=${JUPYTER_METRICS_PORT:-28888}
    - JUPYTER_URL=${JUPYTER_URL:-}
    - SERVERLESS=${SERVERLESS:-false}
    - SYNCTHING_UI_PORT_HOST=${SYNCTHING_UI_PORT_HOST:-8384}
    - SYNCTHING_TRANSPORT_PORT_HOST=${SYNCTHING_TRANSPORT_PORT_HOST:-22999}
    - SYNCTHING_URL=${SYNCTHING_URL:-}

services:
  workspace1:
    <<: *common_settings
    ports:
      - "2222:22" # SSH
      - "1111:1111" # Service portal
      - "9090:9090" # WEBUI web interface
      - "8888:8888" # Jupyter server
      - "8384:8384" # Syncthing UI
      - "22999:22999" # Syncthing Transport

  workspace2:
    <<: *common_settings
    ports:
      - "2223:22" # SSH
      - "1112:1112" # Service portal
      - "9091:9090" # WEBUI web interface
      - "8889:8888" # Jupyter server
      - "8385:8384" # Syncthing UI
      - "23000:22999" # Syncthing Transport

  workspace3:
    <<: *common_settings
    ports:
      - "2224:22" # SSH
      - "1113:1113" # Service portal
      - "9092:9090" # WEBUI web interface
      - "8890:8888" # Jupyter server
      - "8386:8384" # Syncthing UI
      - "23001:22999" # Syncthing Transport
robballantyne commented 5 months ago

You probably want a maximum of one syncthing in a shared environment so I should add an environment switch to allow user choice for startup services. I can do that tomorrow.

Really my primary use case has always been running in a single container cloud setup but I'm actively thinking about how to provide the same user experience without over-bundling - it'll take a while to achieve that but it'll be beneficial for local users I hope

robballantyne commented 1 month ago

Now supports passing SUPERVISOR_NO_AUTOSTART=syncthing

A unique Auth cookie will be set for each container to prevent collisions in the same use case