# 部署文档
# 单机部署
- 请用 普通用户 来执行,禁止使用 root 来部署应用
- 确保 Nacos 已经正常运行,并配置好其相关的配置文件
位置 | 说明 |
---|---|
${HOME}/bin | 脚本位置,执行里面的脚本可以使应用启动、停止 |
${HOME}/conf | 配置目录,应用的配置文件,如nacos的连接参数 |
${HOME}/target | 应用位置,应用的运行包都是这里 |
${HOME}/logs | 日志位置,应用运行的日志都在这里 |
# 后台服务
#第一步:直接在父目录下打包(这样可以一次性将所有应用打包)
mvn clean package
#第二步:在roncoo-education/distribution二次打包(将所有需要发布的应用和脚本打包为一个压缩文件)
mvn clean package
#第三步:上传压缩文件到服务器,并解压
tar -zxvf xxx.tar.gz -C ${HOME}/
#第四步:运行bin里面的脚本即可启动应用
sh ${HOME}/bin/*.sh
# Web门户
#第一步:直接在父目录下安装依赖并打包
yarn (推荐使用yarn)
npm run build
#第二步:压缩打包上传,在roncoo-education-web/distribution下maven打包
mvn clean package
#第三步:上传压缩文件到服务器,并解压
tar -zxvf xxx.tar.gz -C ${HOME}/target/
#第四步,运行bin里面的脚本即可启动应用
sh ${HOME}/target/web/bin/web.sh
# H5门户
#第一步:直接在父目录下安装依赖并打包
yarn (推荐使用yarn)
npm run build
#第二步:上传打包后的目录到nginx,完成
将dist/build/h5目录上传到/opt/nginx/html/h5/
# Teacher讲师端
#第一步:直接在父目录下安装依赖并打包
yarn (推荐使用yarn)
npm run build
#第二步:上传打包后的目录到nginx,完成
将dist目录下的所有文件上传到/opt/nginx/html/teacher/
# Crm企业端
#第一步:直接在父目录下安装依赖并打包
yarn (推荐使用yarn)
npm run build
#第二步:上传打包后的目录到nginx,完成
将dist目录下的所有文件上传到/opt/nginx/html/crm/
# Admin管理端
#第一步:直接在父目录下安装依赖并打包
yarn (推荐使用yarn)
npm run build
#第二步:上传打包后的目录到nginx,完成
将dist目录下的所有文件上传到/opt/nginx/html/admin/
# Boss运营后台
#第一步:直接在父目录下安装依赖并打包
yarn (推荐使用yarn)
npm run build
#第二步:上传打包后的目录到nginx,完成
将dist目录下的所有文件上传到/opt/nginx/html/boss/
# 多机部署
- 共享目录可以利用 NFS 进行共享,也可以使用文件存储(如:阿里云的NAS)
- 将 /mnt 目录进行共享,把应用(包含后端的jar和前端的静态文件)放入到该目录,这样就能方便应用的发布和更新
- 部署方案请参考单机部署
# Docker部署
version: "3"
services:
mysql:
image: mysql:8.0.34
container_name: mysql
restart: always
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/my.cnf:/etc/my.cnf
- ./mysql/initdb.d:/docker-entrypoint-initdb.d
environment:
- TZ=Asia/Shanghai
- MYSQL_ROOT_PASSWORD=mysql^PASSWORD^1024
network_mode: host
mongo:
image: mongo:7.0
container_name: mongo
restart: always
volumes:
- ./mongo/data:/data/db
- ./mongo/logs:/var/log/mongodb
- ./mongo/initdb.d/:/docker-entrypoint-initdb.d/
environment:
- TZ=Asia/Shanghai
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=mongo^PASSWORD^1024
- wiredTigerCacheSizeGB=1.0
network_mode: host
redis:
image: redis:6
container_name: redis
restart: always
volumes:
- ./redis/data:/data
environment:
- TZ=Asia/Shanghai
command: ["redis-server","--appendonly", "yes", "--requirepass", "redis.1024"]
network_mode: host
elasticsearch:
image: elasticsearch:8.11.4
container_name: elasticsearch
privileged: true
restart: always
volumes:
- ./elasticsearch/data:/usr/share/elasticsearch/data
- ./elasticsearch/plugins:/usr/share/elasticsearch/plugins
environment:
- TZ=Asia/Shanghai
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- xpack.security.enabled=false
- discovery.type=single-node
network_mode: host
nacos:
image: nacos/nacos-server:v2.3.2
container_name: nacos
restart: always
environment:
- TZ=Asia/Shanghai
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
- MODE=standalone
- SPRING_DATASOURCE_PLATFORM=mysql
- MYSQL_SERVICE_HOST=localhost
- MYSQL_SERVICE_PORT=3306
- MYSQL_SERVICE_DB_NAME=edu_nacos
- MYSQL_SERVICE_USER=root
- MYSQL_SERVICE_PASSWORD=mysql^PASSWORD^1024
- TOMCAT_ACCESSLOG_ENABLED=false
- NACOS_AUTH_ENABLE=true
- NACOS_AUTH_IDENTITY_KEY=serverIdentity
- NACOS_AUTH_IDENTITY_VALUE=security
- NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789
network_mode: host
depends_on:
- mysql
seata:
image: seataio/seata-server:2.0.0
container_name: seata
restart: always
volumes:
- ./seata/logs:/root/logs
- ./seata/conf/application.yml:/seata-server/resources/application.yml
depends_on:
- nacos
- redis
network_mode: host
nginx:
image: nginx:1.21.3
container_name: nginx
restart: always
environment:
- TZ=Asia/Shanghai
volumes:
- ./nginx/logs:/var/log/nginx
- ./nginx/html:/etc/nginx/html
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf/conf.d:/etc/nginx/conf.d
- ./nginx/conf/shop.d:/etc/nginx/shop.d
network_mode: host
minio:
image: minio/minio
container_name: minio
restart: always
volumes:
- ./minio/data:/data
environment:
MINIO_ROOT_USER: admin
MINIO_ROOT_PASSWORD: minioadmin
command: ["server", "/data", "--console-address", ":9001"]
network_mode: host
job:
image: xuxueli/xxl-job-admin:2.4.0
container_name: job
restart: always
volumes:
- ./job/logs:/data/applogs
environment:
PARAMS: '--server.port=9910 --server.servlet.context-path=/job
--spring.datasource.url=jdbc:mysql://localhost:3306/edu_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
--spring.datasource.username=root
--spring.datasource.password=mysql^PASSWORD^1024
--xxl.job.accessToken=education-job'
network_mode: host