快速部署

获取源代码后可通过以下两种方式部署程序。

docker方式

  1. 安装docker

  2. 使用maven命令将项目打包
    在代码根目录执行:

  1. mvn clean package -Dmaven.test.skip=true

3.使用docker构建镜像

注意

请自行准备docker镜像仓库,此处以registry.cn-shenzhen.aliyuncs.com阿里云私有仓库为例。

  1. cd ./jetlinks-standalone
  2. docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone
  3. docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone

4.拉取镜像
在需要部署的服务器上拉取构建成功的镜像。

  1. docker pull registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone

5.创建docker-compose文件

  1. version: '2'
  2. services:
  3. redis:
  4. image: redis:5.0.4
  5. container_name: jetlinks-redis
  6. ports:
  7. - "6379:6379"
  8. volumes:
  9. - "./data/redis:/data"
  10. command: redis-server --appendonly yes
  11. environment:
  12. - TZ=Asia/Shanghai
  13. elasticsearch:
  14. image: elasticsearch:6.7.2
  15. container_name: jetlinks-elasticsearch
  16. environment:
  17. ES_JAVA_OPTS: -Djava.net.preferIPv4Stack=true -Xms1g -Xmx1g
  18. transport.host: 0.0.0.0
  19. discovery.type: single-node
  20. bootstrap.memory_lock: "true"
  21. discovery.zen.minimum_master_nodes: 1
  22. discovery.zen.ping.unicast.hosts: elasticsearch
  23. # volumes:
  24. # - ./data/elasticsearch:/usr/share/elasticsearch/data
  25. ports:
  26. - "9200:9200"
  27. - "9300:9300"
  28. kibana:
  29. image: kibana:6.7.2
  30. container_name: jetlinks-kibana
  31. environment:
  32. ELASTICSEARCH_URL: http://elasticsearch:9200
  33. links:
  34. - elasticsearch:elasticsearch
  35. ports:
  36. - "5601:5601"
  37. depends_on:
  38. - elasticsearch
  39. postgres:
  40. image: postgres:11-alpine
  41. container_name: jetlinks-postgres
  42. ports:
  43. - "5432:5432"
  44. volumes:
  45. - "./data/postgres:/var/lib/postgresql/data"
  46. environment:
  47. POSTGRES_PASSWORD: jetlinks
  48. POSTGRES_DB: jetlinks
  49. TZ: Asia/Shanghai
  50. rabbitmq:
  51. image: rabbitmq:management-alpine
  52. container_name: rabbitmq
  53. environment:
  54. - RABBITMQ_DEFAULT_USER=admin
  55. - RABBITMQ_DEFAULT_PASS=jetlinks
  56. - RABBITMQ_ERLANG_COOKIE=jetlinks
  57. ports:
  58. - "15672:15672"
  59. - "5672:5672"
  60. jetlinks:
  61. image: registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone
  62. container_name: jetlinks-pro
  63. environment:
  64. - server.port=8848 #端口可自行配置
  65. - spring.redis.host=redis
  66. - spring.r2dbc.url=r2dbc:postgresql://postgres:5432/jetlinks
  67. - management.metrics.export.elastic.host=http://elasticsearch:9200
  68. - elasticsearch.client.host=elasticsearch
  69. links:
  70. - redis
  71. - postgres
  72. - elasticsearch
  73. - rabbitmq
  74. ports:
  75. - "8848:8848"

6.运行docker-compose文件

  1. docker-compose up -d

jar包方式

1.使用maven命令将项目打包
在代码根目录执行:

  1. mvn clean package -Dmaven.test.skip=true

2.将jar包上传到需要部署的服务器上。

3.使用java命令运行jar包

  1. java -jar jetlinks-standalone.jar

前端部署

1.获取源代码

  1. git clone https://github.com/jetlinks/jetlinks-ui-antd.git

2.使用npm打包

  1. npm install
  2. npm run-script build

3.构建docker镜像

  1. docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-antd:1.0-SNAPSHOT

4.运行docker镜像

  1. docker run -it --rm -p 9000:80 -e "API_BASE_PATH=http://xxx:8848/" registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-antd:1.0-SNAPSHOT

注意

环境变量API_BASE_PATH为后台API根地址. 由docker容器内进行自动代理. 请根据自己的系统环境配置环境变量: API_BASE_PATH

前端环境要求

  • nodeJs v12.14
  • npm v6.13