developing_zed__local_collaboration.md

 1# Local Collaboration
 2
 3First, make sure you've installed Zed's [backend dependencies](./developing_zed__building_zed.md#backend-dependencies).
 4
 5## Database setup
 6
 7Before you can run the `collab` server locally, you'll need to set up a `zed` Postgres database.
 8
 9```
10script/bootstrap
11```
12
13This script will set up the `zed` Postgres database, and populate it with some users. It requires internet access, because it fetches some users from the GitHub API.
14
15The script will create several *admin* users, who you'll sign in as by default when developing locally. The GitHub logins for these default admin users are specified in this file:
16
17```
18cat crates/collab/.admins.default.json
19```
20
21To use a different set of admin users, you can create a file called `.admins.json` in the same directory:
22
23```
24cat > crates/collab/.admins.json <<JSON
25[
26  "your-github-login",
27  "another-github-login"
28]
29JSON
30```
31
32## Testing collaborative features locally
33
34In one terminal, run Zed's collaboration server and the `livekit` dev server:
35
36```
37foreman start
38```
39
40In a second terminal, run two or more instances of Zed.
41
42```
43script/zed-local -2
44```
45
46This script starts one to four instances of Zed, depending on the `-2`, `-3` or `-4` flags. Each instance will be connected to the local `collab` server, signed in as a different user from `.admins.json` or `.admins.default.json`.