fix:添加额外的部署说明

This commit is contained in:
spiritlhl
2025-10-15 12:26:44 +00:00
parent ccd9ac64fb
commit c6169e9eac
2 changed files with 138 additions and 48 deletions

View File

@@ -36,9 +36,22 @@ Since the database starts together when starting, do not operate immediately whe
#### Method 1: Using Pre-built Images
**Setup in Fresh Environment**
**Image Tag Description**
Use pre-built ```amd64``` or ```arm64``` images, which will automatically download the corresponding version based on the current system architecture:
| Image Tag | Description | Use Case |
|---------|------|---------|
| `spiritlhl/oneclickvirt:latest` | Integrated version (built-in database) latest | Quick deployment |
| `spiritlhl/oneclickvirt:20251015` | Integrated version specific date version | Need fixed version |
| `spiritlhl/oneclickvirt:no-db` | Independent database version latest | Without built-in database |
| `spiritlhl/oneclickvirt:no-db-20251015` | Independent database version specific date | Without built-in database |
All images support `linux/amd64` and `linux/arm64` architectures.
**Deployment in Fresh Environment**
Using pre-built `amd64` or `arm64` images, will automatically download the corresponding version based on current system architecture:
Without domain configuration:
```bash
docker run -d \
@@ -50,66 +63,78 @@ docker run -d \
spiritlhl/oneclickvirt:latest
```
Or use GitHub Container Registry:
With domain access configuration:
If you need to configure a domain, you need to set the `FRONTEND_URL` environment variable:
```bash
docker run -d \
--name oneclickvirt \
-p 80:80 \
-e FRONTEND_URL="https://your-domain.com" \
-v oneclickvirt-data:/var/lib/mysql \
-v oneclickvirt-storage:/app/storage \
--restart unless-stopped \
ghcr.io/oneclickvirt/oneclickvirt:latest
spiritlhl/oneclickvirt:latest
```
The above methods are only for new installations.
The above methods are only for fresh installation
**Setup in Existing Environment**
**Upgrade Frontend and Backend Only in Existing Environment**
If you are installing again after deleting the container, you need to ensure that the originally mounted data is also deleted, so that the database will be reinitialized when the container is rebuilt.
No need to delete mounted volumes, just delete the container itself
```shell
docker rm -f oneclickvirt
```
Then delete the original image
```shell
docker image rm -f spiritlhl/oneclickvirt:latest
```
Pull the container image again
```shell
docker pull spiritlhl/oneclickvirt:latest
```
Then follow the steps for deployment in fresh environment, note that after waiting 12 seconds to open the frontend, you will find it automatically skips the initialization interface because the data has been saved and is available
**Redeploy in Existing Environment**
Need to delete not only the container but also the corresponding mounts:
```shell
docker rm -f oneclickvirt
docker volume rm oneclickvirt-data oneclickvirt-storage
```
Then follow the steps for fresh environment setup.
**Delete Container Image**
Then delete the original image
```shell
docker image rm -f spiritlhl/oneclickvirt:latest
docker image rm -f ghcr.io/oneclickvirt/oneclickvirt:latest
```
Only by deleting the container image and re-pulling the image can you ensure that the image used is the latest one; otherwise, the image will not be automatically updated.
**Re-pull Container Image**
Pull the container image again
```shell
docker pull spiritlhl/oneclickvirt:latest
```
or
Then follow the steps for deployment in fresh environment, this will prompt for reinitialization, all original data has been deleted.
```shell
docker pull ghcr.io/oneclickvirt/oneclickvirt:latest
```
#### Method 2: Build and Package Yourself
#### Method 2: Self-compile and Package
If you need to modify source code or custom build:
If you need to modify the source code or customize the build:
**Integrated version (built-in database)**
```bash
git clone https://github.com/oneclickvirt/oneclickvirt.git
cd oneclickvirt
```
```bash
docker build -t oneclickvirt .
```
```bash
docker run -d \
--name oneclickvirt \
-p 80:80 \
@@ -119,6 +144,26 @@ docker run -d \
oneclickvirt
```
**Independent database version:**
```bash
git clone https://github.com/oneclickvirt/oneclickvirt.git
cd oneclickvirt
docker build -f Dockerfile.no-db -t oneclickvirt:no-db .
docker run -d \
--name oneclickvirt \
-p 80:80 \
-e FRONTEND_URL="https://your-domain.com" \
-e DB_HOST="your-mysql-host" \
-e DB_PORT="3306" \
-e DB_NAME="oneclickvirt" \
-e DB_USER="root" \
-e DB_PASSWORD="your-password" \
-v oneclickvirt-storage:/app/storage \
--restart unless-stopped \
oneclickvirt:no-db
```
### Installation via Pre-compiled Binary Files
#### Linux

View File

@@ -38,10 +38,23 @@ API 文档:```http://localhost:8888/swagger/index.html```
#### 方式一:使用预构建镜像
**镜像标签说明**
| 镜像标签 | 说明 | 适用场景 |
|---------|------|---------|
| `spiritlhl/oneclickvirt:latest` | 一体化版本(内置数据库)最新版 | 快速部署 |
| `spiritlhl/oneclickvirt:20251015` | 一体化版本特定日期版本 | 需要固定版本 |
| `spiritlhl/oneclickvirt:no-db` | 独立数据库版本最新版 | 不内置数据库 |
| `spiritlhl/oneclickvirt:no-db-20251015` | 独立数据库版本特定日期 | 不内置数据库 |
所有镜像均支持 `linux/amd64` 和 `linux/arm64` 架构。
**全新环境下开设**
使用已构建好的```amd64```或```arm64```镜像,会自动根据当前系统架构下载对应版本:
不配置域名:
```bash
docker run -d \
--name oneclickvirt \
@@ -52,66 +65,78 @@ docker run -d \
spiritlhl/oneclickvirt:latest
```
或者使用 GitHub Container Registry
配置域名访问
如果你需要配置域名,需要设置 `FRONTEND_URL` 环境变量:
```bash
docker run -d \
--name oneclickvirt \
-p 80:80 \
-e FRONTEND_URL="https://your-domain.com" \
-v oneclickvirt-data:/var/lib/mysql \
-v oneclickvirt-storage:/app/storage \
--restart unless-stopped \
ghcr.io/oneclickvirt/oneclickvirt:latest
spiritlhl/oneclickvirt:latest
```
以上的方式仅限于新安装
**旧有环境下开设**
**旧有环境下仅升级前后端**
如果是删除了容器再次进行安装,那么需要确保原挂载的数据也进行删除,这样后续重建容器才会数据库重新初始化。
不需要删除挂载盘仅删除容器本身即可
```shell
docker rm -f oneclickvirt
```
然后删除原始的镜像
```shell
docker image rm -f spiritlhl/oneclickvirt:latest
```
重新拉取容器镜像
```shell
docker pull spiritlhl/oneclickvirt:latest
```
然后再按全新环境下开设的步骤来注意等待12秒后打开前端会发现已自动越过初始化界面因为数据已保存可用
**旧有环境下重新开设**
不仅需要删除容器还得删除对应的挂载:
```shell
docker rm -f oneclickvirt
docker volume rm oneclickvirt-data oneclickvirt-storage
```
然后再按全新环境下开设的步骤来
**删除容器镜像**
然后删除原始的镜像
```shell
docker image rm -f spiritlhl/oneclickvirt:latest
docker image rm -f ghcr.io/oneclickvirt/oneclickvirt:latest
```
删除了容器镜像重新拉取镜像,才能确保镜像使用的是最新的镜像,否则不会自动更新镜像。
**重新拉取容器镜像**
重新拉取容器镜像
```shell
docker pull spiritlhl/oneclickvirt:latest
```
```shell
docker pull ghcr.io/oneclickvirt/oneclickvirt:latest
```
然后再按全新环境下开设的步骤来,这样会提示重新初始化,所有原始数据已删除。
#### 方式二:自己编译打包
如果需要修改源码或自定义构建:
**一体化版本(内置数据库)**
```bash
git clone https://github.com/oneclickvirt/oneclickvirt.git
cd oneclickvirt
```
```bash
docker build -t oneclickvirt .
```
```bash
docker run -d \
--name oneclickvirt \
-p 80:80 \
@@ -121,6 +146,26 @@ docker run -d \
oneclickvirt
```
**独立数据库版本:**
```bash
git clone https://github.com/oneclickvirt/oneclickvirt.git
cd oneclickvirt
docker build -f Dockerfile.no-db -t oneclickvirt:no-db .
docker run -d \
--name oneclickvirt \
-p 80:80 \
-e FRONTEND_URL="https://your-domain.com" \
-e DB_HOST="your-mysql-host" \
-e DB_PORT="3306" \
-e DB_NAME="oneclickvirt" \
-e DB_USER="root" \
-e DB_PASSWORD="your-password" \
-v oneclickvirt-storage:/app/storage \
--restart unless-stopped \
oneclickvirt:no-db
```
### 通过预编译二进制文件安装
#### Linux