zulip号称是特性和体验很不错的企业版即时聊天应用,开源并且有超过500家企业部署使用,出于好奇,所以安装了一个版本体验体验,国内鲜有安装过程记录,有一个通过docker-compose安装的脚本,但zulip的容器启动总是报错,所以单独安装了一遍,记录安装过程中的错误, zulip架构图如下:
docker容器启动脚本,在一个基础的Ubuntu 18.04.4基础镜像包(经过测试,在centos或者ubuntu 18.04以下版本均出现不同程度的不能解决的错误)的基础上,安装该环境:
docker run -d --net mynetwork2 --ip 192.168.1.100 -p 50012:22 -p 9443:443 -p 9080:80 -p 9081:8081 --name zulip --privileged=true -ti aea5df499adc /sbin/init
主要碰到的问题包括zulip依赖的几个基础服务配置错误或者启动运行错误!
安装脚本,主要参考:https://zulip.readthedocs.io/en/stable/production/install.html网页。
0、下载最新版本并执行安装命令
wget https://www.zulip.org/dist/releases/zulip-server-latest.tar.gz
tar -xf zulip-server-latest.tar.gz
安装:
root@fbbf80d777e9:/home/zulip# ./zulip-server-*/scripts/setup/install --self-signed-cert --email=xxxxx@qq.com --hostname=11.12.117.68
提前修改apt-get的源为阿里的源,pip的源修改为清华的源,修改完后,会出现setup-tool安装错误,原因主要是pip的源和pip的版本没有更新;
pip修改源的方法可以baidu,主要是修改~/.pip/pip.conf文件:
#清华的源
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
如果是阿里云服务器上安装,运行安装过程中,需要修改一个py脚本,否则会出现lxml的安装错误;
root@iZwz9it79rawg1924174lkZ:/home/zulip# vi /srv/zulip-venv-cache/6176a52fab8737c09656fc8ad0352547e9801c07/zulip-py3-venv/lib/python3.6/site-packages/setuptools/installer.py
root@iZwz9it79rawg1924174lkZ:/home/zulip#
注释掉了这个index_url的修改
#if index_url is not None:
cmd.extend(('--index-url', index_url))
1、docker容器的hosts主机名字配置错误,导致rabbitmq一直连不上,
根据网上的说法,添加了127.0.0.1的主机名配置,发现还是不对,原来不能有多条重复的记录,修改后解决rabbitmq连接错误;
root@fbbf80d777e9:~# cat /etc/hosts
127.0.0.1 fbbf80d777e9
root@fbbf80d777e9:/home/zulip/zulip-server-2.1.4# rabbitmqctl list_users
Listing users
zulip [administrator]
admin []
2、redis的服务启动后总是异常退出,更换一个redis源码版本重新编译后解决,但后来又碰到一个redis账户不能登录的错误,主要是zulip-secrets.conf 配置文件中保存的redis_password和配置文件/etc/redis/redis.conf中requirepass配置的不一致,配置后问题解决;
requirepass foobared
requirepass 9dcf3d6f0de91867ab5754dfaae65703ebb962bfd98efd30db2ee70b6b45b847
root@fbbf80d777e9:~# cat /etc/zulip/zulip-secrets.conf
[secrets]
avatar_salt = 6de689281d1e9bff23690e6d5e4f43fe96fea00d418f0b0583b4d393dd0f11b9
rabbitmq_password = 69d7cd41e6f8084e39561a28bc3350524c2cf4398cc7c0c6f4414ee8199d162c
shared_secret = e99e0a42f46d30c3ca13d405a524c57457a2117038c52f36a39551726354ab8b
thumbor_key = ecb681106a7e13fd34528539b04faf23e9c33906faab59c36e3fdcb12d69c1a1
secret_key = 7utpbh(9iyxmdvi8li^jvd514swqck@6m2-rdw2+dpym#2=nrn
camo_key = pGHTWKPMTwcc9g8FBb4WfOp6P41mJl1W4ki8xKSZNAtHqzEgavmMJx4ctbht7J89
memcached_password = b26056bfe8b82ea02197e4e50ddfb369ad868a1840718498615d7facbe51d1b8
redis_password = 9dcf3d6f0de91867ab5754dfaae65703ebb962bfd98efd30db2ee70b6b45b847
zulip_org_key = tRx3M3vJ64CRZ4fUKHnsCPmn2l5a8UHGX5VUP9S5nngGKDCSRQVhtH0nDlqAlhrR
zulip_org_id = 64de7d39-acc1-4f27-8487-d8b8597cd48f
3、memcached开启sasl验证后,sasl服务不能正常启动,启动失败原因未知,修改memcached的配置文件,暂时关闭sasl跳过这个错误,但是引入的问题是后面的flush-memcached脚本还是存在错误;
删除了flush-memcached这个脚本的调用后,跳过了这个错误,不排除运行时还会有报错,实际生产环境memcached还是需要开启校验的!
vi /home/zulip/zulip-server-2.1.4/scripts/setup/flush-memcached
./deployments/next/scripts/setup/postgres-init-db:#"$(dirname "$0")/flush-memcached"
4、安装成功的日志:
- su zulip -c '/home/zulip/deployments/current/manage.py generate_realm_creation_link'
Please visit the following secure single-use link to register your
new Zulip organization:
https://11.12.117.68:9443/new/f4xuxvf7ijkqg7wox3xp0nmg
使用上面的链接创建一个默认组织。
5、服务状态查询:
root@fbbf80d777e9:~# supervisorctl status
process-fts-updates RUNNING pid 4077, uptime 0:13:54
zulip-django RUNNING pid 4075, uptime 0:13:54
zulip-senders:zulip_events_message_sender-0 RUNNING pid 4079, uptime 0:13:54
zulip-senders:zulip_events_message_sender-1 RUNNING pid 4080, uptime 0:13:54
zulip-senders:zulip_events_message_sender-2 RUNNING pid 4081, uptime 0:13:54
zulip-senders:zulip_events_message_sender-3 RUNNING pid 4082, uptime 0:13:54
zulip-thumbor RUNNING pid 4078, uptime 0:13:54
zulip-tornado RUNNING pid 4076, uptime 0:13:54
zulip-workers:zulip_deliver_enqueued_emails RUNNING pid 4100, uptime 0:13:54
zulip-workers:zulip_deliver_scheduled_messages RUNNING pid 4101, uptime 0:13:54
zulip-workers:zulip_events_deferred_work RUNNING pid 4094, uptime 0:13:54
zulip-workers:zulip_events_digest_emails RUNNING pid 4098, uptime 0:13:54
zulip-workers:zulip_events_email_mirror RUNNING pid 4089, uptime 0:13:54
zulip-workers:zulip_events_email_senders RUNNING pid 4099, uptime 0:13:54
zulip-workers:zulip_events_embed_links RUNNING pid 4095, uptime 0:13:54
zulip-workers:zulip_events_embedded_bots RUNNING pid 4088, uptime 0:13:54
zulip-workers:zulip_events_error_reports RUNNING pid 4097, uptime 0:13:54
zulip-workers:zulip_events_invites RUNNING pid 4083, uptime 0:13:54
zulip-workers:zulip_events_missedmessage_email_senders RUNNING pid 4092, uptime 0:13:54
zulip-workers:zulip_events_missedmessage_emails RUNNING pid 4091, uptime 0:13:54
zulip-workers:zulip_events_missedmessage_mobile_notifications RUNNING pid 4096, uptime 0:13:54
zulip-workers:zulip_events_outgoing_webhooks RUNNING pid 4086, uptime 0:13:54
zulip-workers:zulip_events_signups RUNNING pid 4087, uptime 0:13:54
zulip-workers:zulip_events_slow_queries RUNNING pid 4084, uptime 0:13:54
zulip-workers:zulip_events_user_activity RUNNING pid 4093, uptime 0:13:54
zulip-workers:zulip_events_user_activity_interval RUNNING pid 4090, uptime 0:13:54
zulip-workers:zulip_events_user_presence RUNNING pid 4085, uptime 0:13:54
root@fbbf80d777e9:~#
6、UnicodeEncodeError: 'ascii' codec can't encode characters in position 27-29: ordinal not in range(128)
修改Python本环境(推荐), 在Python的Lib\site-packages文件夹下新建一个sitecustomize.py文件,内容为:
#coding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
设置export LANG="en_US.UTF-8"
7、参考 https://zulip.readthedocs.io/en/latest/production/email.html 配置外发邮箱地址,注意ZULIP_ADMINISTRATOR的地址需要和外发邮箱地址是一个地址,未处理消息等等通知都会经过这个地址发送。
8、检查服务器状态
root@fbbf80d777e9:/home/zulip/deployments/current# su zulip
zulip@fbbf80d777e9:~/deployments/current$ ./manage.py list_realms
id string_id name domain
1 zulipinternal None https://zulipinternal.11.12.117.68
2 '' 测试组 https://11.12.117.68
zulip@fbbf80d777e9:~/deployments/current$
zulip@fbbf80d777e9:~/deployments/current$ pwd
/home/zulip/deployments/current
zulip@fbbf80d777e9:~/deployments/current$
服务重启
su zulip -c '/home/zulip/deployments/current/scripts/restart-server
总结:体验完Web版,感觉确实很好用,交互细节,各种配置功能都很完善!