Skip to content

Commit

Permalink
feat: ๐ŸŽธ ไผ˜ๅŒ–ไบ‘็›˜ๆธ…็†่„šๆœฌ
Browse files Browse the repository at this point in the history
  • Loading branch information
monlor committed May 29, 2024
1 parent 831634e commit 3e8a9d8
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 12 deletions.
15 changes: 8 additions & 7 deletions alist/clear.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ set -e

DATA_DIR=/data

myecho() {
echo "$*"
}

retry_command() {
# ้‡่ฏ•ๆฌกๆ•ฐๅ’Œๆœ€ๅคง้‡่ฏ•ๆฌกๆ•ฐ
retries=0
Expand Down Expand Up @@ -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": [
{
Expand All @@ -137,7 +138,7 @@ delete_File() {
drive_root="ๅค‡ไปฝ็›˜"
fi

myecho "ๅฝปๅบ•ๅˆ ้™คๆ–‡ไปถ๏ผš/$drive_root$path/$_name"
echo "ๅฝปๅบ•ๅˆ ้™คๆ–‡ไปถ๏ผš/$drive_root$path/$_name"

return 0
}
Expand All @@ -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
Expand All @@ -172,7 +173,7 @@ clear_aliyun() {
_filenum=$(($_filenum + $_res))
done

myecho "ๆœฌๆฌกๅ…ฑๆธ…็†ๅฐ้›…$XIAOYA_NAME่ฝฌๅญ˜ๆ–‡ไปถ$_filenumไธช"
echo "ๆœฌๆฌกๅ…ฑๆธ…็†ๅฐ้›…$XIAOYA_NAME่ฝฌๅญ˜ๆ–‡ไปถ$_filenumไธช"

}

Expand Down
14 changes: 9 additions & 5 deletions alist/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
155 changes: 155 additions & 0 deletions helmfile.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3e8a9d8

Please sign in to comment.