ASCII码 ASCII码

Centos7 使用Docker安装rocket.chat聊天工具

发布于:2022-03-15 09:31:56  栏目:技术文档

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

下载安装

Rocket.Chat 目前最新的版本为 4.0.1,可以通过手动或者容器的方式安装。这里我推荐使用容器,部署过程会方便不少。

如果要用容器的方式部署,需要先安装 docker 和 docker-compose,再下载编排文件:

安装docker脚本

  1. #!/bin/sh
  2. #
  3. #
  4. setenforce 0
  5. sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
  6. systemctl stop firewalld && systemctl disable firewalld
  7. swapoff -a && echo "swapoff -a" >> /etc/rc.local && chmod +x /etc/rc.local
  8. yum install -y wget vim lrzsz telnet net-tools
  9. yum install -y yum-utils device-mapper-persistent-data lvm2
  10. yum install -y https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/docker-ce-18.06.3.ce-3.el7.x86_64.rpm
  11. mkdir -p /etc/docker
  12. cat > /etc/docker/daemon.json <<EOF
  13. {
  14. "registry-mirrors": ["https://q2uvt0x7.mirror.aliyuncs.com"],
  15. "exec-opts": ["native.cgroupdriver=cgroupfs"],
  16. "data-root": "/data/docker",
  17. "storage-driver": "overlay2",
  18. "storage-opts":["overlay2.override_kernel_check=true"],
  19. "log-driver": "json-file",
  20. "log-opts": {
  21. "max-size": "100m",
  22. "max-file": "10"
  23. }
  24. }
  25. EOF
  26. systemctl enable docker && systemctl daemon-reload && systemctl start docker
  27. echo "* soft nofile 655360" >> /etc/security/limits.conf
  28. echo "* hard nofile 655360" >> /etc/security/limits.conf
  29. echo "* soft nproc 655360" >> /etc/security/limits.conf
  30. echo "* hard nproc 655360" >> /etc/security/limits.conf
  31. echo "* soft memlock unlimited" >> /etc/security/limits.conf
  32. echo "* hard memlock unlimited" >> /etc/security/limits.conf
  33. echo "DefaultLimitNOFILE=1024000" >> /etc/systemd/system.conf
  34. echo "DefaultLimitNPROC=1024000" >> /etc/systemd/system.conf
  35. ulimit -Hn
  36. yum -y install chrony
  37. systemctl enable chronyd.service && systemctl start chronyd.service && systemctl status chronyd.service
  38. chronyc sources

安装docker-compose

  1. yum install epel-release -y
  2. yum install docker-compose -y
  1. # 创建并进入工作目录
  2. mkdir /opt/rocketchat
  3. cd /opt/rocketchat
  4. # 下载编排文件
  5. curl -L https://raw.githubusercontent.com/RocketChat/Rocket.Chat/develop/docker-compose.yml -o docker-compose.yml

若下载失败,可使用下面文件

  1. version: '2'
  2. services:
  3. rocketchat:
  4. image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/rocket.chat:latest
  5. command: >
  6. bash -c
  7. "for i in `seq 1 30`; do
  8. node main.js &&
  9. s=$$? && break || s=$$?;
  10. echo \"Tried $$i times. Waiting 5 secs...\";
  11. sleep 5;
  12. done; (exit $$s)"
  13. restart: unless-stopped
  14. volumes:
  15. - ./uploads:/app/uploads
  16. environment:
  17. - PORT=3000
  18. - ROOT_URL=http://localhost:3000
  19. - MONGO_URL=mongodb://mongo:27017/rocketchat
  20. - MONGO_OPLOG_URL=mongodb://mongo:27017/local
  21. - REG_TOKEN=${REG_TOKEN}
  22. # - MAIL_URL=smtp://smtp.email
  23. # - HTTP_PROXY=http://proxy.domain.com
  24. # - HTTPS_PROXY=http://proxy.domain.com
  25. depends_on:
  26. - mongo
  27. ports:
  28. - 3000:3000
  29. labels:
  30. - "traefik.backend=rocketchat"
  31. - "traefik.frontend.rule=Host: your.domain.tld"
  32. mongo:
  33. image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/mongo:4.0
  34. restart: unless-stopped
  35. volumes:
  36. - ./data/db:/data/db
  37. #- ./data/dump:/dump
  38. command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
  39. labels:
  40. - "traefik.enable=false"
  41. # this container's job is just run the command to initialize the replica set.
  42. # it will run the command and remove himself (it will not stay running)
  43. mongo-init-replica:
  44. image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/mongo:4.0
  45. command: >
  46. bash -c
  47. "for i in `seq 1 30`; do
  48. mongo mongo/rocketchat --eval \"
  49. rs.initiate({
  50. _id: 'rs0',
  51. members: [ { _id: 0, host: 'localhost:27017' } ]})\" &&
  52. s=$$? && break || s=$$?;
  53. echo \"Tried $$i times. Waiting 5 secs...\";
  54. sleep 5;
  55. done; (exit $$s)"
  56. depends_on:
  57. - mongo
  58. #traefik:
  59. # image: traefik:latest
  60. # restart: unless-stopped
  61. # command: >
  62. # traefik
  63. # --docker
  64. # --acme=true
  65. # --acme.domains='your.domain.tld'
  66. # --acme.email='your@email.tld'
  67. # --acme.entrypoint=https
  68. # --acme.storagefile=acme.json
  69. # --defaultentrypoints=http
  70. # --defaultentrypoints=https
  71. # --entryPoints='Name:http Address::80 Redirect.EntryPoint:https'
  72. # --entryPoints='Name:https Address::443 TLS.Certificates:'
  73. # ports:
  74. # - 80:80
  75. # - 443:443
  76. # volumes:
  77. # - /var/run/docker.sock:/var/run/docker.sock

根据自己的需求来修改编排文件,修改完成后,运行以下命令启动服务:

  1. docker-compose up -d

服务启动后,在浏览器中输入 http://{ip}:3000进行访问。

使用说明

第一次使用 Rocket.Chat 时,一些可能会不太习惯。不过不用担心,Rocket.Chat 用起来还是比较简单的。接下来,我会向大家演示 Rocket.Chat 的基本用法。

安装向导

我们第一次访问 Rocket.Chat 时,会被引导到安装向导,根据页面的提示来配置就好。

本文转自:https://www.cnblogs.com/jerry-0910/p/15993462.html

相关推荐
阅读 +