SUNBALCONY 发布的文章


公众号:电影美剧喵


0906

沼泽深处的女孩


0905

瑞克和莫蒂 S6E01

龙之家族S1E03


0903

坠落

俄亥俄州的魔鬼


0902

指环王 力量之戒


0901

我曾来过

爱在度假屋


0824

神探大战

DC萌宠特遣队

龙之家族


0825

外星+人

不Nope


0826

奥利不见了

首尔大作战

唯我独尊


0831

白日梦想家


转ts

ffmpeg -y -i ymlw.mp4 -vcodec copy -acodec copy -vbsf h264_mp4toannexb film.ts

切分片

ffmpeg -i film.ts -c copy -map 0 -f segment -segment_list index.m3u8 -segment_time 5 film-%03d.ts

如你所见,本站运行在Kubernetes集群中,当某个节点有问题或者需要重启时,依然能提供正常的访问能力,并且可以自动恢复,直接进行维护即可,得益于Kubernetes的调度,让本站的容灾能力得到提升,下面是yaml文件


需要修改的地方

  • storageClassName ##修改为你自己的存储类名
  • storage #持久化存储空间的大小
  • nodePort #暴露在宿主机上的端口

部署

kubectl create ns typecho #创建namespace命名空间
kubectl apply -f typecho.yaml -n typecho

Typecho yaml文件

apiVersion: apps/v1
kind: Deployment
metadata:
  name: typecho
  labels:
    app: typecho
spec:
  replicas: 2
  template:
    metadata:
      name: typecho
      labels:
        app: typecho
    spec:
      containers:
        - name: typecho
          image: 80x86/typecho:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 80
              protocol: TCP
              name: http
          env:
            - name: TIMEZONE
              value: "Asia/Shanghai"
          resources:
            requests:
              cpu: "300m"
              memory: "512Mi"
            limits:
              cpu: "1000m"
              memory: "2048Mi"
          volumeMounts:
            - name: typecho-data
              mountPath: /data
              readOnly: false
      volumes:
        - name: typecho-data
          persistentVolumeClaim:
            claimName: typecho-data
      restartPolicy: Always
  selector:
    matchLabels:
      app: typecho
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: typecho-data
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: "nfs-storage2"   #你自己的sc
  resources:
    requests:
      storage: 10Gi    #存储大小
---
---
apiVersion: v1
kind: Service
metadata:
  name: typecho
spec:
  type: NodePort
  selector:
    app: typecho
  ports:
    - port: 80
      nodePort: 12345

服务地址

https://cdnjs.ipip.icu/

样例(PS:本站服务可直接使用)


js等文件加速

https://cdnjs.ipip.icu/npm/jquery@3.2.1/dist/jquery.min.js


Github资源加速

https://cdnjs.ipip.icu/gh/Sunbalcony/note/README.md


最佳实践

使用Docker nginx 镜像部署外挂配置文件食用效果更佳


Nginx参考配置

server {
  listen 80;
  #listen 443 ssl http2;

  # 请更改为你的证书路径
  #ssl_certificate certs/default.cer;
  #ssl_certificate_key certs/default.key;    
  server_name cdn.ipip.icu;

  location / {
  proxy_pass https://cdn.jsdelivr.net;
  proxy_set_header Host $proxy_host;
  proxy_set_header Accept-Encoding '';
  proxy_ssl_server_name on;
  proxy_ssl_name $proxy_host;
  proxy_redirect / /;
  # Proxy Cache
  proxy_cache jsdelivr;
  proxy_cache_lock on;
  proxy_cache_lock_timeout 15s;
  proxy_cache_use_stale updating;
  proxy_cache_background_update on;
  proxy_cache_key $host$request_uri;
  proxy_cache_valid 200 301 302 30d;
  proxy_cache_valid 500 501 502 503 15s;
  proxy_cache_valid any 5m;
  # Replace Domain
  sub_filter_once off;
  sub_filter_types application/javascript application/json text/xml text/css;
  #sub_filter '$proxy_host' '$host';
  sub_filter 'cdn.jsdelivr.net'  'cdn.ipip.icu';
}
access_log /var/log/nginx/jsd.log main;
}

# 缓存路径请根据需要更改
proxy_cache_path /etc/nginx/conf.d/ levels=1:2 use_temp_path=off keys_zone=jsdelivr:300m inactive=1d max_size=5g;