# Deploy Zulip

[Zulip](https://zulip.com/) is an *open source real-time chat application* like Slack, but with an email-like threading model. The email threading model allows you to catch up on important conversations while ignoring irrelevant ones. Zulip's features include:

- Highly configurable notifications.
- Keyboard shortcuts.
- Mobile and desktop apps.
- Integrations with Trac, Nagios, GitHub, and more.
- Restful API with Python bindings.
- and [more](https://zulip.com/features/)!

[image: Example Zulip screen showing streams and threads]

## One-Click Deploy

Use the button below to deploy Zulip on Render.

<deploy-to-render repo="https://github.com/render-examples/zulip">
</deploy-to-render>

It uses the [github.com/render-examples/zulip](https://github.com/render-examples/zulip) repository to create the following components on Render:

- Zulip web/application server: contains [Nginx](https://www.nginx.com/), [Django](https://www.djangoproject.com/), [Tornado](https://www.tornadoweb.org/en/stable/), and [Supervisor](http://supervisord.org/).
- [Memcached](https://memcached.org/) instance: used to cache database model objects.
- [Redis](https://redis.io/) instance: used for short-term datastores.
- [RabbitMQ](https://www.rabbitmq.com/) instance: used as a queuing system and to communicate between Django and Tornado.
- [PostgreSQL](https://www.postgresql.org/) instance: used to store all persistent data.

More details on Zulip’s architecture [here](https://zulip.readthedocs.io/en/latest/overview/architecture-overview.html).

Zulip recommends deploying the main application/webserver with more than 2 GB RAM (ideally 4). The *`1c-2g`* compute plan gives you 2 GB of RAM, but we recommend upgrading to the *`2c-4g`* compute plan for production use. Zulip has [documentation](https://zulip.readthedocs.io/en/stable/production/requirements.html#scalability) on how resource needs scale with the number of users on the app.

### Environment Variables

You only need one environment variable to test your Zulip install:

| Key                           | Value                                    |
| ----------------------------- | ---------------------------------------- |
| `SETTING_ZULIP_ADMINISTRATOR` | email address of the Zulip administrator |

You will be able to set up your account and use all of Zulip's features as a single user. Inviting other users to join your realm (Zulip's term for organization) requires setting up email-related environment variables, which are explained below.

### Setup

Once the `zulip` service is deployed and live, navigate to the `Shell` tab and type in:

```shell
su zulip
/home/zulip/deployments/current/manage.py generate_realm_creation_link
```

Visit the link generated by the command and create your Zulip administrator account with the email you used for `SETTING_ZULIP_ADMINISTRATOR`.

### Production

Zulip requires a mail server to send emails to users. Reliable mail delivery requires more work than just running the mail server, so we strongly recommend using a third-party email provider.

Zulip provides a list of [recommended email providers](https://zulip.readthedocs.io/en/latest/production/email.html?highlight=email#email-services) you can use. We have tested this repo successfully with [Mailgun](https://www.mailgun.com/), but other providers in the recommended list should work equally well.

These are the environment variables you will need to set for production use:

| Key                       | Value                                                                                                |
| ------------------------- | ---------------------------------------------------------------------------------------------------- |
| `SETTING_EXTERNAL_HOST`   | hostname your users will use to connect to your Zulip server; leave empty to use onrender.com domain |
| `SETTING_EMAIL_HOST`      | address of your SMTP provider (ex. smtp.mailgun.org)                                                 |
| `SETTING_EMAIL_HOST_USER` | your SMTP provider username (ex. postmaster@mg.example.com)                                          |
| `SECRETS_email_password`  | your SMTP provider password                                                                          |
| `SETTING_EMAIL_PORT`      | port your SMTP provider uses to connect (ex. 587)                                                    |
| `SETTING_EMAIL_USE_SSL`   | set to `True` if `SETTING_EMAIL_PORT` is using SSL; `False` otherwise                                |
| `SETTING_EMAIL_USE_TLS`   | set to `True` if `SETTING_EMAIL_PORT` is using TLS; `False` otherwise                                |

Third-party email providers support unencrypted and SSL/TLS-encrypted connections on multiple ports. [SendGrid](https://sendgrid.com/blog/whats-the-difference-between-ports-465-and-587/) and [Mailgun](https://www.mailgun.com/blog/which-smtp-port-understanding-ports-25-465-587/) recommend the following settings:

| Key                     | Recommended Value |
| ----------------------- | ----------------- |
| `SETTING_EMAIL_PORT`    | 587               |
| `SETTING_EMAIL_USE_SSL` | False             |
| `SETTING_EMAIL_USE_TLS` | True              |

#### Optional

Other environment variables you might change:

| Key                          | Default Values                                                                                                                                                                                                                                     |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `QUEUE_WORKERS_MULTIPROCESS` | `False` sets Zulip to run in [multithreaded mode](https://zulip.readthedocs.io/en/4.2/production/deployment.html#queue-workers-multiprocess), which is ideal for lower memory instances. Set to `True` if Zulip is run in a Pro instance or larger |
| `ZULIP_AUTH_BACKENDS`        | `EmailAuthBackend` supports email and password authentication, but Zulip also supports [other authentication methods](https://zulip.readthedocs.io/en/latest/production/)                                                                          |