MRX.LAFuck the Rules!

宝塔面板搭建PeerTuBe

吐槽部分:这玩意,确实是一个WebP2P的极好的分享方案,但是,官网的文档写的简直是一塌糊涂.文档是基于旧版本写的,而且也不更新.常用的管理功能不是很完善,如果真要拿来用,自己得有足够的相关知识储备来修改和配置,目前来看.只能说自己搭建了好玩,用来收藏一点自己喜欢的颜色视频罢了.反正我每天十分钟,研究了好几天,都没整明白怎么对接AWS S3和MinIO.另外提一嘴,直播端口不仅要开放1935,你还得开放1936端口!


项目地址

官网:https://joinpeertube.org/ (可能要借助魔法才能访问)

Gayhub:https://github.com/Chocobozzz/PeerTube

基于Docker安装

创建目录

mkdir /你的目录/peertube/ 
cd /你的目录/peertube/ 

拉取最新的Docker配置文件

curl https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml > docker-compose.yml

这里我给出一下我的docker-compose.yml的配置,因为我本地有安装nginx,为了避免冲突,我去掉了peertube自带的.

docker-compose.yml

services:
  peertube:
    # If you don’t want to use the official image and build one from sources:
    # build:
    #   context: .
    #   dockerfile: ./support/docker/production/Dockerfile.bullseye
    image: chocobozzz/peertube:production-bullseye
    # Use a static IP for this container because nginx does not handle proxy host change without reload
    # This container could be restarted on crash or until the postgresql database is ready for connection
    networks:
      default:
        ipv4_address: 172.18.0.42
    env_file:
      - .env
    ports:
     - ”1935:1935” # Comment if you don’t want to use the live feature
     - ”9000:9000” # Uncomment if you use another webserver/proxy or test PeerTube in local, otherwise not suitable for production
    volumes:
      - assets:/app/client/dist
      - ./docker-volume/data:/data
      - ./docker-volume/config:/config
    depends_on:
      - postgres
      - redis
    restart: ”always”
  postgres:
    image: postgres:13-alpine
    env_file:
      - .env
    volumes:
      - ./docker-volume/db:/var/lib/postgresql/data
    restart: ”always”
  redis:
    image: redis:6-alpine
    volumes:
      - ./docker-volume/redis:/data
    restart: ”always”
networks:
  default:
    ipam:
      driver: default
      config:
      - subnet: 172.18.0.0/16
volumes:
  assets:

拉取环境变量env文件`

curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env > .env

然后编辑你的docker-compose.yml

根据你自己的情况选择要或者不要的服务

  • webserver:web 服务,供浏览器访问.(如果你已经安装其他web服务,可以不选.另外我不建议你用nginx来反向代理,因为nginx反向代理之后流媒体需要缓存完毕以后才会发送到客户端,所以基本是播放不了的状态.)
  • peertube:核心,你能不选吗?
  • redis:缓存服务,必选.
  • postgres:数据库,必选.
  • postfix:如果你要提供开放式的服务,就选上,如果是自己搭建的好玩,不选.
  • certbot:自动申请证书,没卵用,没有可以选.

然后编辑.env来修改你的数据库信息和域名.

  •  不带 https://

这一切都准备好以后,就直接开始跑起来吧:

cd /你的目录/peertube
docker-compose up -d

完成以后可以通过你填写的域名加9000端口来访问了

管理员密码获取

Peertub安装完是不显示什么管理员密码的,搞不太懂.可以通过一下命令在安装目录执行获取到root账号密码

docker-compose logs peertube | grep -A1 root 

或者你直接查看Log文件,找到下面的信息也一样.

#查看日志
cat /你的目录/docker-volume/data/logs/peertube.log
#会输出一些信息,找到如下信息,密码就是xxxxxx
{”message”:”Username: root”,”level”:”info”,”timestamp”:”}
{”message”:”User password: xxxxxxxxxx”,”level”:”info”,”timestamp”:”}

你也可以选择不用Docker,但是我嫌麻烦,参考这里:https://docs.joinpeertube.org/install-any-os

升级Peertube

拉取最新的镜像

#进入你的目录
cd /你的目录/peertube
#然后拉取最新的包
docker-compose pull

停止删除容器和卷

docker-compose down -v

然后再跑起来

docker-compose up -d

最后提示一下,升级这个我没尝试过啊,毕竟我Docker用的不多,另外Peertube的docker版本的配置文件和常规版本有点不一样,你们如果要操作,建议先随便搭建一个尝试一下,确认没问题再升级,或者做好相关的备份.

评论

  1. 博主这是你吗?一样的文章https://blog.upx8.com/3149

  2. 他抄袭我的,连字都懒得改一个

  3. 博主大大能帮我看看问题吗:

    [root@VM-4-4-centos nginx]# docker ps

    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

    585ce21230c4 certbot/certbot “/bin/sh -c ‘trap ex…” 25 minutes ago Up 25 minutes 80/tcp, 443/tcp certbot

    4559a3d5d3db chocobozzz/peertube-webserver:latest “/bin/sh entrypoint.…” 25 minutes ago Restarting (1) 42 seconds ago peertube-webserver-1

    7e76b61900d3 chocobozzz/peertube:production-bookworm “/usr/local/bin/entr…” 25 minutes ago Up 25 minutes 0.0.0.0:1935->1935/tcp, :::1935->1935/tcp, 9000/tcp peertube-peertube-1

    452100a4b443 mwader/postfix-relay “/root/run” 25 minutes ago Up 25 minutes 25/tcp peertube-postfix-1

    17a76841b205 postgres:13-alpine “docker-entrypoint.s…” 25 minutes ago Up 25 minutes 5432/tcp peertube-postgres-1

    bffb0ff4b64a redis:6-alpine “docker-entrypoint.s…” 25 minutes ago Up 25 minutes 6379/tcp peertube-redis-1

    我的docker ps 这些都起好了。

    但是访问的时候直接[root@VM-4-4-centos nginx]# curl localhost:9000

    curl: (7) Failed connect to localhost:9000; Connection refused

  4. 端口…都开了吗?直接网页访问提示的什么?

  5. 你直接在本机curl9000端口都不行?

  6. 我用的腾讯云服务器、

    自定义 0.0.0.0/0 TCP 9000 允许

    自定义 0.0.0.0/0 TCP 1935 允许

    PEERTUBE_WEBSERVER_HOSTNAME填的公网IP,访问 http://公网IP:9000/直接 目前无法处理此请求。

    HTTP ERROR 503

    是不是哪个配置有问题呀。还是腾讯云服务器还要开其他端口呢,

  7. 不用其他的端口,我这哈儿在外面,具体怎么回事也要我回去了才能看看.估计要个把小时

  8. 因为我也没有用这个,只是看到这个项目觉得有点意思就搭建玩了一下.所以不能抱太大希望哈,回去了看看

  9. 感谢博主了。我自己在也研究下,我也是找了好几个视频开源项目,想玩玩。可惜没一个成功的

  10. 那你试试playtube啊,更简单,我这会儿还没回去…

  11. playtube这个搜了半天没找到完整的官网网站,只有一些零碎的文档

发表评论

填写下面的表单发表评论