asciinema 方便的终端录屏方案

asciinema 方便的终端录屏方案,我们可以直接使用cli 工具就可以方便的进行终端录制了,然后可以自己提供一份website 基于官方
提供的asciinema-player 进行播放

参考玩法

 

 


简单说明:我们可以基于s3 以及asciinema 提供的工具自己包装一个ui 当然也可以直接使用官方提供的asciinema-server 同时推荐使用s3 作为存储选择

本地部署

实际配置参考rongfengliang/asciinema-docker-compose-learning 项目

  • 参考docker-compose
 
version: '2'
services:
  postgres:
    image: postgres:14-alpine
    container_name: asciinema_postgres
    restart: unless-stopped
    volumes:
      - ./volumes/postgres:/var/lib/postgresql/data
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
  smtp:
    image: namshi/smtp
    container_name: asciinema_smtp
    restart: unless-stopped
    env_file: .env.production
  nginx:
    image: nginx:1.15-alpine
    container_name: asciinema_nginx
    restart: unless-stopped
    links:
      - phoenix
    ports:
      - "80:80"
      # - "443:443"
    volumes:
      - ./docker/nginx/asciinema.conf:/etc/nginx/conf.d/default.conf:ro
      - ./volumes/cache:/cache
  phoenix:
    image: ghcr.io/asciinema/asciinema-server:latest
    container_name: asciinema_phoenix
    restart: unless-stopped
    ports:
      - "3000:3000"
      - "4000:4000"
    links:
      - postgres
      - smtp
    env_file: .env.production
    volumes:
      - ./volumes/uploads:/opt/app/uploads
  • 参考效果

 

 

说明

asciinema 基于json 进行数据的存储,并不需要额外的编解码算法,设计上还是比较巧妙的,同时利用官方提供的播放器就可以方便的展示了,实际上类似
的rrweb 也能基于dom 存储提供web 可视化录屏,套路上有很大的相似性,同时我整理了下官方docker-compose 文件,方便直接部署使用

参考资料

https://github.com/asciinema/asciinema
https://github.com/asciinema/asciinema-server
https://github.com/asciinema/asciinema-player
https://github.com/asciinema/agg
https://www.rrweb.io/
https://github.com/rrweb-io/rrweb
https://github.com/rongfengliang/asciinema-docker-compose-learning

posted on 2023-04-07 10:45  荣锋亮  阅读(40)  评论(0编辑  收藏  举报

导航