install-guides.txt 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. 一、通过Multipass创建虚拟机
  2. 1.创建虚拟机
  3. multipass launch -n ubuntu -d 20G -m 4G -c 4 18.04
  4. 2.挂载文件
  5. multipass mount ~/Projects/baas ubuntu:/home/ubuntu/baas
  6. 3.调整磁盘空间(可选)
  7. sudo /Applications/Docker.app/Contents/MacOS/qcow-tool resize --size=$(( 12 * 1024 * 1024 * 1024 )) "/var/root/Library/Application Support/multipassd/vault/instances/suited-emu/ubuntu-20.04-server-cloudimg-amd64.img"
  8. 二、安装Master
  9. 1.安装docker docker-compose make nfs-common
  10. sudo apt update && sudo apt upgrade -y && sudo apt install -y make nfs-common
  11. reboot
  12. 2.配置master
  13. make setup-master && newgrp docker
  14. 3.拷贝master镜像,make文件
  15. docker load -i master.tar
  16. 4.配置SSO
  17. 5.启动master
  18. make start
  19. 三、安装Worker
  20. 1.安装docker docker-compose make nfs-common
  21. sudo apt update && sudo apt upgrade -y && sudo apt install -y make nfs-common
  22. reboot
  23. 2.配置worker
  24. make setup-worker && newgrp docker
  25. 3.拷贝worker镜像,make文件
  26. docker load -i worker.tar
  27. 4.配置docker daemon
  28. (其它方式)*docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 0.0.0.0:2375:2375 bobrik/socat TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
  29. Edit systemd service config file `/lib/systemd/system/docker.service`, update the `ExecStart` line under section `[Service]`, as the following:
  30. [Service]
  31. ExecStart=/usr/bin/dockerd -H fd:// -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375 --default-ulimit=nofile=8192:16384 --default-ulimit=nproc=8192:16384
  32. Regenerate the docker service script and restart the docker engine:
  33. sudo systemctl daemon-reload && sudo systemctl restart docker.service
  34. At last, run the follow test at Master node and get OK response, to make sure it can access the Worker node successfully.
  35. [Master] $ docker -H Worker_Node_IP:2375 info
  36. 5.check iptables
  37. 四、生产环境配置
  38. ## `/etc/sysctl.conf`
  39. ```bash
  40. # Don't ask why, this is a solid answer.
  41. vm.swappiness=10
  42. fs.file-max = 2000000
  43. kernel.threads-max = 2091845
  44. kernel.pty.max = 210000
  45. kernel.keys.root_maxkeys = 20000
  46. kernel.keys.maxkeys = 20000
  47. net.ipv4.ip_local_port_range = 30000 65535
  48. net.ipv4.tcp_tw_reuse = 0
  49. net.ipv4.tcp_max_tw_buckets = 5000
  50. net.ipv4.tcp_fin_timeout = 30
  51. net.ipv4.tcp_max_syn_backlog = 8192
  52. ```
  53. Then, need to run `sysctl -p` for enabling.
  54. ## `/etc/security/limits.conf`
  55. ```bash
  56. * hard nofile 1048576
  57. * soft nofile 1048576
  58. * soft nproc 10485760
  59. * hard nproc 10485760
  60. * soft stack 32768
  61. * hard stack 32768
  62. ```
  63. ## Other Configurations
  64. * Use the code from `release` branch.
  65. * Configuration: Set all parameters to production, including image, compose, and application.
  66. * Security: Use firewall to filter traffic, enable TLS and authentication.
  67. * Backup: Enable automatic data backup.
  68. * Monitoring: Enable monitoring services.out and login, then check with `ulimit -n`.
  69. 五、make文件
  70. docker-compose.yml
  71. env.tmpl
  72. Makefile
  73. scripts文件夹
  74. .makerc文件夹
  75. src/agent/docker/_compose_files文件夹
  76. 六、docker镜像
  77. master: docker save hyperledger/cello-user-dashboard:latest hyperledger/cello-operator-dashboard:latest itsthenetwork/nfs-server-alpine:9 mongo:3.4.10 -o docker-images/master.tar
  78. worker: docker save couchdb:2.3.1 hyperledger/fabric-orderer:1.4 hyperledger/fabric-peer:1.4 hyperledger/fabric-ccenv:1.4 hyperledger/fabric-ca:1.4 hyperledger/fabric-baseimage:amd64-0.4.22 -o docker-images/worker.tar