diff --git a/README.md b/README.md index a19ab89..23b1eb3 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,52 @@ docker compose up -d docker compose logs ``` +### 部署在 Kubernetes + +1. 安装helm + +```bash +curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash +``` + +2. 安装helmfile + +```bash +ver=0.161.0 +curl -LO https://github.com/helmfile/helmfile/releases/download/v${ver}/helmfile_${ver}_linux_arm64.tar.gz +tar zxvf helmfile_${ver}_linux_arm64.tar.gz -C helmfile +mv helmfile/helmfile /usr/local/bin +rm -rf helmfile helmfile_${ver}_linux_arm64.tar.gz +helm plugin install https://github.com/databus23/helm-diff +``` + +3. 下载helmfile配置 + +```bash +curl -#LO https://raw.githubusercontent.com/monlor/docker-xiaoya/main/helmfile.yaml +``` + +4. 修改helmfile的环境变量,环境变量含义看这里[alist](/alist) + +```yaml +env: + ... + WEBDAV_PASSWORD: + ALIYUN_TOKEN: + ALIYUN_OPEN_TOKEN: + ALIYUN_FOLDER_ID: + QUARK_COOKIE: + PAN115_COOKIE: + PIKPAK_USER: + ... +``` + +5. 部署helm服务 + +```bash +helmfile sync -f helmfile.yaml +``` + ### 使用docker部署【不推荐】 1. 创建volume diff --git a/helmfile.yaml b/helmfile.yaml index a78e3d0..c8708c0 100644 --- a/helmfile.yaml +++ b/helmfile.yaml @@ -7,7 +7,7 @@ releases: - name: alist namespace: media chart: monlor/quickchart - version: 0.2.6 + version: 0.3.2 values: - port: 5678 extraPort: @@ -24,12 +24,15 @@ releases: pullPolicy: Always env: TZ: Asia/Shanghai - ALIYUN_TOKEN: - ALIYUN_OPEN_TOKEN: - ALIYUN_FOLDER_ID: AUTO_UPDATE_ENABLED: true AUTO_CLEAR_ENABLED: true WEBDAV_PASSWORD: + ALIYUN_TOKEN: + ALIYUN_OPEN_TOKEN: + ALIYUN_FOLDER_ID: + QUARK_COOKIE: + PAN115_COOKIE: + PIKPAK_USER: volumes: - name: data mountPath: /data @@ -57,7 +60,7 @@ releases: - name: metadata namespace: media chart: monlor/quickchart - version: 0.2.6 + version: 0.3.2 values: - nodeSelector: kubernetes.io/hostname: nuc-1-node-1 @@ -109,7 +112,7 @@ releases: - name: emby namespace: media chart: monlor/quickchart - version: 0.2.6 + version: 0.3.2 values: - port: 6908 extraPort: @@ -124,7 +127,6 @@ releases: pullPolicy: Always env: TZ: Asia/Shanghai - GIDLIST: 0,0 # ALIST_ADDR: http://alist:5678 volumes: - name: media @@ -146,8 +148,6 @@ releases: enabled: false strategy: type: Recreate - podSecurityContext: - privileged: true resources: limits: cpu: 4 diff --git a/metadata/README.md b/metadata/README.md index 1b97d65..b2ecdd6 100644 --- a/metadata/README.md +++ b/metadata/README.md @@ -12,7 +12,7 @@ `EMBY_APIKEY`: emby api 密钥,建议修改emby的api密钥,设置此变量,用于定期同步emby配置 -`EMBY_URL`: emby地址,默认:http://emby:6908 +`EMBY_ADDR`: emby地址,默认:http://emby:6908 `ALIST_ADDR`: alist地址,默认:http://alist:5678 diff --git a/metadata/emby.sh b/metadata/emby.sh index bcbdde6..bdd6006 100644 --- a/metadata/emby.sh +++ b/metadata/emby.sh @@ -3,15 +3,15 @@ set -e EMBY_APIKEY=${EMBY_APIKEY:-e825ed6f7f8f44ffa0563cddaddce14d} -EMBY_URL=${EMBY_URL:-http://emby:6908} +EMBY_ADDR=${EMBY_ADDR:-http://emby:6908} ALIST_ADDR=${ALIST_ADDR:=http://alist:5678} -EMBY_CONTROL_URL="${EMBY_URL/6908/8080}" +EMBY_CONTROL_URL="${EMBY_ADDR/6908/8080}" MEDIA_DIR="/media" check_emby_status() { - curl -s -f -m 5 "${EMBY_URL}" > /dev/null + curl -s -f -m 5 "${EMBY_ADDR}" > /dev/null } save_user_policy() { @@ -22,7 +22,7 @@ save_user_policy() { fi echo "保留用户 Policy 中..." - curl -s "${EMBY_URL}/Users?api_key=${EMBY_APIKEY}" > /tmp/emby.response + curl -s "${EMBY_ADDR}/Users?api_key=${EMBY_APIKEY}" > /tmp/emby.response } download() { @@ -109,11 +109,11 @@ update_data() { wait_for_emby() { local MAX_WAIT="300" - echo "Waiting for Emby service to start at $EMBY_URL..." + echo "Waiting for Emby service to start at $EMBY_ADDR..." while true; do local http_code - http_code=$(curl -s -o /dev/null -w "%{http_code}" "${EMBY_URL}/Users") + http_code=$(curl -s -o /dev/null -w "%{http_code}" "${EMBY_ADDR}/Users") if [ "$http_code" -eq 401 ]; then echo "Emby service is up and running." return 0 @@ -136,7 +136,7 @@ recover_user_policy() { id=$(jq -r ".[$i].Id" /tmp/emby.response) name=$(jq -r ".[$i].Name" /tmp/emby.response) policy=$(jq -r ".[$i].Policy | to_entries | from_entries | tojson" /tmp/emby.response) - USER_URL_2="${EMBY_URL}/Users/$id/Policy?api_key=${EMBY_APIKEY}" + USER_URL_2="${EMBY_ADDR}/Users/$id/Policy?api_key=${EMBY_APIKEY}" status_code=$(curl -s -w "%{http_code}" -H "Content-Type: application/json" -X POST -d "$policy" "$USER_URL_2") if [ "$status_code" == "204" ]; then echo "成功更新 $name 用户Policy"