From 6e0c77f3c21baf542fbdc56b14a9d0307880c396 Mon Sep 17 00:00:00 2001 From: Alex Lebens Date: Sun, 26 Jan 2025 01:43:59 -0600 Subject: [PATCH] add stable diffusion --- hosts/pd05wd/ollama/compose.yaml | 2 + hosts/pd05wd/stable-diffusion/.ts-env | 1 + hosts/pd05wd/stable-diffusion/compose.yaml | 68 ++++++++++++++++++++++ hosts/pd05wd/stable-diffusion/serve.json | 16 +++++ 4 files changed, 87 insertions(+) create mode 100644 hosts/pd05wd/stable-diffusion/.ts-env create mode 100644 hosts/pd05wd/stable-diffusion/compose.yaml create mode 100644 hosts/pd05wd/stable-diffusion/serve.json diff --git a/hosts/pd05wd/ollama/compose.yaml b/hosts/pd05wd/ollama/compose.yaml index 92f137d6f..a1f05b63a 100644 --- a/hosts/pd05wd/ollama/compose.yaml +++ b/hosts/pd05wd/ollama/compose.yaml @@ -43,6 +43,8 @@ services: container_name: ollama environment: - OLLAMA_KEEP_ALIVE=24h + labels: + - "com.centurylinklabs.watchtower.scope=ollama" restart: always deploy: resources: diff --git a/hosts/pd05wd/stable-diffusion/.ts-env b/hosts/pd05wd/stable-diffusion/.ts-env new file mode 100644 index 000000000..4c297bf5a --- /dev/null +++ b/hosts/pd05wd/stable-diffusion/.ts-env @@ -0,0 +1 @@ +TS_AUTHKEY="" diff --git a/hosts/pd05wd/stable-diffusion/compose.yaml b/hosts/pd05wd/stable-diffusion/compose.yaml new file mode 100644 index 000000000..f3a8919c0 --- /dev/null +++ b/hosts/pd05wd/stable-diffusion/compose.yaml @@ -0,0 +1,68 @@ +--- +services: + tailscale-stable-diffusion: + image: ghcr.io/tailscale/tailscale:latest + container_name: tailscale-stable-diffusion + cap_add: + - net_admin + - sys_module + environment: + - TS_STATE_DIR=/var/lib/tailscale + - TS_ENABLE_METRICS=true + - TS_HOSTNAME=stable-diffusion-pd05wd + - TS_SERVE_CONFIG=/config/serve.json + env_file: + - .ts-env + labels: + - "com.centurylinklabs.watchtower.scope=stable-diffusion" + network_mode: service:stable-diffusion + restart: always + volumes: + - tailscale:/var/lib/tailscale + - ${PWD}/serve.json:/config/serve.json + devices: + - /dev/net/tun:/dev/net/tun + + watchtower: + image: ghcr.io/containrrr/watchtower:latest + container_name: stable-diffusion-watchtower + command: --scope stable-diffusion + environment: + - TZ=America/Chicago + - WATCHTOWER_HTTP_API_METRICS=true + - WATCHTOWER_HTTP_API_TOKEN=token + - WATCHTOWER_CLEANUP=true + - WATCHTOWER_POLL_INTERVAL=3600 + labels: + - "com.centurylinklabs.watchtower.scope=stable-diffusion" + network_mode: service:stable-diffusion + restart: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock + + stable-diffusion: + image: ghcr.io/ai-dock/stable-diffusion-webui:latest-cpu + container_name: stable-diffusion + environment: + - WEBUI_ARGS="--api --listen" + - CF_QUICK_TUNNELS=false + - WEB_ENABLE_AUTH=false + - PORT="7860" + - SUPERVISOR_NO_AUTOSTART=jupyter,syncthing + labels: + - "com.centurylinklabs.watchtower.scope=stable-diffusion" + restart: always + deploy: + resources: + reservations: + devices: + - driver: nvidia + capabilities: ["gpu"] + count: all + volumes: + - workspace:/workspace:rshared + - ./models:/opt/stable-diffusion-webui/models/Stable-diffusion + +volumes: + tailscale: + workspace: diff --git a/hosts/pd05wd/stable-diffusion/serve.json b/hosts/pd05wd/stable-diffusion/serve.json new file mode 100644 index 000000000..08d5864f3 --- /dev/null +++ b/hosts/pd05wd/stable-diffusion/serve.json @@ -0,0 +1,16 @@ +{ + "TCP": { + "443": { + "HTTPS": true + } + }, + "Web": { + "${TS_CERT_DOMAIN}:443": { + "Handlers": { + "/": { + "Proxy": "http://127.0.0.1:7860" + } + } + } + } +}