静看光阴荏苒
不管不顾不问不说也不念

docker安装p2pspider

闲来无事把这个p2pspider给容器化了,有想图方便的可以试一试。

安装docker和docker-compose:

apt -y update
apt -y install curl
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker
curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

新建一个目录/新建一个docker-compose.yml文件:

mkdir -p /opt/p2pspider-docker && cd /opt/p2pspider-docker && nano docker-compose.yml

写入如下配置:

version: '3.5'

services:
    spider:
        image: imlala/p2pspider:latest
        container_name: p2pspider
        depends_on:
            - mongodb-spider
            - redis-spider
        environment:
            - SITE_NAME=TorrentDatabase
            - USER_NAME=imlala
            - PASS_WORD=23333
            - SPIDER_MODE=1
            - MONGODB_HOST=mongodb://mongodb-spider
            - REDIS_HOST=redis-spider
        ports:
            - "8080:8080"
            - "6881:6881/udp"
        restart: unless-stopped

    mongodb-spider:
        image: mongo
        container_name: mongodb-spider
        volumes:
            - ./mongodb:/data/db
        restart: unless-stopped

    redis-spider:
        image: redis
        container_name: redis-spider
        restart: unless-stopped

几个environment的使用方法:

1.SITE_NAME设置你的网站名字,可以任意填写。

2.USER_NAME/PASS_WORD设置你的账号和密码,如果你想公开给任何人访问这两个env可以不设置直接删除即可。

3.SPIDER_MODE可选配置1/2/3,1代表1H1G的配置,2代表2H2G的配置,3代表最大效率运行爬虫。不设置这个env表示最小配置(512M内存)

4.MONGODB_HOST/REDIS_HOST的主机名必须和docker-compose下面的服务名对应。

没问题up起来即可:

docker-compose up -d

配置反代+域名+SSL访问可以用Traefik这里就不多说了,没安装Traefik可以按照这篇文章安装一下:

Docker+Traefik快速安装PlayTube

贴一个Traefik的配置:

version: '3.5'

services:
    spider:
        image: imlala/p2pspider:latest
        container_name: p2pspider
        depends_on:
            - mongodb-spider
            - redis-spider
        environment:
            - SITE_NAME=TorrentDatabase
            - USER_NAME=imlala
            - PASS_WORD=23333
            - SPIDER_MODE=1
            - MONGODB_HOST=mongodb://mongodb-spider
            - REDIS_HOST=redis-spider
        ports:
            - "6881:6881/udp"
        labels: 
            - "traefik.port=8080"
            - "traefik.frontend.rule=Host:dht.233.fi"
        restart: unless-stopped

    mongodb-spider:
        image: mongo
        container_name: mongodb-spider
        volumes:
            - ./mongodb:/data/db
        labels: 
            - "traefik.enable=false"
        restart: unless-stopped

    redis-spider:
        image: redis
        container_name: redis-spider
        labels: 
            - "traefik.enable=false"
        restart: unless-stopped

networks:
    default:
        external:
            name: imlala

备份还原很简单,直接打包/opt/p2pspider-docker目录,传到别的机器上解压up起来即可。

赞(3)
未经允许不得转载:荒岛 » docker安装p2pspider
分享到: 更多 (0)

评论 28

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    大佬,有空可不可以写一个gost中转小白教程?想用来中转v2ray,但无奈不会用
    谢谢!

    opp4年前 (2020-03-15) Google Chrome 80.0.3987.132 Google Chrome 80.0.3987.132 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 有空我看看。。我记得gost是个很全面的工具,单纯做中转的话v2ray自身就支持中转的。

      LALA4年前 (2020-03-16) Google Chrome 80.0.3987.87 Google Chrome 80.0.3987.87 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    大佬怎么爬的大多是福利资源? :oops:

    Foliage4年前 (2020-03-15) Chrome 80.0.3987.95 Chrome 80.0.3987.95 iPhone iOS 13.3 iPhone iOS 13.3回复
    • 这个不应该就是拿来爬福利资源的嘛 :oops:

      LALA4年前 (2020-03-16) Google Chrome 80.0.3987.87 Google Chrome 80.0.3987.87 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    1H1G至今奔溃两次了,估计512运行不起来吧?这脚本很吃配置啊。Vultr的高性能VPS跑起来都吃力。

    Foliage4年前 (2020-03-15) Chrome 80.0.3987.95 Chrome 80.0.3987.95 iPhone iOS 13.3 iPhone iOS 13.3回复
    • 那就把SPIDER_MODE这个env删了,之后再docker-compose up -d就是以最低配运行了。

      LALA4年前 (2020-03-16) Google Chrome 80.0.3987.87 Google Chrome 80.0.3987.87 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 我现在换了2H2G的VPS,配置调1H1G运行看看怎么样?如果不行就按最低配置运行,再不行就只能放弃了。

        Foliage4年前 (2020-03-16) Chrome 80.0.3987.95 Chrome 80.0.3987.95 iPhone iOS 13.3 iPhone iOS 13.3回复
  4. #4

    这个用1core的机器,真能这能一天收集一百万么? lala跑的情况如何?:arrow:

    alcarl4年前 (2020-03-17) Google Chrome 80.0.3987.132 Google Chrome 80.0.3987.132 Windows 7 x64 Edition Windows 7 x64 Edition回复
    • 我用套路云,24小时后104万,不过建议还是中等配置的VPS去跑,512跑的起,估计也会经常崩。

      Foliage4年前 (2020-03-17) Chrome 80.0.3987.95 Chrome 80.0.3987.95 iPhone iOS 13.3 iPhone iOS 13.3回复
      • 是境外的国际版套路云的套餐么?

        alcarl4年前 (2020-03-17) Google Chrome 80.0.3987.132 Google Chrome 80.0.3987.132 Windows 7 x64 Edition Windows 7 x64 Edition回复
        • 是的

          Foliage4年前 (2020-03-17) Chrome 80.0.3987.95 Chrome 80.0.3987.95 iPhone iOS 13.3 iPhone iOS 13.3回复
    • 看性能如何了,我在upcloud的1corevps上一天100W没问题,ikoula的10o杜甫还是2core的一天10w不到。。

      LALA4年前 (2020-03-17) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 后面也能每天保持100w么?我今天中午用bwg2c2g试了一下跑了8小时左右是20w,我daemon开了4个实例。我之前用文章里的AlphaReign/scraper搭的跑了2周左右才跑了400万,刚开始挺快的越来越慢。我在纠结要不要换这个试试。。。。。 :sad:

        alcarl4年前 (2020-03-17) Google Chrome 80.0.3987.132 Google Chrome 80.0.3987.132 Windows 7 x64 Edition Windows 7 x64 Edition回复
      • 2H2G的VPS运行1H1G的配置,48小时未崩过,看来是可以正常使用了。

        Foliage4年前 (2020-03-17) Chrome 80.0.3987.95 Chrome 80.0.3987.95 iPhone iOS 13.3 iPhone iOS 13.3回复
      • lala一般国外的VPS你用哪家厂商的可以介绍一下吗?可以的话说说选择原因,谢谢

        Foliage4年前 (2020-03-18) Google Chrome 80.0.3987.149 Google Chrome 80.0.3987.149 Windows 10 x64 Edition Windows 10 x64 Edition回复
        • 尽量选大厂的吧,原因无非就是稳定呗。最近一直在用upcloud,挺好的。

          LALA4年前 (2020-03-20) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  5. #5

    教程看不懂,这个图不够给力

    lala4年前 (2020-03-19) Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 Windows 10 x64 Edition Windows 10 x64 Edition回复
  6. #6

    种子里面有中文都是乱码,有解决的办法吗》?

    龙行天下4年前 (2020-03-26) Microsoft Edge 80.0.361.69 Microsoft Edge 80.0.361.69 Windows 10 x64 Edition Windows 10 x64 Edition回复
  7. #7

    还是不会呀,教程对有相关经验的老手有用,对新手来说真的不知道怎样操作。

    ptervip4年前 (2020-03-27) Google Chrome 80.0.3987.149 Google Chrome 80.0.3987.149 Windows 7 Windows 7回复
    • 这个已经够简单明了了,基本上照着复制粘贴就能部署成功。如果是nano编辑器不会用的话,百度学习一下就可以了 :oops:

      LALA4年前 (2020-03-30) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  8. #8

    大佬能不能出个centos下的教程,所有的服务器都是centos

    龙行天下4年前 (2020-03-28) Microsoft Edge 80.0.361.69 Microsoft Edge 80.0.361.69 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • docker不挑剔系统的,centos安装好docker也可以直接这样运行。

      LALA4年前 (2020-03-30) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • docker下面部署会出错啊

        龙行天下4年前 (2020-04-02) Microsoft Edge 80.0.361.109 Microsoft Edge 80.0.361.109 Windows 10 x64 Edition Windows 10 x64 Edition回复
  9. #9

    不知道为啥,爬的很慢,我都开到4,16了,但半天才爬一个

    觉觉4年前 (2020-04-14) Google Chrome 80.0.3987.99 Google Chrome 80.0.3987.99 Android 9 Android 9回复
  10. #10

    8080端口 前几天已经安装Live Torrent 换成8081 不知道能不能行

    losie4年前 (2020-04-14) Google Chrome 80.0.3987.163 Google Chrome 80.0.3987.163 Windows 10 x64 Edition Windows 10 x64 Edition回复
  11. #11

    跑最后一步的时候:ERROR: The Compose file ‘./docker-compose.yml’ is invalid because:
    Unsupported config option for services: ‘mongodb-spider’

    唐风月4年前 (2020-05-07) Google Chrome 81.0.4044.129 Google Chrome 81.0.4044.129 Windows 10 x64 Edition Windows 10 x64 Edition回复
  12. #12

    lala大佬,你好,根据教程用traefik反代后,用域名访问出现404 page not found,但用8080端口访问却是正常的,不知道是咋回事?还请大佬不吝解惑,谢谢 :roll:

    石乐志4年前 (2020-08-26) Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿