应用部署
- 添加国内docker/epel 的yum源,并生成缓存:
# vim /etc/yum.repos.d/docker.repo [docker-ce-stable] name=Docker CE Stable - mirrors.huaweicloud.com/docker-ce/linux/centos/7/x86_64/stable/ enabled=1 gpgcheck=0 gpgkey=https://download.docker.com/linux/centos/gpg # vim /etc/yum.repos.d/epel.repo [epel] name=Extra Packages for Enterprise Linux 7 - $basearch enabled=1 failovermethod=priority baseurl=https://mirrors.huaweicloud.com/epel/7/$basearch gpgcheck=0 gpgkey=https://mirrors.huaweicloud.com/epel/RPM-GPG-KEY-EPEL-7 # yum makecache
关闭selinux和firewalld
# vim /etc/selinux/config
图1 图示1 - 重启服务器使配置生效:
# reboot # systemctl stop firewalld && systemctl disable firewalld
- 数管后端部署:
部署目录:/data/data-manage
# vim docker-compose.yml version: '3' services: data-manage: restart: always image: "har.gagogroup.cn/sz-zhihuinongye/data-manage-server:v3.6.0-186" ports: - "7777:7777" container_name: data-manage environment: DB_HOST: 192.168.10.155 DB_PORT: 5432 DB_NAME: XX DB_USER: postgres DB_PASSWORD: YOUR_DB_PASSWORD TOKEN_GEN_CODE: abc ENV: pro EXTERNAL_TOKEN: YOUR_TOKEN REDIS_HOST: 192.168.10.155 REDIS_PORT: 6379 REDIS_PASSWORD: YOUR_REDIS_PASSWORD
启动:
# docker-compose up -d
停止:
# docker-compose down
查看日志:
# docker-compose logs -ft --tail 100
- 数管web前端部署:
部署目录:/data/web/data-manage-web/docker-compose.yml
# vim docker-compose.yml version: "3" services: data-manage-web: restart: always container_name: data-manage-web image: har.gagogroup.cn/sz-zhihuinongye/data-manage-web/generated_branch:40 ports: - "18080:80"
启动:
# docker-compose up -d
停止:
# docker-compose down
查看日志:
# docker-compose logs -ft --tail 100
- web前端部署
部署目录:/data/web/web/docker-compose.yml
# vim docker-compose.yml version: "3" services: web: restart: always container_name: web image: har.gagogroup.cn/yanxuan/yanxuan-web/master:20 ports: - "18081:80"
启动:
# docker-compose up -d
停止:
# docker-compose down
查看日志:
# docker-compose logs -ft --tail 100
- 添加前端nginx配置文件
# vim /etc/nginx/conf.d/data-manage.conf upstream data-manage { server 127.0.0.1:30080; } upstream data-manage-api { server 127.0.0.1:3000; } server { listen 80; server_name *.com; access_log /var/log/nginx/data-manage.log main; client_max_body_size 50m; location /api { root html; client_max_body_size 1000m; index index.html index.htm; proxy_pass http://data-manage-api; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Connection ""; proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600; proxy_redirect default; proxy_buffering off; } location / { root html; client_max_body_size 1000m; index index.html index.htm; proxy_http_version 1.1; proxy_pass http://data-manage; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Connection ""; proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600; proxy_redirect default; proxy_buffering off; } } # nginx -t # nginx -s reload
- 系统加载
应用部署完成后,访问部署链接https://yanxuan.gagogroup.cn,打开系统并加载资源。
图2 图示1图3 图示2