系统:win11
wsl版本:wsl2
Linux:Ubuntu 22.04.4 LTS
文档:https://barragefly.ordinaryroad.tech/deploy/#_2-1-docker-compose
docker相关的内容自己事先安装好
git clone https://github.com/OrdinaryRoad-Project/ordinaryroad-barrage-fly.git
cd ordinaryroad-barrage-fly/.docker/
cp compose-with-mysql-nginx.yaml docker-compose.yml
mv compose.yaml compose.yaml.bak
# DOCKER_OPTS="--registry-mirror=https://mirror.ccs.tencentyun.com"
# 拉取最新版1.2.0
docker pull ordinaryroad-docker.pkg.coding.net/ordinaryroad-barrage-fly/docker-pub/ordinaryroad-barrage-fly:1.2.0
# docker pull ordinaryroad-docker.pkg.coding.net/ordinaryroad-barrage-fly/docker-pub/ordinaryroad-barrage-fly-arm64:1.2.0
docker pull ordinaryroad-docker.pkg.coding.net/ordinaryroad-barrage-fly/docker-pub/ordinaryroad-barrage-fly-ui:1.2.0
docker tag ordinaryroad-docker.pkg.coding.net/ordinaryroad-barrage-fly/docker-pub/ordinaryroad-barrage-fly:1.2.0 ordinaryroad-barrage-fly
# docker tag ordinaryroad-docker.pkg.coding.net/ordinaryroad-barrage-fly/docker-pub/ordinaryroad-barrage-fly-arm64:1.2.0 ordinaryroad-barrage-fly-arm64
docker tag ordinaryroad-docker.pkg.coding.net/ordinaryroad-barrage-fly/docker-pub/ordinaryroad-barrage-fly-ui:1.2.0 ordinaryroad-barrage-fly-ui
vim .env
填入以下内容
# .env
# TODO 根据实际部署情况修改
MYSQL_HOST=192.168.1.2
MYSQL_PORT=3306
MYSQL_DATABASE=or_barrage_fly
MYSQL_USERNAME=root
MYSQL_PASSWORD=root
MYSQL_ROOT_PASSWORD=123456
# TODO 根据实际部署情况修改
SUB_BASE_URL=ws://localhost:9898
# TODO 管理后台的账号密码
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin
# TODO 根据实际需要修改
JAVA_OPTS="-Xmn256m"
vim docker-compose.yml
填入以下内容
# 需要的环境变量,其他可以环境变量可看每个目录下的.env文件
# MYSQL_ROOT_PASSWORD(MySQL初始ROOT密码)
# ADMIN_USERNAME(任务管理后台登录用户名,默认admin)
# ADMIN_PASSWORD(任务管理后台登录密码,默认admin)
# SPRING_BOOT_ADMIN_BASE_URL(根据后端部署情况设置Spring Boot Admin的地址)
# SUB_BASE_URL(根据后端部署情况设置Client要连接的WebSocket地址)
version: "3.0"
services:
ordinaryroad-barrage-fly-mysql:
image: ordinaryroad-barrage-fly-mysql
container_name: ordinaryroad-barrage-fly-mysql
build:
context: ./ordinaryroad-barrage-fly-mysql
volumes:
- $PWD/ordinaryroad-barrage-fly-mysql/etc/my.cnf:/etc/my.cnf
- $PWD/ordinaryroad-barrage-fly-mysql/data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD:
ports:
- "33066:3306"
hostname: ordinaryroad-barrage-fly-mysql
restart: always
ordinaryroad-barrage-fly-ui:
image: ordinaryroad-barrage-fly-ui
container_name: ordinaryroad-barrage-fly-ui
environment:
BASE_URL: http://ordinaryroad-barrage-fly:8080
SPRING_BOOT_ADMIN_BASE_URL: http://localhost:8080/admin
SUB_BASE_URL:
hostname: ordinaryroad-barrage-fly-ui
restart: always
ordinaryroad-barrage-fly:
image: ordinaryroad-barrage-fly
container_name: ordinaryroad-barrage-fly
environment:
MYSQL_USERNAME: root
MYSQL_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ADMIN_BASE_URL:
ADMIN_USERNAME:
ADMIN_PASSWORD:
hostname: ordinaryroad-barrage-fly
restart: always
ordinaryroad-barrage-fly-nginx:
image: ordinaryroad-barrage-fly-nginx
container_name: ordinaryroad-barrage-fly-nginx
build:
context: ./ordinaryroad-barrage-fly-nginx
ports:
# UI
- "81:81"
# Admin
- "8080:8080"
# 后端
- "8081:8081"
# RSocket
- "9898:9898"
hostname: ordinaryroad-barrage-fly-nginx
depends_on:
- ordinaryroad-barrage-fly
- ordinaryroad-barrage-fly-ui
restart: always
若bulid失败,设置cl代理后 走代理则设置
build:
context: ./ordinaryroad-barrage-fly-mysql
args:
- http_proxy=http://127.0.0.1:7890
- https_proxy=http://127.0.0.1:7890
使用mysql、nginx时需要先build(若出现mysql无法连接的问题,参考issue#40)
docker-compose build ordinaryroad-barrage-fly-mysql
docker-compose build ordinaryroad-barrage-fly-nginx
启动
docker-compose up
根据nginx映射,访问对应服务
# UI
- "81:81"
# Admin
- "8080:8080"
# 后端
- "8081:8081"
# RSocket
- "9898:9898"
浏览器访问:http://127.0.0.1:81/,登录账号密码 默认 admin admin (环境变量里设置的)