![]() This PR does not close an issue, but it is an issue and and fix in one. I hope this is ok, but please let me know if you prefer me to open an issue before. Release Notes: - Add "copy permalink" action for self-hosted GitHub enterprise instances # Issue ### Related issues: * https://github.com/zed-industries/zed/issues/26393 * https://github.com/zed-industries/zed/issues/11043 When you try to copy a permalink from a self-hosted GitHub enterprise instance, you get the following error: <img width="383" alt="permalink" src="https://github.com/user-attachments/assets/b32338a7-a2d7-48fc-86bf-ade1d32ed1f7" /> You also cannot open a PR or commit when you hover over a git blame: https://github.com/user-attachments/assets/a5491ce7-270b-412f-b9ac-027ec020b028 ### Reproduce If you do not have access to a self-hosted GitHub instance, you can change the remote url of any git repo: ``` git remote set-url origin git@github.mycorp.com:nilskch/zed.git ``` With the fix, permalinks still won't bring you to a valid website, but you can verify that they are correctly created. # Solution Currently, we only support detecting self-hosted GitLab instances, but not self-hosted GitHub instances. We detect GitLab instances by checking if "gitlab" is part of the git URL. This PR adds the same logic to detect self-hosted GitHub enterprise instances (by checking if "github" is in the URL). This solution is not ideal, since self-hosted GitHub or GitLab instances might not contain the word "github" or "gitlab". #26393 proposes adding a setting that would allow users to map specific domains to their corresponding git provider types. This mapping would help Zed correctly identify the appropriate git instance, even if "gitlab" or "github" are not part of the URL. This PR does not implement the offered solution, but I added a TODO where the fix for #26393 has to make changes. |
||
---|---|---|
.. | ||
k8s | ||
migrations | ||
migrations.sqlite | ||
migrations_llm | ||
seed | ||
src | ||
.env.toml | ||
Cargo.toml | ||
LICENSE-AGPL | ||
postgrest_app.conf | ||
postgrest_llm.conf | ||
README.md | ||
seed.default.json |
Zed Server
This crate is what we run at https://collab.zed.dev.
It contains our back-end logic for collaboration, to which we connect from the Zed client via a websocket after authenticating via https://zed.dev, which is a separate repo running on Vercel.
Local Development
Database setup
Before you can run the collab server locally, you'll need to set up a zed Postgres database. Follow the steps sequentially:
- Ensure you have postgres installed. If not, install with
brew install postgresql@15
. - Follow the steps on Brew's formula and verify your
$PATH
contains/opt/homebrew/opt/postgresql@15/bin
. - If you hadn't done it before, create the
postgres
user withcreateuser -s postgres
. - You are now ready to run the
bootstrap
script:
script/bootstrap
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.
The script will create several admin users, who you'll sign in as by default when developing locally. The GitHub logins for the default users are specified in the seed.default.json
file.
To use a different set of admin users, create crates/collab/seed.json
.
{
"admins": ["yourgithubhere"],
"channels": ["zed"]
}
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 seed.json
or seed.default.json
.
Deployment
We run two instances of collab:
- Staging (https://staging-collab.zed.dev)
- Production (https://collab.zed.dev)
Both of these run on the Kubernetes cluster hosted in Digital Ocean.
Deployment is triggered by pushing to the collab-staging
(or collab-production
) tag in Github. The best way to do this is:
./script/deploy-collab staging
./script/deploy-collab production
You can tell what is currently deployed with ./script/what-is-deployed
.
Database Migrations
To create a new migration:
./script/create-migration <name>
Migrations are run automatically on service start, so run foreman start
again. The service will crash if the migrations fail.
When you create a new migration, you also need to update the SQLite schema that is used for testing.