镜像下载、域名解析、时间同步请点击阿里云开源镜像站
Rocket.Chat 目前最新的版本为 4.0.1,可以通过手动或者容器的方式安装。这里我推荐使用容器,部署过程会方便不少。
如果要用容器的方式部署,需要先安装 docker 和 docker-compose,再下载编排文件:
安装docker脚本
#!/bin/sh
#
#
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
systemctl stop firewalld && systemctl disable firewalld
swapoff -a && echo "swapoff -a" >> /etc/rc.local && chmod +x /etc/rc.local
yum install -y wget vim lrzsz telnet net-tools
yum install -y yum-utils device-mapper-persistent-data lvm2
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
mkdir -p /etc/docker
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://q2uvt0x7.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=cgroupfs"],
"data-root": "/data/docker",
"storage-driver": "overlay2",
"storage-opts":["overlay2.override_kernel_check=true"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "10"
}
}
EOF
systemctl enable docker && systemctl daemon-reload && systemctl start docker
echo "* soft nofile 655360" >> /etc/security/limits.conf
echo "* hard nofile 655360" >> /etc/security/limits.conf
echo "* soft nproc 655360" >> /etc/security/limits.conf
echo "* hard nproc 655360" >> /etc/security/limits.conf
echo "* soft memlock unlimited" >> /etc/security/limits.conf
echo "* hard memlock unlimited" >> /etc/security/limits.conf
echo "DefaultLimitNOFILE=1024000" >> /etc/systemd/system.conf
echo "DefaultLimitNPROC=1024000" >> /etc/systemd/system.conf
ulimit -Hn
yum -y install chrony
systemctl enable chronyd.service && systemctl start chronyd.service && systemctl status chronyd.service
chronyc sources
安装docker-compose
yum install epel-release -y
yum install docker-compose -y
# 创建并进入工作目录
mkdir /opt/rocketchat
cd /opt/rocketchat
# 下载编排文件
curl -L https://raw.githubusercontent.com/RocketChat/Rocket.Chat/develop/docker-compose.yml -o docker-compose.yml
version: '2'
services:
rocketchat:
image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/rocket.chat:latest
command: >
bash -c
"for i in `seq 1 30`; do
node main.js &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
restart: unless-stopped
volumes:
- ./uploads:/app/uploads
environment:
- PORT=3000
- ROOT_URL=http://localhost:3000
- MONGO_URL=mongodb://mongo:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo:27017/local
- REG_TOKEN=${REG_TOKEN}
# - MAIL_URL=smtp://smtp.email
# - HTTP_PROXY=http://proxy.domain.com
# - HTTPS_PROXY=http://proxy.domain.com
depends_on:
- mongo
ports:
- 3000:3000
labels:
- "traefik.backend=rocketchat"
- "traefik.frontend.rule=Host: your.domain.tld"
mongo:
image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/mongo:4.0
restart: unless-stopped
volumes:
- ./data/db:/data/db
#- ./data/dump:/dump
command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
labels:
- "traefik.enable=false"
# this container's job is just run the command to initialize the replica set.
# it will run the command and remove himself (it will not stay running)
mongo-init-replica:
image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/mongo:4.0
command: >
bash -c
"for i in `seq 1 30`; do
mongo mongo/rocketchat --eval \"
rs.initiate({
_id: 'rs0',
members: [ { _id: 0, host: 'localhost:27017' } ]})\" &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
depends_on:
- mongo
#traefik:
# image: traefik:latest
# restart: unless-stopped
# command: >
# traefik
# --docker
# --acme=true
# --acme.domains='your.domain.tld'
# --acme.email='your@email.tld'
# --acme.entrypoint=https
# --acme.storagefile=acme.json
# --defaultentrypoints=http
# --defaultentrypoints=https
# --entryPoints='Name:http Address::80 Redirect.EntryPoint:https'
# --entryPoints='Name:https Address::443 TLS.Certificates:'
# ports:
# - 80:80
# - 443:443
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock
根据自己的需求来修改编排文件,修改完成后,运行以下命令启动服务:
docker-compose up -d
服务启动后,在浏览器中输入 http://{ip}:3000
进行访问。
第一次使用 Rocket.Chat 时,一些可能会不太习惯。不过不用担心,Rocket.Chat 用起来还是比较简单的。接下来,我会向大家演示 Rocket.Chat 的基本用法。
安装向导
我们第一次访问 Rocket.Chat 时,会被引导到安装向导,根据页面的提示来配置就好。
手机扫一扫
移动阅读更方便
你可能感兴趣的文章