add 15-LobeChat.sh
This commit is contained in:
@@ -90,6 +90,11 @@ bash <(curl -fsSL https://gitea.tohub.top/Share/vps/raw/branch/main/install/13-N
|
||||
bash <(curl -fsSL https://gitea.tohub.top/Share/vps/raw/branch/main/install/14-Joplin.sh)
|
||||
```
|
||||
|
||||
- 15-LobeChat.sh
|
||||
```sh
|
||||
bash <(curl -fsSL https://gitea.tohub.top/Share/vps/raw/branch/main/install/15-LobeChat.sh)
|
||||
```
|
||||
|
||||
- 23-Sub2API
|
||||
```sh
|
||||
bash <(curl -fsSL https://gitea.tohub.top/Share/vps/raw/branch/main/install/23-Sub2API.sh)
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# chmod +x 15-LobeChat.sh && ./15-LobeChat.sh
|
||||
# curl -sS -O https://gitea.tohub.top/Share/vps/raw/branch/main/install/15-LobeChat.sh && chmod +x 15-LobeChat.sh && ./15-LobeChat.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
port80=8150
|
||||
|
||||
ipv4_address=$(curl -fsS --max-time 10 ipv4.ip.sb || true)
|
||||
if [ -z "$ipv4_address" ]; then
|
||||
ipv4_address="服务器IP"
|
||||
fi
|
||||
|
||||
generate_access_code() {
|
||||
if command -v openssl >/dev/null 2>&1; then
|
||||
openssl rand -hex 16
|
||||
elif [ -r /proc/sys/kernel/random/uuid ]; then
|
||||
tr -d '-' < /proc/sys/kernel/random/uuid
|
||||
else
|
||||
echo "changeme"
|
||||
fi
|
||||
}
|
||||
|
||||
access_code=$(generate_access_code)
|
||||
|
||||
# 1、更新包
|
||||
apt update -y && apt upgrade -y # 更新一下包
|
||||
|
||||
# 2、创建安装目录
|
||||
mkdir -p /root/data/docker_data/LobeChat
|
||||
cd /root/data/docker_data/LobeChat
|
||||
|
||||
# 3、填写docker-compose配置
|
||||
cat <<EOF > docker-compose.yml
|
||||
services:
|
||||
lobe-chat:
|
||||
image: lobehub/lobe-chat:latest
|
||||
container_name: lobe-chat
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "$port80:3210"
|
||||
environment:
|
||||
- ACCESS_CODE=$access_code
|
||||
EOF
|
||||
|
||||
# 4、安装
|
||||
run_compose up -d
|
||||
|
||||
# 5、打开防火墙的端口
|
||||
if command -v ufw >/dev/null 2>&1; then
|
||||
ufw allow "$port80"
|
||||
ufw status
|
||||
else
|
||||
echo "未检测到 ufw,跳过防火墙端口放行。"
|
||||
fi
|
||||
|
||||
# 打印访问链接
|
||||
echo "------------------------"
|
||||
echo "访问链接:"
|
||||
echo "http://$ipv4_address:$port80"
|
||||
echo "https://lobechat.ghuang.top"
|
||||
echo "Access Code: $access_code"
|
||||
echo "------------------------"
|
||||
Reference in New Issue
Block a user