kingmo888 / rustdesk-api-server

基于Django的RustDesk Api&Web Server,除了支持api所有功能,还支持web注册、管理、展示等。已支持到最新1.3.1版本。
937 stars 214 forks source link

构建镜像失败 #6

Closed kokojacket closed 11 months ago

kokojacket commented 11 months ago

实在是不好意思,我是小白,使用portainer构建镜像失败了 日志显示 cannot mount volume over existing file, file exists /share/CACHEDEV1_DATA/docker/container-station-data/lib/docker/overlay2/8f60a7207f46b2219a89bc0c4c9a006f98dba2bfadd3d5432cf13d7b2200ca54/merged/rustdesk-api-server/db.sqlite3 请问有已经上传到dockerhub上的镜像可供拉取吗? image

kingmo888 commented 11 months ago

不好意思,我对docker不是很了解。 看看 @ferocknew 看到后,有没有时间帮你解答下。

Cp0204 commented 11 months ago

我尝试构建了一版,试试

docker-compose

version: "3.8"
services:
  rustdesk-api-server:
    container_name: rustdesk-api-server
    image: ghcr.io/cp0204/rustdesk-api-server:master
    environment:
      - HOST=0.0.0.0
      - TZ=Asia/Shanghai
      - CSRF_TRUSTED_ORIGINS=http://yourdomain.com:21114
    volumes:
      - /yourpath/db:/rustdesk-api-server/db
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    network_mode: bridge
    ports:
      - "21114:21114"
    restart: unless-stopped

docker run

docker run -d \
  --name rustdesk-api-server \
  -p 21114:21114 \
  -e HOST=0.0.0.0 \
  -e TZ=Asia/Shanghai \
  -e CSRF_TRUSTED_ORIGINS=http://yourdomain.com:21114 \
  -v /yourpath/db:/rustdesk-api-server/db \
  -v /etc/timezone:/etc/timezone:ro \
  -v /etc/localtime:/etc/localtime:ro \
  --network bridge \
  --restart unless-stopped \
  ghcr.io/cp0204/rustdesk-api-server:master
Cp0204 commented 11 months ago

集合本项目、官方中转,完整的docker-compose:

version: '3.8'

services:
  hbbr:
    command:
      - hbbr
    container_name: rustdesk-server-hbbr
    image: rustdesk/rustdesk-server:latest
    restart: unless-stopped
    volumes:
      - /DATA/AppData/rustdesk-server/hbbr:/root
    network_mode: bridge
    ports:
      - "21117:21117/tcp"
      - "21119:21119/tcp"
    privileged: false

  hbbs:
    command:
      - hbbs
    container_name: rustdesk-server-hbbs
    depends_on:
      hbbr:
        condition: service_started
        required: true
    image: rustdesk/rustdesk-server:latest
    restart: unless-stopped
    volumes:
      - /DATA/AppData/rustdesk-server/hbbs:/root
    network_mode: bridge
    ports:
      - "21115:21115/tcp"
      - "21118:21118/tcp"
      - "21116:21116/tcp"
      - "21116:21116/udp"
    privileged: false

  rustdesk-server-api:
    container_name: rustdesk-server-api
    environment:
      - CSRF_TRUSTED_ORIGINS=http://yourdomain:21114
      - HOST=0.0.0.0
      - TZ=Asia/Shanghai
    image: ghcr.io/cp0204/rustdesk-api-server:master
    ports:
      - "21114:21114/tcp"
    restart: unless-stopped
    volumes:
      - /DATA/AppData/rustdesk-server/api/db:/rustdesk-api-server/db
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    network_mode: bridge
    privileged: false

/DATA/AppData/rustdesk-server 挂载的数据目录,自行修改

kokojacket commented 11 months ago

我也构建成功了,但是威联通的/etc/timezone 好像无法挂载。我直接注释掉了。不知道是否有影响

Cp0204 commented 11 months ago

我也构建成功了,但是威联通的/etc/timezone 好像无法挂载。我直接注释掉了。不知道是否有影响

这个作用是同步主机的时区,问题不大

kingmo888 commented 11 months ago

集合本项目、官方中转,完整的docker-compose:

version: '3.8'

services:
  hbbr:
    command:
      - hbbr
    container_name: rustdesk-server-hbbr
    image: rustdesk/rustdesk-server:latest
    restart: unless-stopped
    volumes:
      - /DATA/AppData/rustdesk-server/hbbr:/root
    network_mode: bridge
    ports:
      - "21117:21117/tcp"
      - "21119:21119/tcp"
    privileged: false

  hbbs:
    command:
      - hbbs
    container_name: rustdesk-server-hbbs
    depends_on:
      hbbr:
        condition: service_started
        required: true
    image: rustdesk/rustdesk-server:latest
    restart: unless-stopped
    volumes:
      - /DATA/AppData/rustdesk-server/hbbs:/root
    network_mode: bridge
    ports:
      - "21115:21115/tcp"
      - "21118:21118/tcp"
      - "21116:21116/tcp"
      - "21116:21116/udp"
    privileged: false

  rustdesk-server-api:
    container_name: rustdesk-server-api
    environment:
      - CSRF_TRUSTED_ORIGINS=http://yourdomain:21114
      - HOST=0.0.0.0
      - TZ=Asia/Shanghai
    image: ghcr.io/cp0204/rustdesk-api-server:master
    ports:
      - "21114:21114/tcp"
    restart: unless-stopped
    volumes:
      - /DATA/AppData/rustdesk-server/api/db:/rustdesk-api-server/db
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    network_mode: bridge
    privileged: false

/DATA/AppData/rustdesk-server 挂载的数据目录,自行修改

这个挺好,是不是可以拆成2个,一个本项目的,一个集合官方中转服务器的。 有的情况是api服务器和中专服务器不在一起的(从安全角度出发,这也是必要的)

kokojacket commented 11 months ago

好像不支持rustdesk-web-server,部署了web client,发现连接不上api服务器。 另外我也打包了一个镜像到dockerhub,有需要的自取。

version: '3'

networks:
  rustdesk-net:
    name: rustdesk-net
    ipam:
      driver: default
      config:
        - subnet: 172.12.0.0/16
          gateway: 172.12.0.1

services:
  #账户API,项目地址:https://github.com/kingmo888/rustdesk-api-server
  rustdesk-api-server:
    container_name: rustdesk-api-server
    image: kokojack/rustdesk-api-server:latest
    environment:
      - HOST=0.0.0.0
      - TZ=Asia/Shanghai
      - CSRF_TRUSTED_ORIGINS=<域名>:<端口> #api填写地址
    volumes:
      - /share/docker/rustdesk-api-server-main/db.sqlite3:/rustdesk-api-server/db.sqlite3
     #注意,需要提前建立文件夹放入db.sqlite3文件,下载直连:blob:https://github.com/f7f71567-3821-48d7-bd31-9d9429ac2859
     # - /etc/timezone:/etc/timezone:ro
     # 威联通的/etc/timezone时间文件夹有问题。所以我直接给注释掉了
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "21114:21114"
    networks:
      - rustdesk-net

  #中继服务器
  hbbs:
    container_name: hbbs
    ports:
      - 21115:21115
      - 21116:21116 # 自定义 hbbs 映射端口
      - 21116:21116/udp # 自定义 hbbs 映射端口
    image: rustdesk/rustdesk-server
    command: hbbs -r <域名>:21117 # 填入个人域名或 IP + hbbr 映射端口
    volumes:
      - /share/docker/rustdesk/hbbs:/root # 自定义挂载目录
    networks:
      - rustdesk-net
    depends_on:
      - hbbr
    restart: unless-stopped
    deploy:
      resources:
        limits:
          memory: 64M

  hbbr:
    container_name: hbbr
    ports:
      - 21117:21117 # 自定义 hbbr 映射端口
    image: rustdesk/rustdesk-server
    command: hbbr
    volumes:
      - /share/docker/rustdesk/hbbr:/root # 自定义挂载目录
    networks:
      - rustdesk-net
    restart: unless-stopped
    deploy:
      resources:
        limits:
          memory: 64M
ferocknew commented 11 months ago

参考楼上的 docker-compose 就行。

cannot mount volume over existing file, file exists

你这个报错,自己翻译一下就知道怎么回事了

kokojacket commented 11 months ago

参考楼上的 docker-compose 就行。

cannot mount volume over existing file, file exists无法在现有文件上安装卷,文件已存在

你这个报错,自己翻译一下就知道怎么回事了

嗯,这个解决啦~

ferocknew commented 11 months ago

@kingmo888 可以close 了

kokojacket commented 11 months ago

@kingmo888 可以close 了

大佬研究下web-client吧,直接网页连接就连客户端都不用了

Cp0204 commented 11 months ago

@kingmo888 可以close 了

大佬研究下web-client吧,直接网页连接就连客户端都不用了

搜一下52pojie就有现成的

kokojacket commented 11 months ago

52那个静态web-client连接不上

kingmo888 commented 11 months ago

52那个静态web-client连接不上

连得上。我封装进来没问题

kokojacket commented 11 months ago

52那个静态web-client连接不上

连得上。我封装进来没问题

请问这里是需要改成api地址吗,还是改成域名?