Compare commits

...

1 Commits

Author SHA1 Message Date
Operator
61a62e658a win 2026-10-17 10:40:52 +00:00
10 changed files with 637 additions and 556 deletions

View File

@@ -1,3 +1,3 @@
TAILSCALE_HOSTNAME=gpu-node TAILSCALE_HOSTNAME=gpu-node
TS_AUTHKEY= TS_AUTHKEY=
LLAMA_MODELS_PATH=./gpu/llama_models LLAMA_MODELS_PATH=./gpu/llama_models

88
.gitignore vendored
View File

@@ -1,44 +1,44 @@
# SSH # SSH
ssh/authorized_keys ssh/authorized_keys
# Tailscale # Tailscale
tailscale/state/ tailscale/state/
tailscale/config/ tailscale/config/
# GPU models / generated data # GPU models / generated data
gpu/llama_models/* gpu/llama_models/*
!gpu/llama_models/.gitkeep !gpu/llama_models/.gitkeep
gpu/comfy/models/* gpu/comfy/models/*
!gpu/comfy/models/.gitkeep !gpu/comfy/models/.gitkeep
gpu/comfy/input/* gpu/comfy/input/*
!gpu/comfy/input/.gitkeep !gpu/comfy/input/.gitkeep
gpu/comfy/output/* gpu/comfy/output/*
!gpu/comfy/output/.gitkeep !gpu/comfy/output/.gitkeep
gpu/comfy/custom_nodes/* gpu/comfy/custom_nodes/*
!gpu/comfy/custom_nodes/.gitkeep !gpu/comfy/custom_nodes/.gitkeep
gpu/comfy/user/* gpu/comfy/user/*
!gpu/comfy/user/.gitkeep !gpu/comfy/user/.gitkeep
comfyui/run/ comfyui/run/
!comfyui/run/.gitkeep !comfyui/run/.gitkeep
# Environment / secrets # Environment / secrets
.env .env
*.env *.env
# Python # Python
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
.venv/ .venv/
# OS / IDE # OS / IDE
.DS_Store .DS_Store
Thumbs.db Thumbs.db
.idea/ .idea/
.vscode/ .vscode/

View File

@@ -1,25 +1,33 @@
@echo off @echo off
cd /d "%~dp0" setlocal enabledelayedexpansion
echo ======================================== set "WIN_DIR=%~dp0"
echo SALEM AI GPU NODE
echo ======================================== set "WIN_DIR_TRIMMED=%WIN_DIR:~0,-1%"
echo. for /f "delims=" %%i in ('wsl wslpath -u "%WIN_DIR_TRIMMED%"') do set "WSL_DIR=%%i"
echo Starting Docker services... echo ========================================
docker compose up -d echo SALEM AI GPU NODE (WSL)
echo ========================================
if errorlevel 1 ( echo.
echo. echo Windows path: %WIN_DIR%
echo ERROR: Failed to start GPU node. echo WSL path: %WSL_DIR%
pause echo.
exit /b 1
) echo Starting Docker services via WSL...
wsl bash -c "cd '%WSL_DIR%' && docker compose up --build -d"
echo.
echo GPU node started successfully. if errorlevel 1 (
echo. echo.
docker ps --filter "name=gpu-node-" echo ERROR: Failed to start GPU node in WSL.
pause
echo. exit /b 1
)
echo.
echo GPU node started successfully.
echo.
wsl bash -c "docker ps --filter 'name=gpu-node-'"
echo.
pause pause

View File

@@ -1,10 +1,10 @@
FROM ghcr.io/lecode-official/comfyui-docker:latest FROM ghcr.io/lecode-official/comfyui-docker:latest
RUN cd /opt/comfyui-manager \ RUN cd /opt/comfyui-manager \
&& /opt/conda/bin/python -m pip install --no-cache-dir . && /opt/conda/bin/python -m pip install --no-cache-dir .
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,76 +1,76 @@
#!/bin/bash #!/bin/bash
echo "Creating directories for models..." echo "Creating directories for models..."
MODEL_DIRECTORIES=( MODEL_DIRECTORIES=(
"checkpoints" "checkpoints"
"clip" "clip"
"clip_vision" "clip_vision"
"configs" "configs"
"controlnet" "controlnet"
"diffusers" "diffusers"
"diffusion_models" "diffusion_models"
"embeddings" "embeddings"
"gligen" "gligen"
"hypernetworks" "hypernetworks"
"loras" "loras"
"photomaker" "photomaker"
"style_models" "style_models"
"text_encoders" "text_encoders"
"unet" "unet"
"upscale_models" "upscale_models"
"vae" "vae"
"vae_approx" "vae_approx"
) )
for MODEL_DIRECTORY in ${MODEL_DIRECTORIES[@]}; for MODEL_DIRECTORY in ${MODEL_DIRECTORIES[@]};
do do
mkdir -p /opt/comfyui/models/$MODEL_DIRECTORY mkdir -p /opt/comfyui/models/$MODEL_DIRECTORY
done done
echo "Creating symlink for ComfyUI Manager..." echo "Creating symlink for ComfyUI Manager..."
rm --force /opt/comfyui/custom_nodes/ComfyUI-Manager rm --force /opt/comfyui/custom_nodes/ComfyUI-Manager
ln -s \ ln -s \
/opt/comfyui-manager \ /opt/comfyui-manager \
/opt/comfyui/custom_nodes/ComfyUI-Manager /opt/comfyui/custom_nodes/ComfyUI-Manager
echo "Installing requirements for custom nodes..." echo "Installing requirements for custom nodes..."
for CUSTOM_NODE_DIRECTORY in /opt/comfyui/custom_nodes/*; for CUSTOM_NODE_DIRECTORY in /opt/comfyui/custom_nodes/*;
do do
if [ "$CUSTOM_NODE_DIRECTORY" != "/opt/comfyui/custom_nodes/ComfyUI-Manager" ]; if [ "$CUSTOM_NODE_DIRECTORY" != "/opt/comfyui/custom_nodes/ComfyUI-Manager" ];
then then
if [ -f "$CUSTOM_NODE_DIRECTORY/requirements.txt" ]; if [ -f "$CUSTOM_NODE_DIRECTORY/requirements.txt" ];
then then
CUSTOM_NODE_NAME=${CUSTOM_NODE_DIRECTORY##*/} CUSTOM_NODE_NAME=${CUSTOM_NODE_DIRECTORY##*/}
CUSTOM_NODE_NAME=${CUSTOM_NODE_NAME//[-_]/ } CUSTOM_NODE_NAME=${CUSTOM_NODE_NAME//[-_]/ }
echo "Installing requirements for $CUSTOM_NODE_NAME..." echo "Installing requirements for $CUSTOM_NODE_NAME..."
pip install --requirement "$CUSTOM_NODE_DIRECTORY/requirements.txt" pip install --requirement "$CUSTOM_NODE_DIRECTORY/requirements.txt"
fi fi
fi fi
done done
if [ -z "$USER_ID" ] || [ -z "$GROUP_ID" ]; if [ -z "$USER_ID" ] || [ -z "$GROUP_ID" ];
then then
echo "Running container as $USER..." echo "Running container as $USER..."
exec /opt/conda/bin/python main.py \ exec /opt/conda/bin/python main.py \
--port 8188 \ --port 8188 \
--listen 0.0.0.0 \ --listen 0.0.0.0 \
--disable-auto-launch \ --disable-auto-launch \
--enable-manager \ --enable-manager \
"$@" "$@"
else else
echo "Creating non-root user..." echo "Creating non-root user..."
getent group $GROUP_ID > /dev/null 2>&1 || groupadd --gid $GROUP_ID comfyui-user getent group $GROUP_ID > /dev/null 2>&1 || groupadd --gid $GROUP_ID comfyui-user
id -u $USER_ID > /dev/null 2>&1 || useradd --uid $USER_ID --gid $GROUP_ID --create-home comfyui-user id -u $USER_ID > /dev/null 2>&1 || useradd --uid $USER_ID --gid $GROUP_ID --create-home comfyui-user
chown --recursive $USER_ID:$GROUP_ID /opt/comfyui chown --recursive $USER_ID:$GROUP_ID /opt/comfyui
chown --recursive $USER_ID:$GROUP_ID /opt/comfyui-manager chown --recursive $USER_ID:$GROUP_ID /opt/comfyui-manager
export PATH=$PATH:/home/comfyui-user/.local/bin export PATH=$PATH:/home/comfyui-user/.local/bin
echo "Running as comfyui-user..." echo "Running as comfyui-user..."
sudo --set-home --preserve-env=PATH --user \#$USER_ID \ sudo --set-home --preserve-env=PATH --user \#$USER_ID \
/opt/conda/bin/python main.py \ /opt/conda/bin/python main.py \
--port 8188 \ --port 8188 \
--listen 0.0.0.0 \ --listen 0.0.0.0 \
--disable-auto-launch \ --disable-auto-launch \
--enable-manager \ --enable-manager \
"$@" "$@"
fi fi

View File

@@ -1,115 +1,195 @@
name: gpu-node
name: ${TAILSCALE_HOSTNAME:-gpu-node}
services:
tailscale: services:
image: tailscale/tailscale:latest tailscale:
container_name: gpu-node-tailscale image: tailscale/tailscale:latest
hostname: ${TAILSCALE_HOSTNAME:-gpu-node} container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-tailscale
hostname: ${TAILSCALE_HOSTNAME:-gpu-node}
environment:
TS_AUTHKEY: ${TS_AUTHKEY} environment:
TS_STATE_DIR: /var/lib/tailscale TS_AUTHKEY: ${TS_AUTHKEY}
TS_SERVE_CONFIG: /config/serve.json TS_STATE_DIR: /var/lib/tailscale
TS_SERVE_CONFIG: /config/serve.json
volumes:
- ./tailscale/state:/var/lib/tailscale volumes:
- ./tailscale/config:/config:ro - ${HOST_PROJECT_PATH:-.}/tailscale/state:/var/lib/tailscale
- ${HOST_PROJECT_PATH:-.}/tailscale/config:/config:ro
networks:
- gpu-node networks:
- gpu-node
restart: always
restart: always
ssh:
build:
context: ./ssh ssh:
build:
container_name: gpu-node-ssh context: ./ssh
hostname: ssh-operator
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-ssh-main
volumes: hostname: ssh-main
- ./ssh/authorized_keys:/mounted-authorized-keys:ro
- /var/run/docker.sock:/var/run/docker.sock environment:
- ./:/project:ro HOST_PROJECT_PATH: ${HOST_PROJECT_PATH}
SSH_ROLE: main
networks: SSH_PORT: "22"
- gpu-node
volumes:
restart: always - /var/run/docker.sock:/var/run/docker.sock
- ${HOST_PROJECT_PATH:-./}:/project
gpu-test:
profiles: networks:
- test - gpu-node
build: restart: always
context: ./gpu
container_name: gpu-node-gpu-test ssh-companion:
profiles:
gpus: all - wake
networks: build:
- gpu-node context: ./ssh
restart: "no" container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-ssh-companion
hostname: ssh-companion
llama:
profiles: environment:
- llama HOST_PROJECT_PATH: ${HOST_PROJECT_PATH}
SSH_ROLE: companion
image: ghcr.io/ggml-org/llama.cpp:server-cuda SSH_PORT: "2222"
container_name: gpu-node-llama volumes:
- /var/run/docker.sock:/var/run/docker.sock
gpus: all - ${HOST_PROJECT_PATH:-./}:/project
volumes: networks:
- ${LLAMA_MODELS_HOST:-./gpu/llama_models}:/models - gpu-node
command: > restart: always
--host 0.0.0.0
--port 8080
--model /models/${LLAMA_MODEL:-model.gguf} webdav:
${LLAMA_EXTRA_ARGS:-} profiles:
- wake
networks:
- gpu-node image: rclone/rclone:latest
restart: "no" container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-webdav
hostname: webdav
comfyui:
profiles: command:
- comfy - serve
- webdav
image: mmartial/comfyui-nvidia-docker:latest - /data
- --addr
container_name: gpu-node-comfyui - :8080
- --user
init: true - ${WEBDAV_USER:-operator}
- --pass
gpus: all - ${WEBDAV_PASS}
ports: volumes:
- "8188:8188" - ${HOST_PROJECT_PATH:-./}:/data
volumes: networks:
- ./comfyui/run:/comfy/mnt - gpu-node
- ./gpu/comfy:/basedir
restart: always
environment:
USE_UV: "true"
WANTED_UID: "1000" gpu-test:
WANTED_GID: "1000" profiles:
BASE_DIRECTORY: "/basedir" - test
SECURITY_LEVEL: "normal"
COMFY_CMDLINE_EXTRA: ${COMFY_EXTRA_ARGS:-} build:
context: ./gpu
networks:
- gpu-node container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-gpu-test
restart: "no" gpus: all
networks: networks:
gpu-node: - gpu-node
restart: "no"
model-worker:
profiles:
- wake
build:
context: ./model-worker
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-model-worker
volumes:
- ${HOST_PROJECT_PATH:-./}/gpu/comfy/models:/models
- ${HOST_PROJECT_PATH:-./}/gpu/model-worker:/state
networks:
- gpu-node
restart: always
llama:
profiles:
- llama
image: ghcr.io/ggml-org/llama.cpp:server-cuda
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-llama
gpus: all
volumes:
- ${LLAMA_MODELS_HOST:-./gpu/llama_models}:/models
command: >
--host 0.0.0.0
--port 8080
--model /models/${LLAMA_MODEL:-model.gguf}
${LLAMA_EXTRA_ARGS:-}
networks:
- gpu-node
restart: "no"
comfyui:
profiles:
- comfy
image: mmartial/comfyui-nvidia-docker:latest
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-comfyui
init: true
gpus: all
volumes:
- ${COMFY_RUN_HOST:-./comfyui/run}:/comfy/mnt
- ${COMFY_BASE_HOST:-./gpu/comfy}:/basedir
environment:
USE_UV: "true"
WANTED_UID: "1000"
WANTED_GID: "1000"
BASE_DIRECTORY: "/basedir"
SECURITY_LEVEL: "normal"
COMFY_CMDLINE_EXTRA: ${COMFY_EXTRA_ARGS:-}
networks:
- gpu-node
restart: "no"
networks:
gpu-node:
name: gpu-node name: gpu-node

View File

@@ -1,3 +1,3 @@
FROM nvidia/cuda:12.8.1-base-ubuntu24.04 FROM nvidia/cuda:12.8.1-base-ubuntu24.04
CMD ["nvidia-smi"] CMD ["nvidia-smi"]

View File

@@ -1,31 +1,55 @@
FROM alpine:3.22 FROM alpine:3.22
RUN apk add --no-cache \ RUN apk add --no-cache \
openssh-server \ openssh-server \
docker-cli \ docker-cli \
docker-cli-compose \ docker-cli-compose \
&& addgroup -g 1001 docker-host \ git \
&& adduser -D -s /bin/sh operator \ curl \
&& adduser operator docker-host \ wget \
&& passwd -d operator \ bash \
&& mkdir -p /home/operator/.ssh \ jq \
&& ssh-keygen -A vim \
less \
RUN printf '%s\n' \ htop \
'PasswordAuthentication no' \ nano \
'KbdInteractiveAuthentication no' \ iproute2 \
'PubkeyAuthentication yes' \ bind-tools \
'PermitRootLogin no' \ tcpdump \
>> /etc/ssh/sshd_config procps \
util-linux \
COPY entrypoint.sh /entrypoint.sh tree \
COPY gpuctl /usr/local/bin/gpuctl file \
ca-certificates \
RUN sed -i 's/\r$//' /usr/local/bin/gpuctl \ tzdata \
&& chmod +x /entrypoint.sh /usr/local/bin/gpuctl && addgroup -g 1001 docker-host \
&& adduser -D -s /bin/bash operator \
RUN chmod +x /entrypoint.sh /usr/local/bin/gpuctl && adduser operator docker-host \
&& passwd -d operator \
EXPOSE 22 && mkdir -p /home/operator/.ssh \
&& ssh-keygen -A
RUN printf '%s\n' \
'PasswordAuthentication no' \
'KbdInteractiveAuthentication no' \
'PubkeyAuthentication yes' \
'PermitRootLogin no' \
>> /etc/ssh/sshd_config
COPY entrypoint.sh /entrypoint.sh
COPY gpuctl /usr/local/bin/gpuctl
COPY scripts/ /usr/local/lib/scripts/
RUN sed -i 's/\r$//' \
/entrypoint.sh \
/usr/local/bin/gpuctl \
/usr/local/lib/scripts/*.sh \
&& chmod +x \
/entrypoint.sh \
/usr/local/bin/gpuctl \
/usr/local/lib/scripts/*.sh
EXPOSE 22
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,10 +1,87 @@
#!/bin/sh #!/bin/sh
set -e
set -eu
cp /mounted-authorized-keys /home/operator/.ssh/authorized_keys
chown -R operator:operator /home/operator/.ssh
chmod 700 /home/operator/.ssh # ------------------------------------------------------------
chmod 600 /home/operator/.ssh/authorized_keys # Configuration
# ------------------------------------------------------------
exec /usr/sbin/sshd -D -e
HOST_PROJECT_PATH="${HOST_PROJECT_PATH:-}"
SSH_ROLE="${SSH_ROLE:-}"
SSH_PORT="${SSH_PORT:-22}"
if [ -z "$HOST_PROJECT_PATH" ]; then
echo "ERROR: HOST_PROJECT_PATH is not set." >&2
exit 1
fi
if [ -z "$SSH_ROLE" ]; then
echo "ERROR: SSH_ROLE is not set." >&2
exit 1
fi
case "$SSH_ROLE" in
main)
EXPECTED_PORT="22"
;;
companion)
EXPECTED_PORT="2222"
;;
*)
echo "ERROR: unknown SSH_ROLE: $SSH_ROLE" >&2
echo "Expected: main or companion" >&2
exit 1
;;
esac
# ------------------------------------------------------------
# SSH authorized keys
# ------------------------------------------------------------
cp /project/ssh/authorized_keys /home/operator/.ssh/authorized_keys
chown -R operator:operator /home/operator/.ssh
chmod 700 /home/operator/.ssh
chmod 600 /home/operator/.ssh/authorized_keys
# ------------------------------------------------------------
# Interactive shell environment
# ------------------------------------------------------------
cat > /etc/profile.d/gpu-node.sh <<EOF
export HOST_PROJECT_PATH='$HOST_PROJECT_PATH'
export SSH_ROLE='$SSH_ROLE'
export SSH_PORT='$SSH_PORT'
EOF
chmod 644 /etc/profile.d/gpu-node.sh
# ------------------------------------------------------------
# Export for processes started by sshd
# ------------------------------------------------------------
export HOST_PROJECT_PATH
export SSH_ROLE
export SSH_PORT
echo "SSH role: $SSH_ROLE"
echo "Host project path: $HOST_PROJECT_PATH"
echo "SSH port: $SSH_PORT"
# ------------------------------------------------------------
# Start SSH
# ------------------------------------------------------------
exec /usr/sbin/sshd -D -e -p "$SSH_PORT"

View File

@@ -1,247 +1,139 @@
#!/bin/sh
#!/bin/sh
set -eu
set -eu
PROJECT_DIR="/project"
GPuctl_LIB="/usr/local/lib/scripts"
get_host_project_dir() { . "$GPuctl_LIB/common.sh"
docker inspect gpu-node-ssh \ . "$GPuctl_LIB/status.sh"
--format '{{range .Mounts}}{{if eq .Destination "/project"}}{{.Source}}{{end}}{{end}}' . "$GPuctl_LIB/gpu.sh"
} . "$GPuctl_LIB/llama.sh"
. "$GPuctl_LIB/comfy.sh"
show_status() {
docker ps \ show_usage() {
--filter "name=gpu-node-" \ cat <<'EOF'
--format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' Usage:
}
gpuctl status
gpuctl gpu
start_llama() { gpuctl update
MODEL="${1:-model.gguf}" gpuctl sleep
shift || true gpuctl wake
cd "$PROJECT_DIR" gpuctl start llama [model.gguf] [extra args...]
gpuctl start comfy [extra args...]
HOST_PROJECT_DIR="$(get_host_project_dir)"
gpuctl comfy models list [type]
if [ -z "$HOST_PROJECT_DIR" ]; then gpuctl comfy models queue
echo "ERROR: cannot determine host project directory" gpuctl comfy models add <URL> <type>
exit 1 gpuctl comfy models rm <filename> [type]
fi
gpuctl stop <service>
EXTRA_ARGS="$*" gpuctl restart <service>
gpuctl logs <service>
echo "Starting llama..." EOF
echo "Model: $MODEL" }
echo "Models: $HOST_PROJECT_DIR/gpu/llama_models"
if [ -n "$EXTRA_ARGS" ]; then case "${1:-}" in
echo "Extra args: $EXTRA_ARGS"
fi status)
show_status
LLAMA_MODELS_HOST="$HOST_PROJECT_DIR/gpu/llama_models" \ ;;
LLAMA_MODEL="$MODEL" \
LLAMA_EXTRA_ARGS="$EXTRA_ARGS" \ gpu)
docker compose \ show_gpu
--profile llama \ ;;
up -d \
--force-recreate \ update)
llama if [ "$#" -ne 1 ]; then
echo "Usage: gpuctl update" >&2
echo exit 1
docker ps \ fi
--filter "name=gpu-node-llama" \
--format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' update_ssh
} ;;
sleep)
start_comfy() { if [ "$#" -ne 1 ]; then
cd "$PROJECT_DIR" echo "Usage: gpuctl sleep" >&2
exit 1
HOST_PROJECT_DIR="$(get_host_project_dir)" fi
if [ -z "$HOST_PROJECT_DIR" ]; then sleep_mode
echo "ERROR: cannot determine host project directory" ;;
exit 1
fi wake)
if [ "$#" -ne 1 ]; then
EXTRA_ARGS="$*" echo "Usage: gpuctl wake" >&2
exit 1
echo "Starting ComfyUI..." fi
echo "Directory: $HOST_PROJECT_DIR/gpu/comfy"
wake_mode
if [ -n "$EXTRA_ARGS" ]; then ;;
echo "Extra args: $EXTRA_ARGS"
fi start)
case "${2:-}" in
COMFY_BASE_HOST="$HOST_PROJECT_DIR/gpu/comfy" \
COMFY_RUN_HOST="$HOST_PROJECT_DIR/gpu/comfy/run" \ llama)
COMFY_EXTRA_ARGS="$EXTRA_ARGS" \ shift 2
docker compose \ start_llama "$@"
--profile comfy \ ;;
up -d \
--force-recreate \ comfy)
comfyui shift 2
start_comfy "$@"
echo ;;
docker ps \
--filter "name=gpu-node-comfyui" \ *)
--format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' show_usage
} exit 1
;;
esac
stop_service() { ;;
SERVICE="$1"
comfy)
case "$SERVICE" in shift
llama) comfy_command "$@"
docker stop gpu-node-llama 2>/dev/null || true ;;
;;
llama)
comfy) shift
docker stop gpu-node-comfyui 2>/dev/null || true llama_command "$@"
;; ;;
tailscale) stop)
docker stop gpu-node-tailscale 2>/dev/null || true if [ "$#" -ne 2 ]; then
;; echo "Usage: gpuctl stop <service>" >&2
exit 1
ssh) fi
docker stop gpu-node-ssh 2>/dev/null || true
;; stop_service "$2"
;;
*)
echo "Unknown service: $SERVICE" restart)
exit 1 if [ "$#" -ne 2 ]; then
;; echo "Usage: gpuctl restart <service>" >&2
esac exit 1
} fi
restart_service "$2"
restart_service() { ;;
SERVICE="$1"
logs)
case "$SERVICE" in if [ "$#" -ne 2 ]; then
llama) echo "Usage: gpuctl logs <service>" >&2
docker restart gpu-node-llama exit 1
;; fi
comfy) logs_service "$2"
docker restart gpu-node-comfyui ;;
;;
*)
tailscale) show_usage
docker restart gpu-node-tailscale exit 1
;; ;;
ssh)
docker restart gpu-node-ssh
;;
*)
echo "Unknown service: $SERVICE"
exit 1
;;
esac
}
logs_service() {
SERVICE="$1"
case "$SERVICE" in
llama)
docker logs -f gpu-node-llama
;;
comfy)
docker logs -f gpu-node-comfyui
;;
tailscale)
docker logs -f gpu-node-tailscale
;;
ssh)
docker logs -f gpu-node-ssh
;;
*)
echo "Unknown service: $SERVICE"
exit 1
;;
esac
}
case "${1:-}" in
status)
show_status
;;
start)
case "${2:-}" in
llama)
shift 2
start_llama "$@"
;;
comfy)
shift 2
start_comfy "$@"
;;
*)
echo "Usage:"
echo " gpuctl start llama [model.gguf] [extra args...]"
echo " gpuctl start comfy [extra args...]"
exit 1
;;
esac
;;
stop)
if [ -z "${2:-}" ]; then
echo "Usage: gpuctl stop <service>"
exit 1
fi
stop_service "$2"
;;
restart)
if [ -z "${2:-}" ]; then
echo "Usage: gpuctl restart <service>"
exit 1
fi
restart_service "$2"
;;
logs)
if [ -z "${2:-}" ]; then
echo "Usage: gpuctl logs <service>"
exit 1
fi
logs_service "$2"
;;
*)
echo "GPU node controller"
echo
echo "Usage:"
echo " gpuctl status"
echo " gpuctl start llama [model.gguf] [extra args...]"
echo " gpuctl start comfy [extra args...]"
echo " gpuctl stop <service>"
echo " gpuctl restart <service>"
echo " gpuctl logs <service>"
exit 1
;;
esac esac