Merge pull request #5 from rebecca554owen/dev

修正教程错误
This commit is contained in:
Xboard 2023-11-22 14:13:11 +08:00 committed by GitHub
commit 76bf2e3a53
2 changed files with 251 additions and 0 deletions

View File

@ -0,0 +1,123 @@
**本篇教程默认你具备一定的Linux基础操作原来网站搭建在宝塔或者aapanel上。**
---
1.迁移之前登录aapanel后台>网站>站点目录,把`config/v2board.php`下载,复制 `网站路径`SSH连接到v2board的VPS。
```
cd /www/wwwroot/你的站点域名
bash update.sh
```
更新至v2board 1.7.4 / dev 或者wyx2685 分支最新版。
2.在aaPanel 面板 > 数据库,点击备份你的旧版数据库。
3.安装并登录到1panel >应用商店,安装 OpenResty、MySql、Redis可选安装 phpadmin、redis-commander。
```
apt install curl vim -y # 安装依赖不喜欢vim可以用 nano 或者 Finalshell 直接编辑
```
```
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && bash quick_start.sh
```
4.登录到1panel > 数据库安装MySQL数据库上传并导入v2board数据库备份。
5.回到SSH终端获取Docker compose 文件
```
git clone -b docker-compose --depth 1 https://github.com/cedar2025/Xboard
cd Xboard
```
在1panel >文件上传v2board.php到Xboard目录下。
6.编辑`.env` 文件,填写Mysql数据库以及Redis账号密码
```
vim .env #编辑环境变量
```
```
APP_NAME=XBoard
APP_ENV=local
APP_KEY=base64:PZXk5vTuTinfeEVG5FpYv2l6WEhLsyvGpiWK7IgJJ60=
APP_DEBUG=false
APP_URL=http://localhost
ADMIN_SETTING_CACHE=60 #设置缓存时间(单位秒)
#LaravelS配置
LARAVELS_LISTEN_IP=0.0.0.0
LARAVELS_LISTEN_PORT=80
LARAVELS_HANDLE_STATIC=true
LARAVELS_MAX_REQUEST=1000
LARAVELS_WORKER_NUM=2
LARAVELS_TIMER=true
APP_RUNNING_IN_CONSOLE=true
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1 # 桥接模式连接容器可以写成mysql
DB_PORT=3306
DB_DATABASE=xboard
DB_USERNAME=xboard
DB_PASSWORD=root_password # 点击 1panel>数据库>Mysql 复制密码
REDIS_HOST=127.0.0.1 # 桥接模式连接容器可以写成redis
REDIS_PASSWORD=root_password # 点击 1panel>数据库>redis 连接信息 复制密码
REDIS_PORT=6379
#默认将队列驱动和缓存驱动都修改为了redis请务必安装redis
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME=null
MAILGUN_DOMAIN=
MAILGUN_SECRET=
# 用于阻止重复安装
INSTALLED=true
```
7.修改docker-compose.yaml
```
vim docker-compose.yaml
```
```
version: '3'
services:
xboard:
image: ghcr.io/cedar2025/xboard:latest
volumes:
- ./.env:/www/.env # ./ 表示当前目录下,.env文件内有数据库账号密码信息要写
- ./.docker/.data/:/www/.docker/.data/
- ./v2board.php:/www/config/v2board.php # v2board.php 上传到当前Xboard目录
network_mode: host # 多开容器需要改网络模式
```
8.根据v2board数据库版本执行对应的迁移数据库命令
```
docker compose run -it --rm xboard php artisan migratefromv2b 1.7.3
```
```
docker compose run -it --rm xboard php artisan migratefromv2b 1.7.4
```
```
docker compose run -it --rm xboard php artisan migratefromv2b dev231027
```
```
docker compose run -it --rm xboard php artisan migratefromv2b wyx2685
```
9.执行迁移配置命令
```
docker compose run -it --rm xboard php artisan migrateFromV2b config
```
10.启动
```
dockcer compose up -d
```
11.在Xboard目录下停止并更新后启动。
```
dockcer compose down && dockcer compose pull && dockcer compose up -d
```

128
docs/多开Xboard教程.md Normal file
View File

@ -0,0 +1,128 @@
**本篇教程默认你已经安装了1panel并部署单个Xboard容器运行成功。**
1.在/opt/1panel/apps/redis/redis目录新建一个redis1文件夹并复制data、conf、logs进去。
2.在1panel>容器>编排修改Redis默认的docker-compose.yaml
```
networks:
1panel-network:
external: true
services:
redis0:
image: redis:7.2.3
container_name: redis0
networks:
- 1panel-network
ports:
- 127.0.0.1:6379:6379
restart: always
volumes:
- ./data:/data
- ./conf/redis.conf:/etc/redis/redis.conf
- ./logs:/logs
command: redis-server --requirepass root_password
redis1:
image: redis:7.2.3
container_name: redis1
networks:
- 1panel-network
ports:
- 127.0.0.1:6378:6379
restart: always
volumes:
- /opt/1panel/apps/redis/redis/redis1/data:/data
- /opt/1panel/apps/redis/redis/redis1/conf/redis.conf:/etc/redis/redis.conf
- /opt/1panel/apps/redis/redis/redis1/logs:/logs
command: redis-server --requirepass root_password
version: "3"
```
改完重启应该有两个Redis启动了,看日志是否报错。
3.1panel>文件在Xbaord目录修改`.env`文件。
```
DB_HOST=mysql
#省略
REDIS_HOST=redis
```
4.在Xbaord目录新建一个xbaord1文件夹并创建第二个容器的`.env`文件。
```
APP_NAME=XBoard
APP_ENV=local
APP_KEY=base64:PZXk5vTuTinfeEVG5FpYv2l6WEhLsyvGpiWK7IgJJ60=
APP_DEBUG=false
APP_URL=http://localhost
ADMIN_SETTING_CACHE=60 #设置缓存时间(单位秒)
#LaravelS配置
LARAVELS_LISTEN_IP=0.0.0.0
LARAVELS_LISTEN_PORT=80
LARAVELS_HANDLE_STATIC=true
LARAVELS_MAX_REQUEST=1000
LARAVELS_WORKER_NUM=2
LARAVELS_TIMER=true
APP_RUNNING_IN_CONSOLE=true
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql # 桥接模式连接容器可以写成mysql
DB_PORT=3306
DB_DATABASE=xboard
DB_USERNAME=xboard
DB_PASSWORD=root_password # 点击 1panel>数据库>Mysql 复制密码
REDIS_HOST=redis1 # 桥接模式连接容器可以写成redis
REDIS_PASSWORD=root_password # 点击 1panel>数据库>redis 连接信息 复制密码
REDIS_PORT=6378 # Redis1的端口需要修改
#默认将队列驱动和缓存驱动都修改为了redis请务必安装redis
BROADCAST_DRIVER=log
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME=null
MAILGUN_DOMAIN=
MAILGUN_SECRET=
# 用于阻止重复安装
INSTALLED=true
```
5.1panel>容器>编排修改Xboard默认的docker-compose.yaml
```
version: '3'
services:
xboard:
image: ghcr.io/cedar2025/xboard:latest
volumes:
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data/
# - ./config/v2board.php:/www/config/v2board.php
network_mode: 1panel-network
ports:
- 127.0.0.1:7001:7001
xboard1:
image: ghcr.io/cedar2025/xboard:latest
volumes:
- ./xboard1/.env:/www/.env
- ./xboard1/.docker/.data/:/www/.docker/.data/
# - ./config1/v2board.php:/www/config/v2board.php
network_mode: 1panel-network
ports:
- 127.0.0.1:7002:7001
networks:
persist:
external: true
```
改完重启应该有两个Xboard启动了。
6.在用openresty分别反代`127.0.0.1:7001` `127.0.0.1:7002` 两个站点。