2025-01-06 23:41:52 -05:00
|
|
|
|
## Docker Compose 快速部署指南
|
|
|
|
|
|
|
|
|
|
本指南介绍如何使用 Docker Compose 快速部署 Xboard。默认使用 SQLite 数据库,无需额外安装 MySQL。
|
|
|
|
|
|
|
|
|
|
### 1. 环境准备
|
|
|
|
|
|
|
|
|
|
安装 Docker:
|
|
|
|
|
```bash
|
2023-11-22 01:01:58 -05:00
|
|
|
|
curl -sSL https://get.docker.com | bash
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
# CentOS 系统需要执行:
|
2023-11-22 01:01:58 -05:00
|
|
|
|
systemctl enable docker
|
|
|
|
|
systemctl start docker
|
|
|
|
|
```
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
### 2. 部署步骤
|
|
|
|
|
|
|
|
|
|
1. 获取项目文件:
|
|
|
|
|
```bash
|
|
|
|
|
git clone -b docker-compose --depth 1 https://github.com/cedar2025/Xboard
|
2023-11-22 01:01:58 -05:00
|
|
|
|
cd Xboard
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
2. 安装数据库:
|
|
|
|
|
```bash
|
|
|
|
|
# 快速安装(推荐新手使用)
|
|
|
|
|
docker compose run -it --rm \
|
|
|
|
|
-e enable_sqlite=true \
|
|
|
|
|
-e enable_redis=true \
|
|
|
|
|
-e admin_account=admin@demo.com \
|
|
|
|
|
web php artisan xboard:install
|
|
|
|
|
|
|
|
|
|
# 自定义配置安装(高级用户)
|
|
|
|
|
docker compose run -it --rm web php artisan xboard:install
|
2023-11-22 01:01:58 -05:00
|
|
|
|
```
|
2025-01-06 23:41:52 -05:00
|
|
|
|
> 安装完成后请保存返回的后台地址和管理员账号密码
|
|
|
|
|
|
|
|
|
|
3. 启动服务:
|
|
|
|
|
```bash
|
2023-11-22 01:01:58 -05:00
|
|
|
|
docker compose up -d
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
4. 访问站点:
|
|
|
|
|
- 默认端口:7001
|
|
|
|
|
- 网站地址:http://服务器IP:7001
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
### 3. 版本更新
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
```bash
|
2023-11-22 01:01:58 -05:00
|
|
|
|
cd Xboard
|
|
|
|
|
docker compose pull
|
|
|
|
|
docker compose down
|
2025-01-06 23:41:52 -05:00
|
|
|
|
docker compose run -it --rm web php artisan xboard:update
|
2023-11-22 01:01:58 -05:00
|
|
|
|
docker compose up -d
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
### 4. 版本回滚
|
|
|
|
|
|
|
|
|
|
1. 修改 `docker-compose.yaml` 中的版本号为需要回滚的版本
|
|
|
|
|
2. 执行:`docker compose up -d`
|
|
|
|
|
|
|
|
|
|
### 注意事项
|
2023-11-25 22:56:44 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
- 如需使用 MySQL,请自行安装并重新部署
|
|
|
|
|
- 代码修改后需要重启服务才能生效
|
|
|
|
|
- 可以配置 Nginx 反向代理使用 80 端口
|