2016-10-31 18:13:56 +01:00
|
|
|
# Realms in Zulip
|
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
Zulip allows multiple _realms_ to be hosted on a single instance.
|
2022-02-08 00:13:33 +01:00
|
|
|
Realms are the Zulip codebase's internal name for what we refer to in
|
2021-12-17 15:59:58 +01:00
|
|
|
user-facing documentation as an organization (the name "realm" comes
|
|
|
|
from [Kerberos](https://web.mit.edu/kerberos/)).
|
2016-10-31 18:13:56 +01:00
|
|
|
|
2021-01-22 01:31:03 +01:00
|
|
|
Wherever possible, we avoid using the term `realm` in any user-facing
|
|
|
|
string or documentation; "Organization" is the equivalent term used in
|
|
|
|
those contexts (and we have linters that attempt to enforce this rule
|
2022-02-08 00:13:33 +01:00
|
|
|
in translatable strings). We may in the future modify Zulip's
|
2021-01-22 01:31:03 +01:00
|
|
|
internals to use `organization` instead.
|
|
|
|
|
2017-10-20 18:53:33 +02:00
|
|
|
The
|
2019-09-30 19:37:56 +02:00
|
|
|
[production docs on multiple realms](../production/multiple-organizations.md)
|
2021-01-22 01:31:03 +01:00
|
|
|
are also relevant reading.
|
2017-10-20 18:53:33 +02:00
|
|
|
|
2020-08-11 01:47:54 +02:00
|
|
|
## Creating realms
|
2016-10-31 18:13:56 +01:00
|
|
|
|
2016-11-01 18:48:36 +01:00
|
|
|
There are two main methods for creating realms.
|
2016-10-31 18:13:56 +01:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- Using unique link generator
|
|
|
|
- Enabling open realm creation
|
2016-10-31 18:13:56 +01:00
|
|
|
|
2020-08-11 01:47:54 +02:00
|
|
|
#### Using unique link generator
|
2016-10-31 18:13:56 +01:00
|
|
|
|
|
|
|
```bash
|
2021-08-20 07:09:04 +02:00
|
|
|
./manage.py generate_realm_creation_link
|
2016-10-31 18:13:56 +01:00
|
|
|
```
|
2016-11-01 18:48:36 +01:00
|
|
|
|
2017-01-15 05:13:22 +01:00
|
|
|
The above command will output a URL which can be used for creating a
|
2016-11-01 18:48:36 +01:00
|
|
|
new realm and an administrator user for that realm. The link expires
|
2021-08-20 21:53:28 +02:00
|
|
|
after the creation of the realm. The link also expires if not used
|
2016-11-01 18:48:36 +01:00
|
|
|
within 7 days. The expiration period can be changed by modifying
|
|
|
|
`REALM_CREATION_LINK_VALIDITY_DAYS` in settings.py.
|
2016-10-31 18:13:56 +01:00
|
|
|
|
|
|
|
## Subdomains
|
|
|
|
|
2017-10-03 00:33:16 +02:00
|
|
|
One can host multiple realms in a Zulip server by giving each realm a
|
|
|
|
unique subdomain of the main Zulip server's domain. For example, if
|
|
|
|
the Zulip instance is hosted at zulip.example.com, and the subdomain
|
|
|
|
of your organization is acme you can would acme.zulip.example.com for
|
|
|
|
accessing the organization.
|
|
|
|
|
|
|
|
For subdomains to work properly, you also have to change your DNS
|
|
|
|
records so that the subdomains point to your Zulip installation IP. An
|
|
|
|
`A` record with host name value `*` pointing to your IP should do the
|
|
|
|
job.
|
|
|
|
|
|
|
|
We also recommend upgrading to at least Zulip 1.7, since older Zulip
|
2021-08-20 21:53:28 +02:00
|
|
|
releases had much less nice handling for subdomains. See our
|
2019-09-30 19:37:56 +02:00
|
|
|
[docs on using subdomains](../production/multiple-organizations.md) for
|
2017-10-03 00:33:16 +02:00
|
|
|
user-facing documentation on this.
|
2016-10-31 18:13:56 +01:00
|
|
|
|
2020-08-11 01:47:54 +02:00
|
|
|
### Working with subdomains in development environment
|
2016-10-31 18:13:56 +01:00
|
|
|
|
2022-07-26 02:05:07 +02:00
|
|
|
Zulip's development environment is designed to make it convenient to
|
|
|
|
test the various Zulip configurations for different subdomains:
|
|
|
|
|
|
|
|
- Realms are subdomains on `*.zulipdev.com`, just like `*.zulipchat.com`.
|
|
|
|
- The root domain (like `zulip.com` itself) is `zulipdev.com` itself.
|
|
|
|
- The default realm is hosted on `localhost:9991` rather than
|
|
|
|
`zulip.zulipdev.com`, using the [`REALM_HOSTS`
|
|
|
|
feature](../production/multiple-organizations.md) feature.
|
|
|
|
|
|
|
|
Details are below.
|
|
|
|
|
2016-11-01 18:48:36 +01:00
|
|
|
By default, Linux does not provide a convenient way to use subdomains
|
2021-08-20 21:53:28 +02:00
|
|
|
in your local development environment. To solve this problem, we use
|
2016-11-01 18:48:36 +01:00
|
|
|
the **zulipdev.com** domain, which has a wildcard A record pointing to
|
2021-08-20 21:53:28 +02:00
|
|
|
127.0.0.1. You can use zulipdev.com to connect to your Zulip
|
2017-10-03 00:33:16 +02:00
|
|
|
development server instead of localhost. The default realm with the
|
|
|
|
Shakespeare users has the subdomain `zulip` and can be accessed by
|
|
|
|
visiting **zulip.zulipdev.com**.
|
2016-11-01 18:48:36 +01:00
|
|
|
|
|
|
|
If you are behind a **proxy server**, this method won't work. When you
|
|
|
|
make a request to load zulipdev.com in your browser, the proxy server
|
2021-08-20 21:53:28 +02:00
|
|
|
will try to get the page on your behalf. Since zulipdev.com points
|
|
|
|
to 127.0.0.1 the proxy server is likely to give you a 503 error. The
|
2016-11-01 18:48:36 +01:00
|
|
|
workaround is to disable your proxy for `*.zulipdev.com`. The DNS
|
|
|
|
lookup should still work even if you disable proxy for
|
2021-08-20 22:54:08 +02:00
|
|
|
\*.zulipdev.com. If it doesn't you can add zulipdev.com records in
|
2016-11-01 18:48:36 +01:00
|
|
|
`/etc/hosts` file. The file should look something like this.
|
2016-10-31 18:13:56 +01:00
|
|
|
|
2021-08-20 07:09:04 +02:00
|
|
|
```text
|
2016-10-31 18:13:56 +01:00
|
|
|
127.0.0.1 localhost
|
|
|
|
|
|
|
|
127.0.0.1 zulipdev.com
|
|
|
|
|
|
|
|
127.0.0.1 zulip.zulipdev.com
|
|
|
|
|
|
|
|
127.0.0.1 testsubdomain.zulipdev.com
|
|
|
|
```
|
|
|
|
|
2020-08-31 00:10:57 +02:00
|
|
|
These records are also useful if you want to e.g. run the Puppeteer tests
|
2016-11-01 18:48:36 +01:00
|
|
|
when you are not connected to the Internet.
|