Skip to content

Commit

Permalink
feat: 🎸 添加一键部署脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
monlor committed May 30, 2024
1 parent 3e061da commit b2583cd
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 23 deletions.
23 changes: 5 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

🚀 使用 Docker Compose 一键部署服务

✨ 部署alist+下载emby/jellyfin元数据+部署emby/jellyfin服务全流程自动,无需人工干预
✨ 部署alist+下载元数据+部署emby/jellyfin服务全流程自动,无需人工干预

* 所有脚本集成到 Docker 镜像,避免污染系统环境
* 合并jellyfin和emby的x86和arm镜像,部署时无需区分镜像名
Expand All @@ -13,29 +13,16 @@
* 完全兼容所有能运行docker的x86和arm设备
* 支持自动清理阿里云盘,自动同步小雅元数据

## 部署
## 一键部署

下载并修改配置文件 docker-compose.yml,默认配置部署alist+emby
建议最低配置:2核CPU 4G内存 150G硬盘

部署emby大概要下载元数据60G,需要耐心等待下载完成

小雅alist的环境变量配置看[这里](/alist)
默认部署服务:alist + emby

```bash
mkdir /opt/xiaoya && cd /opt/xiaoya
# 下载compose配置,修改变量ALIYUN_TOKEN,ALIYUN_OPEN_TOKEN,ALIYUN_FOLDER_ID
curl -LO https://raw.githubusercontent.com/monlor/docker-xiaoya/main/docker-compose.yml
docker compose up -d
bash -c "$(curl -fsSL https://raw.githubusercontent.com/monlor/docker-xiaoya/main/install.sh)"
```

小雅Alist访问地址:http://你的ip:5678

小雅Emby访问地址:http://你的ip:6908,默认用户:xiaoya,密码:1234

小雅Jellyfin访问地址:http://你的ip:8096

webdav访问地址:http://你的ip:5678/dav,默认用户guest,密码:guest_Api789

## 配置示例

* [只部署小雅alist](/docker-compose-alist.yml)
Expand Down
4 changes: 2 additions & 2 deletions alist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ docker run -d -p 5678:80 -p 2345:2345 -p 2346:2346 --restart=unless-stopped --na

`JELLYFIN_ADDR`: jellyfin部署地址,默认http://jellyfin:8096

`AUTO_UPDATE_ENABLED`: 自动更新小雅的文件,true/false
`AUTO_UPDATE_ENABLED`: 自动更新小雅的文件,true/false,默认false

`AUTO_CLEAR_ENABLED`: 自动清理阿里云云盘的文件,true/false
`AUTO_CLEAR_ENABLED`: 自动清理阿里云云盘的文件,true/false,默认false

`AUTO_CLEAR_INTERVAL`: 自动清理间隔,单位小时,默认24小时
2 changes: 1 addition & 1 deletion glue/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## 环境变量

`AUTO_UPDATE_EMBY_CONFIG_ENABLED`: 自动更新emby配置,下载config.mp4导入config,metadata需要使用resilio自动更新
`AUTO_UPDATE_EMBY_CONFIG_ENABLED`: 自动更新emby配置,下载config.mp4导入config,true/false,默认false

`AUTO_UPDATE_EMBY_INTERVAL`: 自动更新emby配置间隔,默认7,单位天
5 changes: 3 additions & 2 deletions helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ releases:
ALIST_ADDR: http://alist:80
EMBY_ENABLED: true
JELLYFIN_ENABLED: false
AUTO_UPDATE_EMBY_CONFIG_ENABLED: true
volumes:
- name: data
mountPath: /etc/xiaoya
Expand Down Expand Up @@ -171,12 +172,12 @@ releases:
TZ: Asia/Shanghai
volumes:
- name: media
mountPath: /media/xiaoya
mountPath: /sync/xiaoya
hostPath:
path: /opt/xiaoya/media
type: DirectoryOrCreate
- name: config
mountPath: /media/config
mountPath: /sync/config
hostPath:
path: /opt/xiaoya/config
type: DirectoryOrCreate
Expand Down
87 changes: 87 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/sh

# 欢迎信息
echo "欢迎使用xiaoya服务部署脚本"
echo "项目地址:https://github.com/monlor/docker-xiaoya"
echo "作者:monlor (https://link.monlor.com)"
echo

# 检查docker服务是否存在,不存在则询问用户是否安装,不安装退出脚本
if ! command -v docker &> /dev/null; then
echo "Docker 未安装,是否安装?(y/n)"
read 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

# 让用户输入服务部署目录,默认/opt/xiaoya
echo "请输入服务部署目录,默认/opt/xiaoya"
read -p "请输入服务部署目录:" install_path
install_path=${install_path:=/opt/xiaoya}

# 让用户输入阿里云盘TOKEN,token获取方式教程:https://alist.nn.ci/zh/guide/drivers/aliyundrive.html
echo "阿里云盘token获取方式教程:https://alist.nn.ci/zh/guide/drivers/aliyundrive.html"
read -p "请输入阿里云盘TOKEN:" token
if [ ${#token} -ne 32 ]; then
echo "长度不对,阿里云盘 Token是32位"
exit 1
fi

# 让用户输入阿里云盘OpenTOKEN,token获取方式教程:https://alist.nn.ci/zh/guide/drivers/aliyundrive_open.html
echo "阿里云盘Open token获取方式教程:https://alist.nn.ci/zh/guide/drivers/aliyundrive_open.html"
read -p "请输入阿里云盘Open TOKEN:" open_token
if [ ${#open_token} -le 334 ]; then
echo "长度不对,阿里云盘 Open Token是335位"
exit 1
fi

# 让用户输入阿里云盘转存目录folder_id,folder_id获取方式教程:https://www.aliyundrive.com/s/rP9gP3h9asE
echo "转存以下文件到你的网盘,进入文件夹,获取地址栏末尾的文件夹ID:https://www.aliyundrive.com/s/rP9gP3h9asE"
read -p "请输入阿里云盘转存目录folder_id:" folder_id
if [ ${#folder_id} -ne 40 ]; then
echo "长度不对,阿里云盘 folder id是40位"
exit 1
fi

# 检查目录是否存在,不存在则创建
if [ ! -d "$install_path" ]; then
mkdir -p $install_path
fi

echo "开始生成配置文件..."
curl -LO https://raw.githubusercontent.com/monlor/docker-xiaoya/main/docker-compose.yml
sed -i "s#ALIYUN_TOKEN=.*#ALIYUN_TOKEN=$token#g" docker-compose.yml
sed -i "s#ALIYUN_OPEN_TOKEN=.*#ALIYUN_OPEN_TOKEN=$open_token#g" docker-compose.yml
sed -i "s#ALIYUN_FOLDER_ID=.*#ALIYUN_FOLDER_ID=$folder_id#g" docker-compose.yml

echo "开始部署服务..."
docker compose -f docker-compose.yml up --remove-orphans -d

echo "服务部署完成,下载并解压60G元数据需要一段时间,请耐心等待..."

echo
echo "> 服务管理"
# 提示用户compose如何查看日志,启动,重启,停止服务
echo "查看日志:docker compose -f $install_path/docker-compose.yml logs -f"
echo "启动服务:docker compose -f $install_path/docker-compose.yml start"
echo "重启服务:docker compose -f $install_path/docker-compose.yml restart"
echo "停止服务:docker compose -f $install_path/docker-compose.yml down"

# 获取当前服务器ip
ip=$(curl -s ip.sb 2> /dev/null)
# 内网ip
local_ip=$(hostname -I | awk '{print $1}')

echo
echo "> 等待服务部署完成后访问地址如下"
echo "alist地址: http://$local_ip:5678, http://$ip:5678"
echo "webdav地址: http://$local_ip:5678/dav, http://$ip:5678/dav, 默认用户密码: guest/guest_Api789"
echo "emby地址: http://$local_ip:6908, http://$ip:6908, 默认用户密码: xiaoya/1234"
echo "jellyfin地址: http://$local_ip:8096, http://$ip:8096"

0 comments on commit b2583cd

Please sign in to comment.