This commit is contained in:
悟空的日常镜像仓库 2024-06-08 16:33:09 +08:00
parent bad71f9cd0
commit b4f2424b24
5 changed files with 163 additions and 21 deletions

View File

@ -0,0 +1,20 @@
services:
alist:
image: ghcr.io/monlor/xiaoya-alist:latest
volumes:
- xiaoya:/data
ports:
- "5678:5678"
- "2345:2345"
- "2346:2346"
env_file:
- env
restart: unless-stopped
networks:
- default
networks:
default:
volumes:
xiaoya:

View File

@ -24,6 +24,7 @@ services:
- media:/media/xiaoya - media:/media/xiaoya
- config:/media/config - config:/media/config
- cache:/media/config/cache - cache:/media/config/cache
- jf_media:/media/jf_xiaoya
- jf_config:/media/jf_config - jf_config:/media/jf_config
- jf_cache:/media/jf_config/cache - jf_cache:/media/jf_config/cache
- meta:/media/temp - meta:/media/temp
@ -57,7 +58,7 @@ services:
- metadata - metadata
- alist - alist
volumes: volumes:
- media:/media - jf_media:/media
- jf_config:/config - jf_config:/config
- jf_cache:/cache - jf_cache:/cache
ports: ports:
@ -74,6 +75,7 @@ volumes:
media: media:
config: config:
cache: cache:
jf_media:
jf_config: jf_config:
jf_cache: jf_cache:
meta: meta:

View File

@ -21,7 +21,7 @@ services:
- env - env
volumes: volumes:
- xiaoya:/etc/xiaoya - xiaoya:/etc/xiaoya
- media:/media/xiaoya - jf_media:/media/jf_xiaoya
- jf_config:/media/jf_config - jf_config:/media/jf_config
- jf_cache:/media/jf_config/cache - jf_cache:/media/jf_config/cache
- meta:/media/temp - meta:/media/temp
@ -39,7 +39,7 @@ services:
- metadata - metadata
- alist - alist
volumes: volumes:
- media:/media - jf_media:/media
- jf_config:/config - jf_config:/config
- jf_cache:/cache - jf_cache:/cache
ports: ports:
@ -53,7 +53,7 @@ networks:
volumes: volumes:
xiaoya: xiaoya:
media: jf_media:
jf_config: jf_config:
jf_cache: jf_cache:
meta: meta:

41
xiaoya/env Normal file
View File

@ -0,0 +1,41 @@
TZ=Asia/Shanghai
# 阿里云盘token
ALIYUN_TOKEN=
# 阿里云盘open token
ALIYUN_OPEN_TOKEN=
# 阿里云盘文件夹ID
ALIYUN_FOLDER_ID=
# 自动更新小雅alist文件
AUTO_UPDATE_ENABLED=true
# 自动清理阿里云盘
AUTO_CLEAR_ENABLED=true
# 阿里云盘自动清理间隔单位分钟默认1分钟
AUTO_CLEAR_INTERVAL=
# pikpak 账号用来观看小雅中pikpak分享给你的资源格式`qqq@qq.com:aaadds`
PIKPAK_USER=
# 开启tvbox随机订阅地址true/false默认false
TVBOX_SECURITY=
# 开启登陆功能true/false默认false
FORCE_LOGIN=
# webdav用户名为dav设置密码。默认用户密码guest/guest_Api789
WEBDAV_PASSWORD=
# emby 地址,容器内部使用地址,一般不用改
EMBY_ADDR=http://emby:6908
# jellyfin 地址,容器内部使用地址,一般不用改
JELLYFIN_ADDR=http://jellyfin:8096
# alist 地址,容器内部使用地址,一般不用改
ALIST_ADDR=http://alist:5678
# 是否启用emby
EMBY_ENABLED=true
# 是否启用jellyfin
JELLYFIN_ENABLED=false
# 自动更新emby的配置依赖EMBY_APIKEY
AUTO_UPDATE_EMBY_CONFIG_ENABLED=true
# 自动更新emby配置config.mp4间隔单位天默认7天
AUTO_UPDATE_EMBY_INTERVAL=
# 自动更新元数据
AUTO_UPDATE_METADATA_ENABLED=true
# emby的apikey
EMBY_APIKEY=

View File

@ -12,37 +12,100 @@ sedsh() {
fi fi
} }
# 格式https://xxx.com/
GH_PROXY="${GH_PROXY:=}"
# 格式xxx.com # 格式xxx.com
IMAGE_PROXY="${IMAGE_PROXY:=}" IMAGE_PROXY="${IMAGE_PROXY:=}"
# 服务镜像 # 服务镜像
IMAGE_TAG="${VERSION:-latest}" IMAGE_TAG="${VERSION:-latest}"
# 服务下载地址
DOWNLOAD_URL="https://cafe.cpolar.cn/wkdaily/zero3/raw/branch/main/xiaoya"
# 欢迎信息 # 欢迎信息
echo "欢迎使用xiaoya服务部署脚本" echo "欢迎使用xiaoya服务部署脚本"
echo "项目地址https://github.com/monlor/docker-xiaoya" echo "项目地址https://github.com/monlor/docker-xiaoya"
echo "作者monlor (https://link.monlor.com)" echo "作者monlor (https://link.monlor.com)"
echo echo
# 检查docker服务是否存在不存在则询问用户是否安装不安装退出脚本
if ! command -v docker &> /dev/null; then
if [ "$(uname -o)" = "Darwin" ]; then
echo "Docker 未安装请安装docker后再运行脚本推荐OrbStackhttps://orbstack.dev/"
exit 1
fi
read -rp "Docker 未安装,是否安装?(y/n): " install
if [ "$install" = "y" ]; then
echo "安装docker..."
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
systemctl enable docker
systemctl start docker
else
echo "退出安装"
exit 1
fi
fi
DOCKER_COMPOSE="docker compose"
# 检查是否安装了compose插件,docker compose 命令
if ! docker compose &> /dev/null && ! which docker-compose &> /dev/null; then
read -rp "Docker Compose 未安装,是否安装?(y/n): " install
if [ "$install" = "y" ]; then
echo "安装docker compose..."
# 判断系统是x86还是armarm有很多种类都要判断
if [ "$(uname -m)" = "aarch64" ]; then
file=docker-compose-linux-aarch64
elif [ "$(uname -m)" = "x86_64" ]; then
file=docker-compose-linux-x86_64
else
echo "不支持的系统架构$(uname -m), 请自行安装docker compose(https://docs.docker.com/compose/install/linux/#install-using-the-repository)"
exit 1
fi
curl -SL "${GH_PROXY}https://github.com/docker/compose/releases/download/v2.27.1/$file" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
else
echo "退出安装"
exit 1
fi
fi
if ! docker compose &> /dev/null; then
DOCKER_COMPOSE="docker-compose"
fi
# 让用户输入服务部署目录,默认/opt/xiaoya # 让用户输入服务部署目录,默认/opt/xiaoya
read -rp "请输入服务部署目录(默认/opt/xiaoya: " install_path read -rp "请输入服务部署目录(默认/opt/xiaoya: " install_path
install_path=${install_path:=/opt/xiaoya} install_path=${install_path:=/opt/xiaoya}
# 检查服务是否已经运行 # 检查服务是否已经运行
echo "检查服务是否已经存在..."
if [ -f "$install_path/docker-compose.yml" ]; then if [ -f "$install_path/docker-compose.yml" ]; then
# 询问用户是否要更新服务 # 询问用户是否要更新服务
read -rp "检查到服务已存在,是否更新服务?(y/n): " update echo
echo "检查到服务已存在更新会覆盖docker-compose.yml文件不会覆盖env文件"
read -rp "是否更新服务?(y/n): " update
if [ "${update}" != "y" ]; then if [ "${update}" != "y" ]; then
echo "退出安装" echo "退出安装"
exit 1 exit 1
fi fi
fi fi
DOCKER_HOME="$(docker info | grep "Docker Root Dir" | awk -F ':' '{print$2}')"
# 选择数据保存位置
data_location=1
if [ -d "$install_path/data" ]; then
data_location=2
fi
cat <<-EOF
请选择数据保存位置:
1. Docker卷数据保存在: ${DOCKER_HOME}/volumes
2. 服务部署目录(数据保存在: ${install_path}
EOF
read -rp "请选择数据保存位置(默认为${data_location}: " res
data_location=${res:-${data_location}}
token="" token=""
open_token="" open_token=""
folder_id="" folder_id=""
@ -76,7 +139,7 @@ fi
# 让用户输入阿里云盘转存目录folder_idfolder_id获取方式教程https://www.aliyundrive.com/s/rP9gP3h9asE # 让用户输入阿里云盘转存目录folder_idfolder_id获取方式教程https://www.aliyundrive.com/s/rP9gP3h9asE
echo echo
echo "进入阿里云盘网页版,创建一个文件夹点击文件夹复制浏览器阿里云盘地址末尾的文件夹ID最后一个斜杠/后面的一串字符串)" echo "进入阿里云盘网页版,资源盘里面创建一个文件夹点击文件夹复制浏览器阿里云盘地址末尾的文件夹ID最后一个斜杠/后面的一串字符串)"
read -rp "请输入阿里云盘缓存目录ID(默认为$folder_id): " res read -rp "请输入阿里云盘缓存目录ID(默认为$folder_id): " res
folder_id=${res:=$folder_id} folder_id=${res:=$folder_id}
if [ ${#folder_id} -ne 40 ]; then if [ ${#folder_id} -ne 40 ]; then
@ -88,17 +151,21 @@ fi
echo echo
echo "部署类型:" echo "部署类型:"
echo "1. alist + emby (默认)" echo "1. alist + emby (默认)"
echo "2. alist + jellyfin" echo "2. alist"
echo "3. alist + emby + jellyfin" echo "3. alist + jellyfin"
echo "4. alist + emby + jellyfin"
read -rp "请选择部署服务类型: " service_type read -rp "请选择部署服务类型: " service_type
case $service_type in case $service_type in
1) 1)
service_type="" service_type=""
;; ;;
2) 2)
service_type="-jellyfin" service_type="-alist"
;; ;;
3) 3)
service_type="-jellyfin"
;;
4)
service_type="-all" service_type="-all"
;; ;;
*) *)
@ -115,7 +182,7 @@ fi
cd "$install_path" cd "$install_path"
echo "开始生成配置文件docker-compose${service_type}.yml..." echo "开始生成配置文件docker-compose${service_type}.yml..."
curl -#Lo "$install_path/docker-compose.yml" "https://cafe.cpolar.cn/wkdaily/zero3/raw/branch/main/xiaoya/docker-compose${service_type}.yml" curl -#Lo "$install_path/docker-compose.yml" "${DOWNLOAD_URL}/docker-compose${service_type}.yml"
if [ ! -f "$install_path/env" ]; then if [ ! -f "$install_path/env" ]; then
curl -#Lo "$install_path/env" "${DOWNLOAD_URL}/env" curl -#Lo "$install_path/env" "${DOWNLOAD_URL}/env"
fi fi
@ -130,8 +197,21 @@ fi
# 修改镜像版本 # 修改镜像版本
sedsh "s#:latest#:$IMAGE_TAG#g" docker-compose.yml sedsh "s#:latest#:$IMAGE_TAG#g" docker-compose.yml
# 修改数据保存位置
if [ "$data_location" = "2" ]; then
sed -n '/^volumes/,$p' ./docker-compose.yml | sed -e 's/://g' | grep -v volumes | while read -r volume; do
if [ -z "${volume}" ]; then
continue
fi
if [ ! -d "$install_path/data/$volume" ]; then
mkdir -p "$install_path/data/$volume"
fi
sedsh "s#- $volume:#- $install_path/data/$volume:#g" docker-compose.yml
done
sedsh "/^volumes/,\$d" docker-compose.yml
fi
echo "开始部署服务..." echo "开始部署服务..."
DOCKER_COMPOSE="docker compose"
$DOCKER_COMPOSE -f docker-compose.yml up --remove-orphans --pull=always -d $DOCKER_COMPOSE -f docker-compose.yml up --remove-orphans --pull=always -d
echo "服务开始部署如果部署emby/jellyfin下载并解压60G元数据需要一段时间请耐心等待..." echo "服务开始部署如果部署emby/jellyfin下载并解压60G元数据需要一段时间请耐心等待..."
@ -149,8 +229,7 @@ echo "加载配置:$install_path/manage.sh reload"
echo "高级用户自定义配置:$install_path/env" echo "高级用户自定义配置:$install_path/env"
echo "修改env或者compose配置后需要执行上面的加载配置reload命令生效" echo "修改env或者compose配置后需要执行上面的加载配置reload命令生效"
# 获取当前服务器ip
ip=$(curl -s ip.3322.net 2> /dev/null)
# 内网ip # 内网ip
local_ip="" local_ip=""
if [[ "$(uname -o)" = "Darwin" ]]; then if [[ "$(uname -o)" = "Darwin" ]]; then
@ -163,11 +242,11 @@ fi
echo echo
echo "> 服务正在部署,请查看日志等待部署成功后,尝试访问下面的地址" echo "> 服务正在部署,请查看日志等待部署成功后,尝试访问下面的地址"
echo "alisthttps://api.linkopenai.com/topup地址: http://$local_ip:5678" echo "alist: http://$local_ip:5678"
echo "webdav: http://$local_ip:5678/dav, 默认用户密码: guest/guest_Api789" echo "webdav: http://$local_ip:5678/dav, 默认用户密码: guest/guest_Api789"
echo "tvbox: http://$local_ip:5678/tvbox/my_ext.json" echo "tvbox: http://$local_ip:5678/tvbox/my_ext.json"
echo "emby: http://$local_ip:6908, 默认用户密码: xiaoya/1234" echo "emby: http://$local_ip:2345, 默认用户密码: xiaoya/1234"
echo "jellyfin: http://$local_ip:8096,默认用户密码ailg/5678" echo "jellyfin: http://$local_ip:2346, 默认用户密码ailg/5678"
echo echo
echo "还没有部署完,执行这个命令查看日志:$install_path/manage.sh logs" echo "还没有部署完,执行这个命令查看日志:$install_path/manage.sh logs"