Update 多开Xboard教程.md

This commit is contained in:
rebecca554owen 2023-11-22 19:32:26 +08:00 committed by GitHub
parent bb7b9ee591
commit aa3a1bebc8

View File

@ -1,128 +1,50 @@
**本篇教程默认你已经安装了1panel并部署单个Xboard容器运行成功。**
1.在/opt/1panel/apps/redis/redis目录新建一个redis1文件夹并复制data、conf、logs进去。
2.在1panel>容器>编排修改Redis默认的docker-compose.yaml
1.在1panel >文件,复制 Xboard 文件夹,重命名为 Xbaord-1 ,并修改`.env`文件。
```
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_HOST=mysql
DB_PORT=3306
DB_DATABASE=xboard
DB_USERNAME=xboard
DB_PASSWORD=root_password # 点击 1panel>数据库>Mysql 复制密码
DB_DATABASE=xboard1 # 新数据库
DB_USERNAME=xboard1 # 账号密码
DB_PASSWORD=root_password
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
REDIS_HOST=/run/redis-socket/redis.sock # 内置Redis不用变
REDIS_PASSWORD=null
REDIS_PORT=0
#省略
```
5.1panel>容器>编排修改Xboard默认的docker-compose.yaml
2.1panel>文件,修改 Xboard-1 默认的docker-compose.yaml
```
version: '3'
services:
xboard:
xboard-1:
image: ghcr.io/cedar2025/xboard:latest
volumes:
- ./.env:/www/.env
- ./.docker/.data/:/www/.docker/.data/
# - ./config/v2board.php:/www/config/v2board.php
- redis-socket:/run/redis-socket # 挂载socket
environment:
- docker=true #用于给安装脚本判断是否为docker环境
depends_on:
- redis-1
network_mode: 1panel-network
ports:
- 127.0.0.1:7001:7001
xboard1:
image: ghcr.io/cedar2025/xboard:latest
- 127.0.0.1:7002:7001 #端口不要跟原来的冲突
redis-1:
build:
context: .docker/services/redis
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
- ./.docker/.data/redis:/data/ # 挂载redis持久化数据
- redis-socket:/run/redis-socket # 挂载socket
```
启动 Xboard-1
```
docker compose up -d
```
改完重启应该有两个Xboard启动了。
6.在用openresty分别反代`127.0.0.1:7001` `127.0.0.1:7002` 两个站点。
3.在1panel>网站用openresty分别反代`127.0.0.1:7001` `127.0.0.1:7002` 两个站点。