自建 免费 NVIDIA vGPU15 License Server 授权服务器,vGPU的虚拟机运行会定时向License服务器发起License请求。
1、CentOS 7 安装docker服务
2、创建配置和生成容器
3、Linux 客户端激活
4、Windows 客户端激活
1、CentOS 7安装Docker服务
#安装依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
#添加Docker源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
#安装Docker
sudo yum install -y docker-ce docker-ce-cli containerd.io
#国内建议修改配置 Docker 镜像加速器
cat > /etc/docker/daemon.json << EOF
{
"dns": ["114.114.114.114", "180.76.76.76"],
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"bip": "192.168.199.1/24",
"debug": true,
"log-level": "info",
"live-restore": true
}
EOF
#启动Docker
sudo systemctl start docker
#设置开机启动
sudo systemctl enable docker
# 拉取最新镜像
docker pull collinwebdesigns/fastapi-dls:latest
# 保存镜像,以备不时之需
docker save -o collinwebdesigns_fastapi-dls.tar collinwebdesigns/fastapi-dls:latest
2、创建配置和生成容器
# 创建目录
mkdir -p /opt/docker/fastapi-dls/cert
cd /opt/docker/fastapi-dls/cert
# 生成公私钥
openssl genrsa -out /opt/docker/fastapi-dls/cert/instance.private.pem 4096
openssl rsa -in /opt/docker/fastapi-dls/cert/instance.private.pem -outform PEM -pubout -out /opt/docker/fastapi-dls/cert/instance.public.pem
# 为 Web 服务器生成 SSL 证书
openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout /opt/docker/fastapi-dls/cert/webserver.key -out /opt/docker/fastapi-dls/cert/webserver.crt
输入属下信息
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:HN
Locality Name (eg, city) [Default City]:ZZ
Organization Name (eg, company) [Default Company Ltd]:zhangfangzhou
Organizational Unit Name (eg, section) []:zhangfangzhou
Common Name (eg, your name or your server's hostname) []:zhangfangzhou
Email Address []:admin@zhangfangzhou.cn
# 配置创建容器 `hostname -i` 换成自己的 IP 即可
docker volume create zhangfangzhou-dls-db
docker run -itd --restart=always -e LEASE_EXPIRE_DAYS=1825 -e DLS_URL=`hostname -i` -e DLS_PORT=8443 -p 8443:443 -v /opt/docker/fastapi-dls/cert:/app/cert -v zhangfangzhou-dls-db:/app/database collinwebdesigns/fastapi-dls:latest
#例如
docker run -itd --restart=always -e LEASE_EXPIRE_DAYS=1825 -e DLS_URL=10.0.0.7 -e DLS_PORT=8443 -p 8443:443 -v /opt/docker/fastapi-dls/cert:/app/cert -v zhangfangzhou-dls-db:/app/database collinwebdesigns/fastapi-dls:latest
3、Linux 客户端激活
wget --no-check-certificate -O /etc/nvidia/ClientConfigToken/client_configuration_token_$(date '+%d-%m-%Y-%H-%M-%S').tok https://10.0.0.7:8443/-/client-token
#接着重启 nvidia-gridd service 服务:
service nvidia-gridd restart
#也可以使用命令行查看授权细节:
nvidia-smi -q |findstr Lincese
4、Windows 桌面客户端激活
使用管理员权限运行 Powershell
C:\Program Files\NVIDIA Corporation\vGPU Licensing\ClientConfigToken
curl.exe --insecure -L -X GET https://10.0.0.7:8443/-/client-token -o "C:\Program Files\NVIDIA Corporation\vGPU Licensing\ClientConfigToken\client_configuration_token_$($(Get-Date).tostring('dd-MM-yy-hh-mm-ss')).tok"
Restart-Service NVDisplay.ContainerLocalSystem
容器接口
下表只列出了主要的接口,更详细的接口可以参考 /-/docs 和 /-/redoc 的 PATH 接口文档。
请求方法 PATH 解释说明
GTE / 重定向到 /-/readme
GTE /-/health 用于运行状况检查,还显示当前版本和提交哈希。
GTE /-/readme HTML 页面展示 README.md
GTE /-/docs GET /-/openapi.json 展示 Swagger UI 页面的接口文档
GTE /-/redoc GET /-/openapi.json 展示 ReDoc 页面的接口文档
GTE /-/manage 显示用于删除源或租约的非常基本的 UI
GTE /-/origins?leases=false 列出注册的原产地,origin 参数指的是包括每个租约的引用源
DELETE /-/origins 删除所有源及其租约
GTE /-/leases?origin=false 列出当前租约,origin 参数指的是包括每个租约的引用源
DELETE /-/lease/{lease_ref} 删除租约
GTE /client-token 生成客户端令牌
docker-compose方式部署示例代码如下:
version: '3.8'
services:
nls-si-0:
image: dls:appliance_3.2.0
environment:
- DLS_DB_HOST=172.16.238.10
- DLS_PUBLIC_IP=${DLS_PUBLIC_IP}
- DLS_PUBLIC_IP4=${DLS_PUBLIC_IP4}
- DLS_HTTPS_PORT=${DLS_HTTPS_PORT:-443}
- DLS_HTTP_PORT=${DLS_HTTP_PORT:-80}
- DLS_EXPOSED_HTTP_PORT=${DLS_EXPOSED_HTTP_PORT:-80}
- DLS_EXPOSED_HTTPS_PORT=${DLS_EXPOSED_HTTPS_PORT:-443}
- DLS_PRIVATE_HOSTNAME=${DLS_PRIVATE_HOSTNAME}
- DLS_RABBITMQ_SSL_PORT=${DLS_RABBITMQ_SSL_PORT:-5671}
- DLS_VA_SERVICE_PORT=${DLS_VA_SERVICE_PORT:-8085}
- DLS_HA_MAX_NODES_ENV=${DLS_HA_MAX_NODES_ENV:-2}
- CPU_CORE_LIMIT=${CPU_CORE_LIMIT:-4}
- INTERNAL_LEASING_PORT=${INTERNAL_LEASING_PORT:-18082}
- INTERNAL_ADMIN_PORT=${INTERNAL_ADMIN_PORT:-18080}
- INTERNAL_AUTH_PORT=${INTERNAL_AUTH_PORT:-18081}
- INTERNAL_SERVICE_INSTANCE_PORT=${INTERNAL_SERVICE_INSTANCE_PORT:-18084}
- INTERNAL_FILE_INSTALL_PORT=${INTERNAL_FILE_INSTALL_PORT:-18083}
- INTERNAL_NLL_PORT=${INTERNAL_NLL_PORT:-18086}
- INTERNAL_VA_PORT=${INTERNAL_VA_PORT:-8085}
- INTERNAL_SUPERVISORCTL_PORT=${INTERNAL_SUPERVISORCTL_PORT:-9001}
depends_on:
- postgres-nls-si-0
ports:
- ${DLS_EXPOSED_HTTP_PORT:-80}:${DLS_HTTP_PORT:-80}
- ${DLS_EXPOSED_HTTPS_PORT:-443}:${DLS_HTTPS_PORT:-443}
- ${DLS_RABBITMQ_SSL_PORT:-5671}:${DLS_RABBITMQ_SSL_PORT:-5671}
- ${DLS_VA_SERVICE_PORT:-8085}:8085
- 8081:8081
- 8082:8082
- 8083:8083
- 8084:8084
- 4369:4369
volumes:
- type: volume
source: configurations
target: /etc/dls/network
- type: volume
source: rabbitmq_data
target: /bitnami/rabbitmq/mnesia
- type: volume
source: logs
target: /var/log
deploy:
resources:
limits:
memory: ${DLS_APPLIANCE_CONTAINER_MEMORY_LIMIT:-6144}M
cpus: "${CPU_CORE_LIMIT:-4}"
reservations:
cpus: "${CPU_CORE_LIMIT:-4}"
memory: ${DLS_APPLIANCE_CONTAINER_MEMORY_LIMIT:-6144}M
hostname: ${DLS_PRIVATE_HOSTNAME}
networks:
back-tier:
ipv4_address: 172.16.238.13
ipv6_address: 2001:3984:3989::11
postgres-nls-si-0:
image: dls:pgsql_3.2.0
restart: always
command: postgres -c max_connections='1000'
networks:
back-tier:
ipv4_address: 172.16.238.10
ipv6_address: 2001:3984:3989::10
logging:
options:
max-size: 10m
max-file: "3"
volumes:
- postgres-data:/var/lib/postgresql/data
- configurations:/etc/dls/config
deploy:
resources:
limits:
memory: ${DLS_POSTGRES_CONTAINER_MEMORY_LIMIT:-2048}M
cpus: "${CPU_CORE_LIMIT:-4}"
reservations:
cpus: "${CPU_CORE_LIMIT:-4}"
memory: ${DLS_POSTGRES_CONTAINER_MEMORY_LIMIT:-2048}M
networks:
back-tier:
enable_ipv6: true
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
- subnet: 2001:3984:3989::/64
gateway: 2001:3984:3989::1
volumes:
postgres-data:
name: postgres-data
venv:
name: venv
configurations:
name: configurations
rabbitmq_data:
name: rabbitmq_data
logs:
name: logs