JPAAS采用Docker在线部署

前提

需要安装docker, docker-compose,推荐服务器系统为Centos7.6 64位以上.

部署步骤

1.基础软件结构

系统环境变量,可以配置不同镜像采用不通的版本,镜像仓库可以自己搭建,本地将代码编译镜像并推送到镜像服务器。

基础软件镜像目录

2.上传前端代码编译文件

示例如下:

3.创建docker-compose.yml文件

示例如下:

  1. version: '3'
  2. services:
  3. mysql:
  4. restart: always
  5. image: mysql:8
  6. container_name: mysql8
  7. ports:
  8. - 3306:3306
  9. command:
  10. --default-authentication-plugin=mysql_native_password
  11. --character-set-server=utf8mb4
  12. --collation-server=utf8mb4_general_ci
  13. --explicit_defaults_for_timestamp=true
  14. --lower_case_table_names=1
  15. --default-time-zone=+8:00
  16. environment:
  17. MYSQL_ROOT_PASSWORD: "root"
  18. volumes:
  19. - ./mysql/db:/var/lib/mysql
  20. - ./mysql/conf/my.cnf:/etc/my.cnf
  21. - ./mysql/init:/docker-entrypoint-initdb.d/
  22. - ./mysql/sql:/opt/sql
  23. networks:
  24. jpaas_net:
  25. ipv4_address: 172.30.0.3
  26. redis:
  27. image: redis:5.0.8-alpine
  28. hostname: "jpaas-redis"
  29. environment:
  30. - TZ=Asia/Shanghai
  31. ports:
  32. - 3379:6379
  33. volumes:
  34. - ./redis/data:/data
  35. command: "redis-server --appendonly yes"
  36. privileged: true
  37. restart: always
  38. tty: true # 这里可以加
  39. networks:
  40. jpaas_net:
  41. ipv4_address: 172.30.0.4
  42. nacos:
  43. image: nacos/nacos-server:1.3.2 # 镜像`nacos/nacos-server:latest`
  44. container_name: nacos_server # 容器名为'nacos_server'
  45. restart: always # 指定容器退出后的重启策略为始终重启
  46. volumes: # 数据卷挂载路径设置,将本机目录映射到容器目录
  47. - ./nacos/logs/:/home/nacos/logs
  48. - ./nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
  49. environment:
  50. # 设置环境变量,相当于docker run命令中的-e
  51. PREFER_HOST_MODE: hostname
  52. MODE: standalone # 单机模式启动
  53. SPRING_DATASOURCE_PLATFORM: mysql
  54. MYSQL_SERVICE_HOST: 172.30.0.3 #172.18.0.2 # 注:这里不能为`127.0.0.1`或`localhost`方式!!!
  55. MYSQL_SERVICE_DB_NAME: nacos_config # 所需sql脚本位于 `nacos-mysql/nacos-mysql.sql`
  56. MYSQL_SERVICE_PORT: 3306
  57. MYSQL_SERVICE_USER: root
  58. MYSQL_SERVICE_PASSWORD: root
  59. JVM_XMS: 512m
  60. JVM_MMS: 320m
  61. ports: # 映射端口
  62. - 8848:8848
  63. depends_on:
  64. - mysql
  65. networks:
  66. jpaas_net:
  67. ipv4_address: 172.30.0.48
  68. seata:
  69. image: seataio/seata-server
  70. hostname: "seata-server"
  71. ports:
  72. - 8091:8091
  73. depends_on:
  74. - nacos
  75. environment:
  76. - SEATA_CONFIG_NAME=file:/root/seata-config/registry
  77. - SEATA_PORT=8091
  78. - STORE_MODE=file
  79. #- SEATA_IP=192.168.0.200
  80. - TZ=Asia/Shanghai
  81. volumes:
  82. - ./seata/conf:/root/seata-config
  83. - ./seata/logs:/root/logs
  84. - /etc/localtime:/etc/localtime
  85. networks:
  86. jpaas_net:
  87. ipv4_address: 172.30.0.68
  88. nginx:
  89. image: nginx:stable-alpine-perl
  90. hostname: "web-nginx"
  91. environment:
  92. - TZ=Asia/Shanghai
  93. ports:
  94. - 8080:8080
  95. volumes:
  96. - ./nginx/web/html:/usr/share/nginx/html
  97. - ./nginx/web/nginx.conf:/etc/nginx/nginx.conf
  98. privileged: true
  99. restart: always
  100. networks:
  101. - jpaas_net
  102. gateway:
  103. image: "${REGISTER}/sc-gateway:${BASE_TAG}"
  104. environment:
  105. - TZ=Asia/Shanghai
  106. privileged: true
  107. restart: always
  108. depends_on:
  109. - seata
  110. - mysql
  111. - nacos
  112. - redis
  113. networks:
  114. jpaas_net:
  115. ipv4_address: 172.30.0.81
  116. auth:
  117. image: "${REGISTER}/jpaas-auth:${BASE_TAG}"
  118. environment:
  119. - TZ=Asia/Shanghai
  120. privileged: true
  121. restart: always
  122. depends_on:
  123. - mysql
  124. - nacos
  125. - redis
  126. - seata
  127. networks:
  128. jpaas_net:
  129. ipv4_address: 172.30.0.91
  130. user:
  131. image: "${REGISTER}/jpaas-user:${BUSINESS_TAG}"
  132. environment:
  133. - TZ=Asia/Shanghai
  134. privileged: true
  135. restart: always
  136. depends_on:
  137. - mysql
  138. - nacos
  139. - redis
  140. - seata
  141. networks:
  142. - jpaas_net
  143. system:
  144. image: "${REGISTER}/jpaas-system:${BUSINESS_TAG}"
  145. environment:
  146. - TZ=Asia/Shanghai
  147. privileged: true
  148. restart: always
  149. depends_on:
  150. - mysql
  151. - nacos
  152. - redis
  153. - seata
  154. networks:
  155. - jpaas_net
  156. bpm:
  157. image: "${REGISTER}/jpaas-bpm:${BASE_TAG}"
  158. environment:
  159. - TZ=Asia/Shanghai
  160. privileged: true
  161. restart: always
  162. depends_on:
  163. - mysql
  164. - nacos
  165. - redis
  166. - seata
  167. networks:
  168. - jpaas_net
  169. form:
  170. image: "${REGISTER}/jpaas-form:${BASE_TAG}"
  171. environment:
  172. - TZ=Asia/Shanghai
  173. privileged: true
  174. restart: always
  175. depends_on:
  176. - mysql
  177. - nacos
  178. - redis
  179. - seata
  180. networks:
  181. - jpaas_net
  182. portal:
  183. image: "${REGISTER}/jpaas-portal:${BUSINESS_TAG}"
  184. environment:
  185. - TZ=Asia/Shanghai
  186. privileged: true
  187. restart: always
  188. depends_on:
  189. - mysql
  190. - nacos
  191. - redis
  192. - seata
  193. networks:
  194. - jpaas_net
  195. job:
  196. image: "${REGISTER}/job-admin:${BUSINESS_TAG}"
  197. environment:
  198. - TZ=Asia/Shanghai
  199. privileged: true
  200. restart: always
  201. ports:
  202. - 7878:7878
  203. depends_on:
  204. - mysql
  205. - nacos
  206. - redis
  207. networks:
  208. jpaas_net
  209. ipv4_address: 172.30.0.78
  210. networks:
  211. jpaas_net:
  212. driver: bridge
  213. ipam:
  214. config:
  215. - subnet: 172.30.0.0/16
4.运行基础软件容器
  1. docker-compose up -d mysql redis nacos seata-server nginx
5.运行JPAAS容器
  1. docker-compose up -d
文档更新时间: 2020-11-30 15:59   作者:yulei