Compare commits
1 Commits
feat/multi
...
version/wi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61a62e658a |
@@ -1,17 +1,25 @@
|
|||||||
@echo off
|
@echo off
|
||||||
cd /d "%~dp0"
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
set "WIN_DIR=%~dp0"
|
||||||
|
|
||||||
|
set "WIN_DIR_TRIMMED=%WIN_DIR:~0,-1%"
|
||||||
|
for /f "delims=" %%i in ('wsl wslpath -u "%WIN_DIR_TRIMMED%"') do set "WSL_DIR=%%i"
|
||||||
|
|
||||||
echo ========================================
|
echo ========================================
|
||||||
echo SALEM AI GPU NODE
|
echo SALEM AI GPU NODE (WSL)
|
||||||
echo ========================================
|
echo ========================================
|
||||||
echo.
|
echo.
|
||||||
|
echo Windows path: %WIN_DIR%
|
||||||
|
echo WSL path: %WSL_DIR%
|
||||||
|
echo.
|
||||||
|
|
||||||
echo Starting Docker services...
|
echo Starting Docker services via WSL...
|
||||||
docker compose up -d
|
wsl bash -c "cd '%WSL_DIR%' && docker compose up --build -d"
|
||||||
|
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: Failed to start GPU node.
|
echo ERROR: Failed to start GPU node in WSL.
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
@@ -19,7 +27,7 @@ if errorlevel 1 (
|
|||||||
echo.
|
echo.
|
||||||
echo GPU node started successfully.
|
echo GPU node started successfully.
|
||||||
echo.
|
echo.
|
||||||
docker ps --filter "name=gpu-node-"
|
wsl bash -c "docker ps --filter 'name=gpu-node-'"
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
pause
|
pause
|
||||||
112
compose.yaml
112
compose.yaml
@@ -1,10 +1,11 @@
|
|||||||
name: gpu-node
|
|
||||||
|
name: ${TAILSCALE_HOSTNAME:-gpu-node}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
tailscale:
|
tailscale:
|
||||||
image: tailscale/tailscale:latest
|
image: tailscale/tailscale:latest
|
||||||
container_name: gpu-node-tailscale
|
|
||||||
|
|
||||||
|
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-tailscale
|
||||||
hostname: ${TAILSCALE_HOSTNAME:-gpu-node}
|
hostname: ${TAILSCALE_HOSTNAME:-gpu-node}
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
@@ -13,31 +14,91 @@ services:
|
|||||||
TS_SERVE_CONFIG: /config/serve.json
|
TS_SERVE_CONFIG: /config/serve.json
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./tailscale/state:/var/lib/tailscale
|
- ${HOST_PROJECT_PATH:-.}/tailscale/state:/var/lib/tailscale
|
||||||
- ./tailscale/config:/config:ro
|
- ${HOST_PROJECT_PATH:-.}/tailscale/config:/config:ro
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- gpu-node
|
- gpu-node
|
||||||
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
ssh:
|
ssh:
|
||||||
build:
|
build:
|
||||||
context: ./ssh
|
context: ./ssh
|
||||||
|
|
||||||
container_name: gpu-node-ssh
|
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-ssh-main
|
||||||
hostname: ssh-operator
|
hostname: ssh-main
|
||||||
|
|
||||||
|
environment:
|
||||||
|
HOST_PROJECT_PATH: ${HOST_PROJECT_PATH}
|
||||||
|
SSH_ROLE: main
|
||||||
|
SSH_PORT: "22"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./ssh/authorized_keys:/mounted-authorized-keys:ro
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- ./:/project:ro
|
- ${HOST_PROJECT_PATH:-./}:/project
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- gpu-node
|
- gpu-node
|
||||||
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
|
ssh-companion:
|
||||||
|
profiles:
|
||||||
|
- wake
|
||||||
|
|
||||||
|
build:
|
||||||
|
context: ./ssh
|
||||||
|
|
||||||
|
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-ssh-companion
|
||||||
|
hostname: ssh-companion
|
||||||
|
|
||||||
|
environment:
|
||||||
|
HOST_PROJECT_PATH: ${HOST_PROJECT_PATH}
|
||||||
|
SSH_ROLE: companion
|
||||||
|
SSH_PORT: "2222"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- ${HOST_PROJECT_PATH:-./}:/project
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- gpu-node
|
||||||
|
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
|
webdav:
|
||||||
|
profiles:
|
||||||
|
- wake
|
||||||
|
|
||||||
|
image: rclone/rclone:latest
|
||||||
|
|
||||||
|
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-webdav
|
||||||
|
hostname: webdav
|
||||||
|
|
||||||
|
command:
|
||||||
|
- serve
|
||||||
|
- webdav
|
||||||
|
- /data
|
||||||
|
- --addr
|
||||||
|
- :8080
|
||||||
|
- --user
|
||||||
|
- ${WEBDAV_USER:-operator}
|
||||||
|
- --pass
|
||||||
|
- ${WEBDAV_PASS}
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ${HOST_PROJECT_PATH:-./}:/data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- gpu-node
|
||||||
|
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
gpu-test:
|
gpu-test:
|
||||||
profiles:
|
profiles:
|
||||||
- test
|
- test
|
||||||
@@ -45,7 +106,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./gpu
|
context: ./gpu
|
||||||
|
|
||||||
container_name: gpu-node-gpu-test
|
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-gpu-test
|
||||||
|
|
||||||
gpus: all
|
gpus: all
|
||||||
|
|
||||||
@@ -54,13 +115,33 @@ services:
|
|||||||
|
|
||||||
restart: "no"
|
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:
|
llama:
|
||||||
profiles:
|
profiles:
|
||||||
- llama
|
- llama
|
||||||
|
|
||||||
image: ghcr.io/ggml-org/llama.cpp:server-cuda
|
image: ghcr.io/ggml-org/llama.cpp:server-cuda
|
||||||
|
|
||||||
container_name: gpu-node-llama
|
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-llama
|
||||||
|
|
||||||
gpus: all
|
gpus: all
|
||||||
|
|
||||||
@@ -78,24 +159,22 @@ services:
|
|||||||
|
|
||||||
restart: "no"
|
restart: "no"
|
||||||
|
|
||||||
|
|
||||||
comfyui:
|
comfyui:
|
||||||
profiles:
|
profiles:
|
||||||
- comfy
|
- comfy
|
||||||
|
|
||||||
image: mmartial/comfyui-nvidia-docker:latest
|
image: mmartial/comfyui-nvidia-docker:latest
|
||||||
|
|
||||||
container_name: gpu-node-comfyui
|
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-comfyui
|
||||||
|
|
||||||
init: true
|
init: true
|
||||||
|
|
||||||
gpus: all
|
gpus: all
|
||||||
|
|
||||||
ports:
|
|
||||||
- "8188:8188"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./comfyui/run:/comfy/mnt
|
- ${COMFY_RUN_HOST:-./comfyui/run}:/comfy/mnt
|
||||||
- ./gpu/comfy:/basedir
|
- ${COMFY_BASE_HOST:-./gpu/comfy}:/basedir
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
USE_UV: "true"
|
USE_UV: "true"
|
||||||
@@ -110,6 +189,7 @@ services:
|
|||||||
|
|
||||||
restart: "no"
|
restart: "no"
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
gpu-node:
|
gpu-node:
|
||||||
name: gpu-node
|
name: gpu-node
|
||||||
@@ -4,8 +4,26 @@ RUN apk add --no-cache \
|
|||||||
openssh-server \
|
openssh-server \
|
||||||
docker-cli \
|
docker-cli \
|
||||||
docker-cli-compose \
|
docker-cli-compose \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
bash \
|
||||||
|
jq \
|
||||||
|
vim \
|
||||||
|
less \
|
||||||
|
htop \
|
||||||
|
nano \
|
||||||
|
iproute2 \
|
||||||
|
bind-tools \
|
||||||
|
tcpdump \
|
||||||
|
procps \
|
||||||
|
util-linux \
|
||||||
|
tree \
|
||||||
|
file \
|
||||||
|
ca-certificates \
|
||||||
|
tzdata \
|
||||||
&& addgroup -g 1001 docker-host \
|
&& addgroup -g 1001 docker-host \
|
||||||
&& adduser -D -s /bin/sh operator \
|
&& adduser -D -s /bin/bash operator \
|
||||||
&& adduser operator docker-host \
|
&& adduser operator docker-host \
|
||||||
&& passwd -d operator \
|
&& passwd -d operator \
|
||||||
&& mkdir -p /home/operator/.ssh \
|
&& mkdir -p /home/operator/.ssh \
|
||||||
@@ -19,12 +37,18 @@ RUN printf '%s\n' \
|
|||||||
>> /etc/ssh/sshd_config
|
>> /etc/ssh/sshd_config
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
COPY gpuctl /usr/local/bin/gpuctl
|
COPY gpuctl /usr/local/bin/gpuctl
|
||||||
|
COPY scripts/ /usr/local/lib/scripts/
|
||||||
|
|
||||||
RUN sed -i 's/\r$//' /usr/local/bin/gpuctl \
|
RUN sed -i 's/\r$//' \
|
||||||
&& chmod +x /entrypoint.sh /usr/local/bin/gpuctl
|
/entrypoint.sh \
|
||||||
|
/usr/local/bin/gpuctl \
|
||||||
RUN chmod +x /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
|
EXPOSE 22
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,87 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
|
||||||
|
|
||||||
cp /mounted-authorized-keys /home/operator/.ssh/authorized_keys
|
set -eu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Configuration
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
|
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
|
chown -R operator:operator /home/operator/.ssh
|
||||||
chmod 700 /home/operator/.ssh
|
chmod 700 /home/operator/.ssh
|
||||||
chmod 600 /home/operator/.ssh/authorized_keys
|
chmod 600 /home/operator/.ssh/authorized_keys
|
||||||
|
|
||||||
exec /usr/sbin/sshd -D -e
|
# ------------------------------------------------------------
|
||||||
|
# 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"
|
||||||
258
ssh/gpuctl
258
ssh/gpuctl
@@ -1,178 +1,39 @@
|
|||||||
|
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
PROJECT_DIR="/project"
|
GPuctl_LIB="/usr/local/lib/scripts"
|
||||||
|
|
||||||
|
. "$GPuctl_LIB/common.sh"
|
||||||
|
. "$GPuctl_LIB/status.sh"
|
||||||
|
. "$GPuctl_LIB/gpu.sh"
|
||||||
|
. "$GPuctl_LIB/llama.sh"
|
||||||
|
. "$GPuctl_LIB/comfy.sh"
|
||||||
|
|
||||||
|
|
||||||
get_host_project_dir() {
|
show_usage() {
|
||||||
docker inspect gpu-node-ssh \
|
cat <<'EOF'
|
||||||
--format '{{range .Mounts}}{{if eq .Destination "/project"}}{{.Source}}{{end}}{{end}}'
|
Usage:
|
||||||
}
|
|
||||||
|
|
||||||
|
gpuctl status
|
||||||
|
gpuctl gpu
|
||||||
|
gpuctl update
|
||||||
|
gpuctl sleep
|
||||||
|
gpuctl wake
|
||||||
|
|
||||||
show_status() {
|
gpuctl start llama [model.gguf] [extra args...]
|
||||||
docker ps \
|
gpuctl start comfy [extra args...]
|
||||||
--filter "name=gpu-node-" \
|
|
||||||
--format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
gpuctl comfy models list [type]
|
||||||
|
gpuctl comfy models queue
|
||||||
|
gpuctl comfy models add <URL> <type>
|
||||||
|
gpuctl comfy models rm <filename> [type]
|
||||||
|
|
||||||
start_llama() {
|
gpuctl stop <service>
|
||||||
MODEL="${1:-model.gguf}"
|
gpuctl restart <service>
|
||||||
shift || true
|
gpuctl logs <service>
|
||||||
|
EOF
|
||||||
cd "$PROJECT_DIR"
|
|
||||||
|
|
||||||
HOST_PROJECT_DIR="$(get_host_project_dir)"
|
|
||||||
|
|
||||||
if [ -z "$HOST_PROJECT_DIR" ]; then
|
|
||||||
echo "ERROR: cannot determine host project directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
EXTRA_ARGS="$*"
|
|
||||||
|
|
||||||
echo "Starting llama..."
|
|
||||||
echo "Model: $MODEL"
|
|
||||||
echo "Models: $HOST_PROJECT_DIR/gpu/llama_models"
|
|
||||||
|
|
||||||
if [ -n "$EXTRA_ARGS" ]; then
|
|
||||||
echo "Extra args: $EXTRA_ARGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LLAMA_MODELS_HOST="$HOST_PROJECT_DIR/gpu/llama_models" \
|
|
||||||
LLAMA_MODEL="$MODEL" \
|
|
||||||
LLAMA_EXTRA_ARGS="$EXTRA_ARGS" \
|
|
||||||
docker compose \
|
|
||||||
--profile llama \
|
|
||||||
up -d \
|
|
||||||
--force-recreate \
|
|
||||||
llama
|
|
||||||
|
|
||||||
echo
|
|
||||||
docker ps \
|
|
||||||
--filter "name=gpu-node-llama" \
|
|
||||||
--format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
start_comfy() {
|
|
||||||
cd "$PROJECT_DIR"
|
|
||||||
|
|
||||||
HOST_PROJECT_DIR="$(get_host_project_dir)"
|
|
||||||
|
|
||||||
if [ -z "$HOST_PROJECT_DIR" ]; then
|
|
||||||
echo "ERROR: cannot determine host project directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
EXTRA_ARGS="$*"
|
|
||||||
|
|
||||||
echo "Starting ComfyUI..."
|
|
||||||
echo "Directory: $HOST_PROJECT_DIR/gpu/comfy"
|
|
||||||
|
|
||||||
if [ -n "$EXTRA_ARGS" ]; then
|
|
||||||
echo "Extra args: $EXTRA_ARGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
COMFY_BASE_HOST="$HOST_PROJECT_DIR/gpu/comfy" \
|
|
||||||
COMFY_RUN_HOST="$HOST_PROJECT_DIR/gpu/comfy/run" \
|
|
||||||
COMFY_EXTRA_ARGS="$EXTRA_ARGS" \
|
|
||||||
docker compose \
|
|
||||||
--profile comfy \
|
|
||||||
up -d \
|
|
||||||
--force-recreate \
|
|
||||||
comfyui
|
|
||||||
|
|
||||||
echo
|
|
||||||
docker ps \
|
|
||||||
--filter "name=gpu-node-comfyui" \
|
|
||||||
--format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
stop_service() {
|
|
||||||
SERVICE="$1"
|
|
||||||
|
|
||||||
case "$SERVICE" in
|
|
||||||
llama)
|
|
||||||
docker stop gpu-node-llama 2>/dev/null || true
|
|
||||||
;;
|
|
||||||
|
|
||||||
comfy)
|
|
||||||
docker stop gpu-node-comfyui 2>/dev/null || true
|
|
||||||
;;
|
|
||||||
|
|
||||||
tailscale)
|
|
||||||
docker stop gpu-node-tailscale 2>/dev/null || true
|
|
||||||
;;
|
|
||||||
|
|
||||||
ssh)
|
|
||||||
docker stop gpu-node-ssh 2>/dev/null || true
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "Unknown service: $SERVICE"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
restart_service() {
|
|
||||||
SERVICE="$1"
|
|
||||||
|
|
||||||
case "$SERVICE" in
|
|
||||||
llama)
|
|
||||||
docker restart gpu-node-llama
|
|
||||||
;;
|
|
||||||
|
|
||||||
comfy)
|
|
||||||
docker restart gpu-node-comfyui
|
|
||||||
;;
|
|
||||||
|
|
||||||
tailscale)
|
|
||||||
docker restart gpu-node-tailscale
|
|
||||||
;;
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -182,6 +43,37 @@ case "${1:-}" in
|
|||||||
show_status
|
show_status
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
gpu)
|
||||||
|
show_gpu
|
||||||
|
;;
|
||||||
|
|
||||||
|
update)
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: gpuctl update" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
update_ssh
|
||||||
|
;;
|
||||||
|
|
||||||
|
sleep)
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: gpuctl sleep" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep_mode
|
||||||
|
;;
|
||||||
|
|
||||||
|
wake)
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: gpuctl wake" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
wake_mode
|
||||||
|
;;
|
||||||
|
|
||||||
start)
|
start)
|
||||||
case "${2:-}" in
|
case "${2:-}" in
|
||||||
|
|
||||||
@@ -196,17 +88,25 @@ case "${1:-}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage:"
|
show_usage
|
||||||
echo " gpuctl start llama [model.gguf] [extra args...]"
|
|
||||||
echo " gpuctl start comfy [extra args...]"
|
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
comfy)
|
||||||
|
shift
|
||||||
|
comfy_command "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
|
llama)
|
||||||
|
shift
|
||||||
|
llama_command "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
if [ -z "${2:-}" ]; then
|
if [ "$#" -ne 2 ]; then
|
||||||
echo "Usage: gpuctl stop <service>"
|
echo "Usage: gpuctl stop <service>" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -214,8 +114,8 @@ case "${1:-}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
restart)
|
restart)
|
||||||
if [ -z "${2:-}" ]; then
|
if [ "$#" -ne 2 ]; then
|
||||||
echo "Usage: gpuctl restart <service>"
|
echo "Usage: gpuctl restart <service>" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -223,8 +123,8 @@ case "${1:-}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
logs)
|
logs)
|
||||||
if [ -z "${2:-}" ]; then
|
if [ "$#" -ne 2 ]; then
|
||||||
echo "Usage: gpuctl logs <service>"
|
echo "Usage: gpuctl logs <service>" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -232,15 +132,7 @@ case "${1:-}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "GPU node controller"
|
show_usage
|
||||||
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
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user