-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
版本更新升级教程(包括Docker升级脚本) #15
Comments
OK,可以的 |
目录结构在版本升级之前,首先了解目录结构。
Docker 升级说明# 1. 重新拉取最新镜像
docker pull registry.cn-guangzhou.aliyuncs.com/trueai-org/midjourney-proxy
# 2. 删除容器(确保映射了配置文件和数据库文件)
docker stop mjopen && docker rm mjopen
# 3. 重新启动一个新的容器
# 注意:
# a. 如果你的系统不支持 /etc/localtime 和 TZ 则请删除时区相关(TZ、etc)
# b. 如果不需要图片保存到本地,可删除 attachments 和 ephemeral-attachments 映射
docker run -m 1g --name mjopen -d --restart=always \
-p 8086:8080 --user root \
-v /root/mjopen/logs:/app/logs:rw \
-v /root/mjopen/data:/app/data:rw \
-v /root/mjopen/attachments:/app/wwwroot/attachments:rw \
-v /root/mjopen/ephemeral-attachments:/app/wwwroot/ephemeral-attachments:rw \
-v /root/mjopen/appsettings.Production.json:/app/appsettings.Production.json:ro \
-e TZ=Asia/Shanghai \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
registry.cn-guangzhou.aliyuncs.com/trueai-org/midjourney-proxy 其他版本升级# 1. 下载最新版本后
# 2.1 如果你使用的是 `appsettings.Production.json` 配置文件,则选择全部覆盖。
# 2.2 如果你使用的是 `appsettings.json` 配置文件,注意删除默认的 `appsettings.json` 配置文件,保留你本地的配置文件。 |
|
已经补充了 |
ok,谢谢作者 |
#!/bin/bash
# 定义一些变量
IMAGE_NAME="registry.cn-guangzhou.aliyuncs.com/trueai-org/midjourney-proxy"
CONTAINER_NAME="mjopen"
# 打印信息
echo "开始更新 ${CONTAINER_NAME} 容器..."
# 验证Docker是否安装
if ! command -v docker &> /dev/null
then
echo "Docker 未安装,请先安装 Docker。"
exit 1
fi
# 拉取最新镜像
echo "拉取最新的镜像 ${IMAGE_NAME}..."
docker pull ${IMAGE_NAME}
if [ $? -ne 0 ]; then
echo "拉取镜像失败,请检查网络连接或镜像地址是否正确。"
exit 1
fi
# 停止并移除现有容器
if [ "$(docker ps -q -f name=${CONTAINER_NAME})" ]; then
echo "停止现有的容器 ${CONTAINER_NAME}..."
docker stop ${CONTAINER_NAME}
if [ $? -ne 0 ]; then
echo "停止容器失败,请手动检查。"
exit 1
fi
fi
if [ "$(docker ps -aq -f status=exited -f name=${CONTAINER_NAME})" ]; then
echo "移除现有的容器 ${CONTAINER_NAME}..."
docker rm ${CONTAINER_NAME}
if [ $? -ne 0 ]; then
echo "移除容器失败,请手动检查。"
exit 1
fi
fi
# 运行新的容器
echo "启动新的容器 ${CONTAINER_NAME}..."
docker run -m 1g --name ${CONTAINER_NAME} -d --restart=always \
-p 8086:8080 --user root \
-v /root/mjopen/logs:/app/logs:rw \
-v /root/mjopen/data:/app/data:rw \
-v /root/mjopen/attachments:/app/wwwroot/attachments:rw \
-v /root/mjopen/ephemeral-attachments:/app/wwwroot/ephemeral-attachments:rw \
-e TZ=Asia/Shanghai \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
${IMAGE_NAME}
if [ $? -ne 0 ]; then
echo "启动新的容器失败,请手动检查。"
exit 1
fi
echo "容器 ${CONTAINER_NAME} 更新并启动成功!"
|
version: '3'
services:
mjopen:
image: registry.cn-guangzhou.aliyuncs.com/trueai-org/midjourney-proxy
container_name: mjopen
restart: always
environment:
- TZ=Asia/Shanghai
ports:
- "8086:8080"
volumes:
- /root/mjopen/logs:/app/logs:rw
- /root/mjopen/data:/app/data:rw
- /root/mjopen/attachments:/app/wwwroot/attachments:rw
- /root/mjopen/ephemeral-attachments:/app/wwwroot/ephemeral-attachments:rw
- /root/mjopen/appsettings.Production.json:/app/appsettings.Production.json:ro
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro |
作者能不能写一个更新教程,描述在更新版本时需要迁移哪些文件等等
The text was updated successfully, but these errors were encountered: