Skip to content

Instantly share code, notes, and snippets.

@Jimmy-Xu
Last active October 8, 2015 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jimmy-Xu/d71cd518990909ab9b84 to your computer and use it in GitHub Desktop.
Save Jimmy-Xu/d71cd518990909ab9b84 to your computer and use it in GitHub Desktop.
install guide for zulip server under ubuntu14.04

Install zulip server under ubuntu 14.04

Reference

run the following command as root user

1 download zulip server install package

cd /root
wget -c https://www.zulip.com/dist/releases/zulip-server-1.3.5.tar.gz
tar -xzvf zulip-server-1.3.5.tar.gz
mv zulip-server-1.3.5 zulip

install source should be under /root/zulip

2 generate ssl

if just for experience or demo

//generate key and cert
mkdir -p /root/ssl && cd /root/ssl
openssl genrsa -des3 -out zulip.key 1024
openssl rsa -in zulip.key -out zulip_nopass.key
openssl req -new -key zulip.key -out zulip.csr -subj "/C=CN/ST=BJ/L=BJ/O=mrbot/OU=mrbot/CN=*.xxx.io/emailAddress=xxx@xxx.io"
openssl x509 -req -days 365 -in zulip.csr -signkey zulip.key -out zulip.crt

//copy key and cert
cp zulip_nopass.key /etc/ssl/private/zulip.key
cp zulip.crt /etc/ssl/certs/zulip.combined-chain.crt

3 start install

cd /root/zulip
./scripts/setup/install

/home/zulip will be created
all dependency service(rabbitmq-server,nginx...) will be start after finish install

4 customize configuration

vi /etc/zulip/settings.py
EXTERNAL_HOST = 'zulip.xxx.io'
ZULIP_ADMINISTRATOR = 'xjimmyshcn@gmail.com'
ADMIN_DOMAIN = 'xxx.io'
AUTHENTICATION_BACKENDS = (
                           'zproject.backends.EmailAuthBackend', # Email and password
    )

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'xjimmyshcn@gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True

DEFAULT_FROM_EMAIL = "zulip admin<xjimmyshcn@gmail.com>"
NOREPLY_EMAIL_ADDRESS = "xjimmyshcn+noreply@gmail.com"

5 config email password for smtp

//append "email_password" under [secrets]
vi /etc/zulip/zulip-secrets.conf
email_password=xxxxxxxxxx

"email_host_password" is not correct
password should be plain-text

6 init database

cd /root/zulip
./scripts/setup/postgres-init-db
su zulip -c /home/zulip/deployments/current/scripts/setup/initialize-database

zulip service will be auto start after finish iniialize

7 view service status

//view status of all zulip service
supervisorctl status
	process-fts-updates              RUNNING    pid 1438, uptime 0:01:15
	zulip-django                     RUNNING    pid 1424, uptime 0:01:16
	zulip-senders:zulip-events-message_sender-0 RUNNING    pid 1538, uptime 0:01:03
	zulip-senders:zulip-events-message_sender-1 RUNNING    pid 1540, uptime 0:01:03
	zulip-senders:zulip-events-message_sender-2 RUNNING    pid 1549, uptime 0:01:02
	zulip-senders:zulip-events-message_sender-3 RUNNING    pid 1554, uptime 0:01:02
	zulip-senders:zulip-events-message_sender-4 RUNNING    pid 1531, uptime 0:01:04
	zulip-tornado                    RUNNING    pid 1425, uptime 0:01:16
	zulip-workers:zulip-deliver-enqueued-emails RUNNING    pid 1482, uptime 0:01:10
	zulip-workers:zulip-events-confirmation-emails RUNNING    pid 1468, uptime 0:01:11
	zulip-workers:zulip-events-digest_emails RUNNING    pid 1510, uptime 0:01:06
	zulip-workers:zulip-events-email_mirror RUNNING    pid 1494, uptime 0:01:08
	zulip-workers:zulip-events-error_reports RUNNING    pid 1475, uptime 0:01:11
	zulip-workers:zulip-events-feedback_messages RUNNING    pid 1524, uptime 0:01:05
	zulip-workers:zulip-events-missedmessage_mobile_notifications RUNNING    pid 1501, uptime 0:01:07
	zulip-workers:zulip-events-missedmessage_reminders RUNNING    pid 1517, uptime 0:01:06
	zulip-workers:zulip-events-signups RUNNING    pid 1461, uptime 0:01:12
	zulip-workers:zulip-events-slowqueries RUNNING    pid 1487, uptime 0:01:09
	zulip-workers:zulip-events-user-activity RUNNING    pid 1454, uptime 0:01:13
	zulip-workers:zulip-events-user-activity-interval RUNNING    pid 1447, uptime 0:01:14
	zulip-workers:zulip-events-user-presence RUNNING    pid 1439, uptime 0:01:15


//view port of dependent service
netstat -tnopl
	Active Internet connections (only servers)
	Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name Timer
	tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      57003/nginx      off (0.00/0/0)
	tcp        0      0 0.0.0.0:59472           0.0.0.0:*               LISTEN      60046/beam.smp   off (0.00/0/0)
	tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      61045/postgres   off (0.00/0/0)
	tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      57003/nginx      off (0.00/0/0)
	tcp        0      0 127.0.0.1:9993          0.0.0.0:*               LISTEN      1425/python      off (0.00/0/0)
	tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      58898/redis-server  off (0.00/0/0)
	tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      58773/memcached  off (0.00/0/0)
	tcp6       0      0 :::4369                 :::*                    LISTEN      60011/epmd       off (0.00/0/0)
	tcp6       0      0 :::5672                 :::*                    LISTEN      60046/beam.smp   off (0.00/0/0)


//view zulip service error log
tail -f /var/log/zulip/errors.log

8 open web gui

//modify hosts(if your domain isn't public):
 x.x.x.x zulip.xxx.io

//open url in browser
http://zulip.xxx.io
or
https://zulip.xxx.io

need open port 443,80


FAQ:

1 dependency service

service rabbitmq-server status
service postgresql status
service nginx status
service redis-server status
service memcached status

The above service will be auto start

2 zulip can not connect to rabbitmq after OS reboot

//epmd doesn't auto start, so rabbitmq start failed

//start epmd and rabbitmq-server
epmd -daemon
/etc/init.d/rabbitmq-server start

//another way
erl -noshell -sname root@localhost -s init stop
service rabbitmq-server start

3 restart zulip

su zulip -c /home/zulip/deployments/current/scripts/restart-server

4 re-create database

supervisorctl stop all
service memcached restart
cd /root/zulip
./scripts/setup/postgres-init-db
su zulip -c /home/zulip/deployments/current/scripts/setup/initialize-database

5 use smtp server of gmail

https://support.google.com/mail/answer/78754
	=》https://www.google.com/settings/security/lesssecureapps
		=>Access for less secure apps -> Turn on

6 change SSL certificate

//replace key and cert file
xxx.crt => /etc/ssl/certs/zulip.combined-chain.crt
xxx.pem => /etc/ssl/private/zulip.key

//restart nginx
service nginx restart

7 restart zulip service

su zulip -c /home/zulip/deployments/current/scripts/restart-server

8 support register with different domain of email

//register email domain is restricted to domain by default, if you want to support other email domain, then run command like these:

cd /root/zulip
su zulip -c "./manage.py create_realm --domain=visualops.io --name='visualops' --open-realm"
su zulip -c "./manage.py create_realm --domain=gmail.com --name='gmail' --open-realm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment