Procfile π
@@ -1,4 +1,2 @@
-web: cd ../zed.dev && PORT=3000 npm run dev
collab: cd crates/collab && RUST_LOG=${RUST_LOG:-warn,collab=info} cargo run serve
livekit: livekit-server --dev
-postgrest: postgrest crates/collab/admin_api.conf
Max Brunsfeld created
Procfile | 2
docs/src/SUMMARY.md | 3
docs/src/developing_zed__building_zed.md | 136 +++++-------------
docs/src/developing_zed__local_collaboration.md | 52 +++++-
4 files changed, 79 insertions(+), 114 deletions(-)
@@ -1,4 +1,2 @@
-web: cd ../zed.dev && PORT=3000 npm run dev
collab: cd crates/collab && RUST_LOG=${RUST_LOG:-warn,collab=info} cargo run serve
livekit: livekit-server --dev
-postgrest: postgrest crates/collab/admin_api.conf
@@ -4,15 +4,18 @@
[Feedback](./feedback.md)
# Configuring Zed
+
- [Settings](./configuring_zed.md)
- [Vim Mode](./configuring_zed__configuring_vim.md)
# Using Zed
+
- [Workflows]()
- [Collaboration]()
- [Using AI]()
# Contributing to Zed
+
- [How to Contribute]()
- [Building from Source](./developing_zed__building_zed.md)
- [Local Collaboration](./developing_zed__local_collaboration.md)
@@ -1,133 +1,73 @@
# Building Zed
-π§ TODO:
+## Dependencies
-- [ ] Remove ZI-specific things
-- [ ] Rework any steps that currently require a ZI-specific account
+- Install [Rust](https://www.rust-lang.org/tools/install)
+- Install [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12) from the macOS App Store
-How to build Zed from source for the first time.
+- Install [Xcode command line tools](https://developer.apple.com/xcode/resources/)
-### Prerequisites
+ ```bash
+ xcode-select --install
+ ```
-π§ TODO π§ Update for open source
+- Ensure that the Xcode command line tools are using your newly installed copy of Xcode:
-- Be added to the GitHub organization
-- Be added to the Vercel team
-- Create a [Personal Access Token](https://github.com/settings/personal-access-tokens/new) on Github
- - π§ TODO π§ What permissions are required?
- - π§ TODO π§ What changes when repo isn't private?
- - Go to https://github.com/settings/tokens and Generate new token
- - GitHub currently provides two kinds of tokens:
- - Classic Tokens, where only `repo` (Full control of private repositories) OAuth scope has to be selected
- Unfortunately, unselecting `repo` scope and selecting every its inner scope instead does not allow the token users to read from private repositories
- - (not applicable) Fine-grained Tokens, at the moment of writing, did not allow any kind of access of non-owned private repos
- - Keep the token in the browser tab/editor for the next two steps
+ ```
+ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer.
+ ```
-### Dependencies
+* Install the Rust wasm toolchain:
-- Install [Rust](https://www.rust-lang.org/tools/install)
+ ```bash
+ rustup target add wasm32-wasi
+ ```
-- Install the [GitHub CLI](https://cli.github.com/), [Livekit](https://formulae.brew.sh/formula/livekit) & [Foreman](https://formulae.brew.sh/formula/foreman)
+## Backend Dependencies
-```bash
-brew install gh
-brew install livekit
-brew install foreman
-```
+If you are developing collaborative features of Zed, you'll need to install the dependencies of zed's `collab` server:
-- Install [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12) from the macOS App Store
+- Install [Postgres](https://postgresapp.com)
+- Install [Livekit](https://formulae.brew.sh/formula/livekit) and [Foreman](https://formulae.brew.sh/formula/foreman)
-- Install [Xcode command line tools](https://developer.apple.com/xcode/resources/)
+ ```bash
+ brew install livekit foreman
+ ```
-```bash
-xcode-select --install
-```
-
-- If `xcode-select --print-path prints /Library/Developer/CommandLineToolsβ¦` run `sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer.`
+## Building Zed from Source
-* Install [Postgres](https://postgresapp.com)
+Once you have the dependencies installed, you can build Zed using [Cargo](https://doc.rust-lang.org/cargo/).
-* Install the wasm toolchain
+For a debug build:
-```bash
-rustup target add wasm32-wasi
```
-
-### Building Zed from Source
-
-1. Clone the `zed` repo
-
-```bash
-gh repo clone zed-industries/zed
+cargo run
```
-1. (Optional but recommended) Add your GITHUB_TOKEN to your `.zshrc` or `.bashrc` like this: `export GITHUB_TOKEN=yourGithubAPIToken`
-1. (π§ TODO π§ - Will this be relevant for open source?) Ensure the Zed.dev website is checked out in a sibling directory and install its dependencies:
+For a release build:
-```bash
-cd ..
-git clone https://github.com/zed-industries/zed.dev
-cd zed.dev && npm install
-pnpm install -g vercel
+```
+cargo run --release
```
-1. (π§ TODO π§ - Will this be relevant for open source?) Link your zed.dev project to Vercel
-
-- `vercel link`
-- Select the `zed-industries` team. If you don't have this get someone on the team to add you to it.
-- Select the `zed.dev` project
-
-1. (π§ TODO π§ - Will this be relevant for open source?) Run `vercel pull` to pull down the environment variables and project info from Vercel
-1. Open Postgres.app
-1. From `./path/to/zed/` run `GITHUB_TOKEN={yourGithubAPIToken} script/bootstrap`
-
-- You don't need to include the GITHUB_TOKEN if you exported it above.
-- Consider removing the token (if it's fine for you to recreate such tokens during occasional migrations) or store this token somewhere safe (like your Zed 1Password vault).
+And to run the tests:
-1. To run the Zed app:
- - If you are working on zed:
- - `cargo run`
- - If you are just using the latest version, but not working on zed:
- - `cargo run --release`
- - If you need to run the collaboration server locally:
- - `script/zed-local`
+```
+cargo test --workspace
+```
## Troubleshooting
-**`error: failed to run custom build command for gpui v0.1.0 (/Users/path/to/zed)`**
-
-- Try `xcode-select --switch /Applications/Xcode.app/Contents/Developer`
-
-**`xcrun: error: unable to find utility "metal", not a developer tool or in PATH`**
+### Error compiling metal shaders
-### `script/bootstrap`
-
-```bash
-Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
-Please create a new installation in /opt/homebrew using one of the
-"Alternative Installs" from:
-https://docs.brew.sh/Installation
```
+error: failed to run custom build command for gpui v0.1.0 (/Users/path/to/zed)`**
-- In that case try `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
-
-- If Homebrew is not in your PATH:
- - Replace `{username}` with your home folder name (usually your login name)
- - `echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/{username}/.zprofile`
- - `eval "$(/opt/homebrew/bin/brew shellenv)"`
-
+xcrun: error: unable to find utility "metal", not a developer tool or in PATH
```
-seeding database...
-thread 'main' panicked at 'failed to deserialize github user from 'https://api.github.com/orgs/zed-industries/teams/staff/members': reqwest::Error { kind: Decode, source: Error("invalid type: map, expected a sequence", line: 1, column: 0) }', crates/collab/src/bin/seed.rs:111:10
-```
-
-Wrong permissions for `GITHUB_TOKEN` token used, the token needs to be able to read from private repos.
-For Classic GitHub Tokens, that required OAuth scope `repo` (seacrh the scope name above for more details)
-
-Same command
-`sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer`
+Try `xcode-select --switch /Applications/Xcode.app/Contents/Developer`
-### If you experience errors that mention some dependency is using unstable features
+### Cargo errors claiming that a dependency is using unstable features
Try `cargo clean` and `cargo build`,
@@ -1,22 +1,46 @@
# Local Collaboration
-## Setting up the local collaboration server
+First, make sure you've installed Zed's [backend dependencies](/developing_zed__building_zed.html#backend-dependencies).
-### Setting up for the first time?
+## Database setup
-1. Make sure you have livekit installed (`brew install livekit`)
-1. Install [Postgres](https://postgresapp.com) and run it.
-1. Then, from the root of the repo, run `script/bootstrap`.
+Before you can run the `collab` server locally, you'll need to set up a `zed` Postgres database.
-### Have a db that is out of date? / Need to migrate?
+```
+script/bootstrap
+```
-1. Make sure you have livekit installed (`brew install livekit`)
-1. Try `cd crates/collab && cargo run -- migrate` from the root of the repo.
-1. Run `script/seed-db`
+This 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.
-## Testing collab locally
+The 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:
-1. Run `foreman start` from the root of the repo.
-1. In another terminal run `script/zed-local`.
-1. Two copies of Zed will open. Add yourself as a contact in the one that is not you.
-1. Start a collaboration session as normal with any open project.
+```
+cat crates/collab/.admins.default.json
+```
+
+To use a different set of admin users, you can create a file called `.admins.json` in the same directory:
+
+```
+cat > crates/collab/.admins.json <<JSON
+[
+ "your-github-login",
+ "another-github-login"
+]
+JSON
+```
+
+## Testing collaborative features locally
+
+In one terminal, run Zed's collaboration server and the `livekit` dev server:
+
+```
+foreman start
+```
+
+In a second terminal, run two or more instances of Zed.
+
+```
+script/zed-local -2
+```
+
+This 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`.