Docker 搭建 Rocket.chat
GitHub原项目地址:https://github.com/RocketChat/Rocket.Chat
官网地址:https://rocket.chat/
文档地址:https://docs.rocket.chat/
sudo -i # 切换到root用户
apt update -y # 升级packages
apt install wget curl sudo vim git # 安装常用的软件
创建一下安装的目录:
mkdir -p /root/data/docker_data/rocketchat
cd /root/data/docker_data/rocketchat
nano docker-compose.yml
docker-compose.yml填入以下内容:
version: ‘2’
services:
rocketchat:
image: rocketchat/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
- MAIL_URL=smtp://smtp.email
– HTTP_PROXY=http://proxy.domain.com
– HTTPS_PROXY=http://proxy.domain.com
depends_on:
- mongo ports:
- 3000:3000 # 只需要改这一个地方,把左边的3000改掉就好啦 mongo: image: mongo:4.0 restart: unless-stopped volumes:
- ./data/db:/data/db #- ./data/dump:/dump command: mongod –smallfiles –oplogSize 128 –replSet rs0 –storageEngine=mmapv1
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: 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
没问题的话,ctrl+x退出,按y保存,enter确认。
运行:
docker-compose up -d 访问:http:服务ip:3000 即可。
注意:
1、不知道服务器IP,可以直接在命令行输入:curl ip.sb,会显示当前服务器的IP。
2、遇到访问不了的情况,请在宝塔面板的防火墙和服务商的后台防火墙里打开对应端口。
5.2 更新 cp -r /root/data/docker_data/rocketchat /root/data/docker_data/rocketchat.archive # 万事先备份,以防万一
cd /root/data/docker_data/rocketchat # 进入docker-compose所在的文件夹
docker-compose pull # 拉取最新的镜像
docker-compose up -d # 重新更新当前镜像 利用Docker-compose搭建的应用,更新非常容易~
5.3 卸载 cd /root/data/docker_data/rocketchat # 进入docker-compose所在的文件夹
docker-compose down # 停止容器,此时不会删除映射到本地的数据
rm -rf /root/data/docker_data/rocketchat # 完全删除映射到本地的数据
参考: https://tech.oeru.org/install-rocketchat-ubuntu-2004-docker-compose
原文链接:https://blog.laoda.de/archives/docker-compose-install-rocketchat
- X-ui面板安装
- Ubuntu删除与安装系统内核