diff --git a/alist/clear.sh b/alist/clear.sh index 61c0a82..951e451 100644 --- a/alist/clear.sh +++ b/alist/clear.sh @@ -4,10 +4,6 @@ set -e DATA_DIR=/data -myecho() { - echo "$*" -} - retry_command() { # 重试次数和最大重试次数 retries=0 @@ -111,6 +107,11 @@ delete_File() { _file_id=$1 _name="$(echo "$raw_list" | grep -o "\"name\":\"[^\"]*\"" | cut -d':' -f2- | tr -d '"' | grep -n . | grep "^$(echo "$raw_list" | grep -o "\"file_id\":\"[^\"]*\"" | cut -d':' -f2- | tr -d '"' | grep -n . | grep "$_file_id" | awk -F: '{print $1}'):" | awk -F: '{print $2}')" + if [ "${_name}" = "配置文件示范" ] || [ "${_name}" = "常用软件" ]; then + echo "跳过删除文件:$_name" + return 0 + fi + _res=$(curl --connect-timeout 5 -m 5 -s -H "$HEADER" -H "Content-Type: application/json" -X POST -d '{ "requests": [ { @@ -137,7 +138,7 @@ delete_File() { drive_root="备份盘" fi - myecho "彻底删除文件:/$drive_root$path/$_name" + echo "彻底删除文件:/$drive_root$path/$_name" return 0 } @@ -162,7 +163,7 @@ clear_aliyun() { return 0 fi - myecho -e "\n[$(date '+%Y/%m/%d %H:%M:%S')]开始清理小雅$XIAOYA_NAME转存" + echo -e "\n[$(date '+%Y/%m/%d %H:%M:%S')]开始清理小雅$XIAOYA_NAME转存" _res=1 _filenum=0 @@ -172,7 +173,7 @@ clear_aliyun() { _filenum=$(($_filenum + $_res)) done - myecho "本次共清理小雅$XIAOYA_NAME转存文件$_filenum个" + echo "本次共清理小雅$XIAOYA_NAME转存文件$_filenum个" } diff --git a/alist/start.sh b/alist/start.sh index d4166c0..d6ca158 100644 --- a/alist/start.sh +++ b/alist/start.sh @@ -34,22 +34,26 @@ if [ ${#ALIYUN_FOLDER_ID} -ne 40 ]; then echo -e "安装停止,请转存以下目录到你的网盘,并获取该文件夹的folder_id\nhttps://www.aliyundrive.com/s/rP9gP3h9asE \n" exit 1 else - echo "添加阿里云盘 folder_id..." + echo "添加阿里云盘 Folder ID..." echo "${ALIYUN_FOLDER_ID}" > /data/temp_transfer_folder_id.txt fi crond -if [ "${AUTO_UPDATE_ENABLED:=false}" = "true" ]; then +crontabs="" + +if [ "${AUTO_UPDATE_ENABLED:=true}" = "true" ]; then echo "启动定时更新定时任务..." - echo "0 3 * * * /updateall " | crontab - + crontabs="0 3 * * * /updateall" fi -if [ "${AUTO_CLEAR_ENABLED:=false}" = "true" ]; then +if [ "${AUTO_CLEAR_ENABLED:=true}" = "true" ]; then echo "启动定时清理定时任务..." - echo "*/1 * * * * /clear.sh " | crontab - + crontabs="${crontabs}\n*/${AUTO_CLEAR_INTERVAL:=10} * * * * /clear.sh" fi +echo -e "$crontabs" | crontab - + echo "e825ed6f7f8f44ffa0563cddaddce14d" > /data/infuse_api_key.txt exec /entrypoint.sh /opt/alist/alist server --no-prefix \ No newline at end of file diff --git a/helmfile.yaml b/helmfile.yaml new file mode 100644 index 0000000..0ce631f --- /dev/null +++ b/helmfile.yaml @@ -0,0 +1,155 @@ +# 定义全局的repositories +repositories: + - name: monlor + url: https://monlor.github.io/helm-charts + +releases: + - name: alist + namespace: media + chart: monlor/quickchart + version: 0.2.4 + values: + - port: 80 + global: + storageClassName: longhorn-single + nodeSelector: + kubernetes.io/hostname: nuc-1-node-1 + image: + repository: ghcr.io + name: monlor/xiaoya-alist + tag: latest + env: + TZ: Asia/Shanghai + ALIYUN_TOKEN: + ALIYUN_OPEN_TOKEN: + ALIYUN_FOLDER_ID: + AUTO_UPDATE_ENABLED: true + AUTO_CLEAR_ENABLED: true + volumes: + - name: data + mountPath: /data + persistentVolume: + create: true + accessModes: ReadWriteMany + storageSize: 256Mi + strategy: + type: Recreate + resources: + limits: + cpu: 2 + memory: 4Gi + requests: + cpu: 100m + memory: 1Gi + ingress: + enabled: true + className: nginx + clusterIssuer: cloudflare + hosts: + - host: alist.monlor.cn + + - name: glue + namespace: media + chart: monlor/quickchart + version: 0.2.4 + values: + - global: + storageClassName: longhorn-single + nodeSelector: + kubernetes.io/hostname: nuc-1-node-1 + image: + repository: ghcr.io + name: monlor/xiaoya-glue + tag: latest + env: + TZ: Asia/Shanghai + ALIST_ADDR: http://alist:80 + EMBY_ENABLED: true + JELLYFIN_ENABLED: false + volumes: + - name: alist-data + mountPath: /etc/xiaoya + persistentVolume: + accessModes: ReadWriteMany + - name: media + mountPath: /media/xiaoya + persistentVolume: + create: true + accessModes: ReadWriteMany + storageSize: 200Gi + - name: config + mountPath: /media/config + persistentVolume: + create: true + accessModes: ReadWriteMany + storageSize: 200Gi + - name: meta + mountPath: /media/temp + persistentVolume: + create: true + accessModes: ReadWriteOnce + storageSize: 200Gi + strategy: + type: Recreate + resources: + limits: + cpu: 4 + memory: 8Gi + requests: + cpu: 100m + memory: 512Mi + + - name: emby + namespace: media + chart: monlor/quickchart + version: 0.2.4 + values: + - port: 8096 + global: + storageClassName: longhorn-single + nodeSelector: + kubernetes.io/hostname: nuc-1-node-1 + image: + repository: ghcr.io + name: monlor/xiaoya-emby + tag: latest + env: + TZ: Asia/Shanghai + GIDLIST: 0,0 + ALIST_DOMAIN: alist + volumes: + - name: glue-media + mountPath: /media + persistentVolume: + accessModes: ReadWriteMany + - name: glue-config + mountPath: /config + persistentVolume: + accessModes: ReadWriteMany + - name: cache + mountPath: /cache + persistentVolume: + create: true + accessModes: ReadWriteOnce + storageSize: 10Gi + - name: dri + mountPath: /dev/dri + hostPath: + path: /dev/dri + strategy: + type: Recreate + podSecurityContext: + privileged: true + resources: + limits: + cpu: 4 + memory: 8Gi + requests: + cpu: 500m + memory: 1Gi + ingress: + enabled: true + className: nginx + clusterIssuer: cloudflare + hosts: + - host: emby.monlor.cn \ No newline at end of file