Skip to content

Commit 64ba888

Browse files
committed
[memory-bank] Overhaul based on current usage
- merge learning-journal.md into existing docs - introduce public-api.md - introduce components.md for more reliable lookup
1 parent f271ea2 commit 64ba888

20 files changed

+403
-123
lines changed

memory-bank/components.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Gitpod Components Index
2+
3+
This file serves as index for the per-component documentation in individual md files in the `memory-bank/components` directory.
4+
5+
- [server](components/server.md)
6+
- [content-service](components/content-service.md)
7+
- [ws-manager-mk2](components/ws-manager-mk2.md)
8+
- [ws-daemon](components/ws-daemon.md)
9+
- [image-builder-mk3](components/image-builder-mk3.md)
10+
- [content-service-api](components/content-service-api.md)
11+
- [ws-manager-api](components/ws-manager-api.md)
12+
- [ws-daemon-api](components/ws-daemon-api.md)
13+
- [image-builder-api](components/image-builder-api.md)
14+
- [supervisor-api](components/supervisor-api.md)
15+
- [registry-facade-api](components/registry-facade-api.md)
16+
- [ide-service-api](components/ide-service-api.md)
17+
- [ide-metrics-api](components/ide-metrics-api.md)
18+
- [ws-manager-bridge-api](components/ws-manager-bridge-api.md)
19+
- [public-api](components/public-api.md)
20+
- [usage-api](components/usage-api.md)
21+
- [local-app-api](components/local-app-api.md)
22+
- [dashboard](components/dashboard.md)
23+
- [ide](components/ide.md)
24+
- [proxy](components/proxy.md)
25+
- [registry-facade](components/registry-facade.md)
26+
- [blobserve](components/blobserve.md)
27+
- [ipfs](components/ipfs.md)
28+
- [openvsx-proxy](components/openvsx-proxy.md)
29+
- [scheduler-extender](components/scheduler-extender.md)
30+
- [gitpod-db](components/gitpod-db.md)
31+
- [gitpod-protocol](components/gitpod-protocol.md)
32+
- [supervisor](components/supervisor.md)
33+
- [workspacekit](components/workspacekit.md)
34+
- [ws-proxy](components/ws-proxy.md)
35+
- [ide-proxy](components/ide-proxy.md)
36+
- [ide-service](components/ide-service.md)
37+
- [ide-metrics](components/ide-metrics.md)
38+
- [docker-up](components/docker-up.md)
39+
- [common-go](components/common-go.md)
40+
- [service-waiter](components/service-waiter.md)
41+
- [node-labeler](components/node-labeler.md)
42+
- [scrubber](components/scrubber.md)
43+
- [spicedb](components/spicedb.md)
44+
- [public-api-server](components/public-api-server.md)
45+
- [gitpod-cli](components/gitpod-cli.md)
46+
- [local-app](components/local-app.md)
47+
- [ws-manager-bridge](components/ws-manager-bridge.md)
48+
- [image-builder-bob](components/image-builder-bob.md)
49+
- [usage](components/usage.md)

memory-bank/components/content-service-api.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,6 @@ This script performs the following actions:
9898
- Generates TypeScript code
9999
- Updates license headers
100100

101-
### Implementation Details
102-
The `generate.sh` script uses functions from the shared script at `scripts/protoc-generator.sh`, which provides common functionality for all API components:
103-
104-
- `install_dependencies`: Installs required protoc plugins
105-
- `protoc_buf_generate`: Uses the `buf` tool to generate code based on the configuration in `buf.gen.yaml`
106-
- `update_license`: Updates license headers in generated files
107-
108101
### Building After Code Generation
109102
After regenerating the code, you may need to rebuild components that depend on the Content Service API. This typically involves:
110103

memory-bank/components/gitpod-db.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The Gitpod DB component defines numerous entities that map to database tables, i
4949
- **User**: User accounts and profiles
5050
- **Workspace**: Workspace metadata and configuration
5151
- **WorkspaceInstance**: Running workspace instances
52-
- **Team**: Team organization and membership
52+
- **Team**: Represents an "Organization" within Gitpod, storing its core details, membership, and organization-level state. The entity is named `DBTeam` for historical reasons.
5353
- **Project**: Project configuration and settings
5454
- **Identity**: User identity and authentication
5555
- **Token**: Authentication tokens and credentials

memory-bank/components/gitpod-protocol.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The Gitpod Protocol defines numerous core data structures, including:
5050
- `User`: User account information
5151
- `Identity`: Authentication provider identity
5252
- `Token`: Authentication tokens
53+
- `Organization` (defined in `src/teams-projects-protocol.ts`): Represents a team/organization, including its settings
5354
- `GitpodToken`: API tokens
5455
- `AuthProviderInfo`: Authentication provider metadata
5556
- `AuthProviderEntry`: Authentication provider configuration

memory-bank/components/ide-metrics-api.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,6 @@ This script performs the following actions:
8686
- Generates Java code
8787
- Updates license headers
8888

89-
### Implementation Details
90-
The `generate.sh` script uses functions from the shared script at `scripts/protoc-generator.sh` and defines some custom functions:
91-
92-
- `install_dependencies`: Installs required protoc plugins
93-
- `local_go_protoc`: Generates Go code with specific include paths
94-
- `go_protoc_gateway`: Generates gRPC Gateway code for REST endpoints
95-
- `local_java_protoc`: Generates Java code
96-
- `update_license`: Updates license headers in generated files
97-
9889
The IDE Metrics API is unique in that it generates both gRPC and REST API endpoints using the gRPC Gateway, and it also generates Java code for use in JetBrains IDE plugins.
9990

10091
### Building After Code Generation

memory-bank/components/ide-service-api.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,6 @@ This script performs the following actions:
105105
- Generates TypeScript code using `ts_proto`
106106
- Updates license headers
107107

108-
### Implementation Details
109-
The `generate.sh` script uses functions from the shared script at `scripts/protoc-generator.sh`:
110-
111-
- `install_dependencies`: Installs required protoc plugins
112-
- `go_protoc`: Generates Go code
113-
- `typescript_ts_protoc`: Generates TypeScript code using ts_proto
114-
- `update_license`: Updates license headers in generated files
115-
116108
The IDE Service API generates TypeScript code using the ts_proto plugin, which creates more modern TypeScript interfaces compared to the standard protoc TypeScript generator.
117109

118110
### Building After Code Generation

memory-bank/components/image-builder-api.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,6 @@ This script performs the following actions:
109109
- Patches the generated TypeScript code for compatibility
110110
- Updates license headers
111111

112-
### Implementation Details
113-
The `generate.sh` script uses functions from the shared script at `scripts/protoc-generator.sh`:
114-
115-
- `install_dependencies`: Installs required protoc plugins
116-
- `go_protoc`: Generates Go code
117-
- `typescript_protoc`: Generates TypeScript code
118-
- `update_license`: Updates license headers in generated files
119-
120112
Additionally, the script:
121113
- Generates mock implementations using `mockgen` for testing
122114
- Patches the generated TypeScript code using a script from the content-service-api

memory-bank/components/local-app-api.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ This script performs the following actions:
7474
- Generates Go code using `protoc-gen-go` and `protoc-gen-go-grpc`
7575
- Updates license headers
7676

77-
### Implementation Details
78-
The `generate.sh` script uses functions from the shared script at `scripts/protoc-generator.sh` and defines some custom functions:
79-
80-
- `install_dependencies`: Installs required protoc plugins
81-
- `local_go_protoc`: Generates Go code with specific include paths for third-party dependencies
82-
- `update_license`: Updates license headers in generated files
83-
8477
The Local App API has a dependency on the Supervisor API for tunnel visibility definitions, which is included in the protoc generation process.
8578

8679
### Building After Code Generation

memory-bank/components/public-api-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ The Public API Server is configured through a JSON configuration file:
120120
## Integration Points
121121

122122
The Public API Server integrates with:
123-
1. **Gitpod Server**: For core Gitpod functionality
123+
1. **Gitpod Server**: For core Gitpod functionality. The Public API Server often acts as a gRPC gateway, proxying requests to the Gitpod Server (TypeScript component) where the business logic for many `gitpod.v1` services (like `OrganizationService`) is implemented.
124124
2. **Database**: For persistent storage
125125
3. **Redis**: For caching and session management
126126
4. **Billing Service**: For billing-related operations

memory-bank/components/public-api.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# Public API
2+
3+
## Overview
4+
The Public API defines the gRPC interfaces for programmatic access to Gitpod functionality. It serves as the canonical way for external integrations, automation, and third-party tools to interact with Gitpod's core services. The API is structured into two packages (stable and experimental) with different compatibility guarantees and is designed to be backward compatible, well-documented, and follow modern API design principles.
5+
6+
## Purpose
7+
This API provides a standardized interface for:
8+
- Programmatically managing workspaces (create, start, stop, delete)
9+
- Accessing and managing user information
10+
- Working with organizations and teams
11+
- Managing projects and repositories
12+
- Integrating with source code management systems
13+
- Configuring editors and IDEs
14+
- Authenticating via OpenID Connect
15+
- Managing personal access tokens
16+
- Automating Gitpod workflows
17+
18+
## Architecture
19+
The Public API is implemented as a set of gRPC services defined in Protocol Buffer files. These definitions are used to generate client and server code in Go, TypeScript, and Java. The API is exposed on `api.gitpod.io` or `api.<domain>` for Dedicated installations.
20+
21+
The API is structured into two main packages:
22+
23+
1. **Stable (v1)**:
24+
- Located in `gitpod/v1/`
25+
- Provides compatibility guarantees
26+
- Services, calls, types, and fields are not removed without following a deprecation policy
27+
- Services, calls, types, and fields are not renamed
28+
- Non-successful responses are described exhaustively
29+
- **Implementation**: Directly implemented in the server component using Connect
30+
31+
2. **Experimental**:
32+
- Located in `gitpod/experimental/v1/`
33+
- Provides no compatibility guarantees
34+
- May change frequently
35+
- **Implementation**: Handled in the public-api-server component, and either:
36+
- Implemented directly in Go
37+
- Forwarded to the old websocket API in the server component
38+
39+
## Implementation Patterns
40+
41+
### Stable API Implementation
42+
The stable API (v1) is implemented directly in the server component using Connect. This means:
43+
- The server component handles the business logic for these API endpoints
44+
- The implementation is in TypeScript using Connect
45+
46+
### Experimental API Implementation
47+
The experimental API is handled in the public-api-server component in two ways:
48+
49+
1. **Direct Implementation**:
50+
- Some services are implemented directly in Go within the public-api-server
51+
- These implementations handle the business logic directly
52+
- They may interact with the database or other services directly
53+
54+
2. **Forwarded Implementation**:
55+
- Other services forward requests to the old websocket API in the server component
56+
- The public-api-server acts as a proxy, translating gRPC requests to websocket API calls
57+
- The server component handles the actual business logic
58+
- This approach is often used for functionality that already exists in the server component
59+
60+
## Key Services
61+
62+
### Stable API (v1)
63+
All implemented in server component using Connect:
64+
- WorkspaceService
65+
- OrganizationService
66+
- UserService
67+
- TokenService
68+
- SCMService
69+
- AuthProviderService
70+
- ConfigurationService
71+
- EnvVarService
72+
- InstallationService
73+
- PrebuildService
74+
- SSHService
75+
- VerificationService
76+
77+
### Experimental API
78+
Implemented in public-api-server:
79+
- WorkspacesService (Forwarded to server)
80+
- TeamsService (Directly implemented in Go)
81+
- ProjectsService (Forwarded to server)
82+
- EditorService (Directly implemented in Go)
83+
- IDEClientService (Directly implemented in Go)
84+
- OIDCService (Directly implemented in Go)
85+
- IdentityProviderService (Directly implemented in Go)
86+
- TokensService (Forwarded to server)
87+
- UserService (Forwarded to server)
88+
- StatsService (Directly implemented in Go)
89+
90+
## Communication Patterns
91+
- The API uses gRPC for efficient, typed communication
92+
- Connect is used for the stable API implementation
93+
- Requests include authentication tokens for identifying the user
94+
- Pagination is supported for listing operations
95+
- Streaming is used for real-time updates (e.g., workspace status changes)
96+
- Field masks are used to specify which fields to return or update
97+
98+
### Implementation-specific Patterns
99+
- **Stable API (v1)**:
100+
- Requests are handled by the server component using Connect
101+
- The public-api-server routes requests to the server component
102+
103+
- **Experimental API**:
104+
- Directly implemented services handle requests in the public-api-server
105+
- Forwarded services translate gRPC requests to websocket API calls to the server component
106+
107+
## Dependencies
108+
- **Server Component**: Implements the stable API and handles forwarded experimental API requests
109+
- **Public-api-server Component**: Implements experimental APIs directly or forwards to server
110+
- **Database**: Stores user, workspace, and organization data
111+
- **Redis**: Used for caching and session management
112+
- **gRPC and Connect**: Used for API implementation
113+
- **Protocol Buffers**: Used for API definition and code generation
114+
115+
## Usage Examples
116+
- Creating and managing workspaces programmatically
117+
- Building custom dashboards and management tools
118+
- Integrating Gitpod with CI/CD pipelines
119+
- Automating workspace provisioning
120+
- Building IDE extensions that interact with Gitpod
121+
- Implementing custom authentication flows
122+
- Integrating with third-party services
123+
124+
## Version Compatibility
125+
The API uses Protocol Buffers version 3 (proto3) syntax, which provides forward and backward compatibility features.
126+
127+
### Stable API (v1)
128+
- Services, calls, types, and fields are not removed without following a deprecation policy
129+
- Services, calls, types, and fields are not renamed
130+
- Non-successful responses are described exhaustively
131+
- Changes require an API User Experience review
132+
133+
### Experimental API
134+
- No compatibility guarantees
135+
- May change frequently
136+
- Should not be relied upon for production use
137+
138+
## Code Generation and Building
139+
140+
### Regenerating Code from Protobuf Definitions
141+
The Public API uses Protocol Buffers and gRPC for defining interfaces. When changes are made to the `.proto` files, the corresponding code in Go, TypeScript, and Java needs to be regenerated.
142+
143+
To regenerate the code:
144+
145+
1. Navigate to the public-api directory:
146+
```bash
147+
cd components/public-api
148+
```
149+
150+
2. Run the generate script:
151+
```bash
152+
./generate.sh
153+
```
154+
155+
3. Rebuild the typescript code:
156+
```bash
157+
cd typescript-commond && yarn build
158+
```
159+
160+
This script performs the following actions:
161+
- Installs necessary dependencies
162+
- Lints the proto files using buf
163+
- Runs breaking change detection against the main branch
164+
- Removes previously generated files
165+
- Generates Go, TypeScript, and Java code using buf
166+
- Updates license headers
167+
- Runs formatting tools
168+
- Builds the TypeScript package
169+
170+
### Building After Code Generation
171+
After regenerating the code, you may need to rebuild components that depend on the Public API. This typically involves:
172+
173+
1. For Go components:
174+
```bash
175+
cd <component-directory>
176+
go build ./...
177+
```
178+
179+
2. For TypeScript components:
180+
```bash
181+
cd <component-directory>
182+
yarn install
183+
yarn build
184+
```
185+
186+
3. Using Leeway (for CI/CD):
187+
```bash
188+
leeway build -D components/<component-name>:app
189+
```
190+
191+
The Public API is a critical component for enabling programmatic access to Gitpod functionality. It enables third-party integrations, automation, and custom tooling to interact with Gitpod in a standardized, versioned way.

memory-bank/components/registry-facade-api.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ This script performs the following actions:
8686
- Generates Go code using `protoc-gen-go` and `protoc-gen-go-grpc`
8787
- Updates license headers
8888

89-
### Implementation Details
90-
The `generate.sh` script uses functions from the shared script at `scripts/protoc-generator.sh`:
91-
92-
- `install_dependencies`: Installs required protoc plugins
93-
- `go_protoc`: Generates Go code
94-
- `update_license`: Updates license headers in generated files
95-
9689
The Registry Facade API is relatively simple compared to other APIs, focusing primarily on defining the structure of image specifications rather than complex service interactions.
9790

9891
### Building After Code Generation

memory-bank/components/server.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The primary purposes of the Server component are:
2121

2222
The Server operates as an Express.js application with several key components:
2323

24-
1. **API Server**: Provides HTTP and WebSocket endpoints for client communication
24+
1. **API Server**: Provides HTTP and WebSocket endpoints for client communication. It also directly hosts and implements `gitpod.v1` gRPC services (defined in `.proto` files within `components/public-api/`) for programmatic access.
2525
2. **Authentication System**: Handles user authentication and session management
2626
3. **Database Interface**: Interacts with the database for persistent storage
2727
4. **WebSocket Manager**: Manages real-time communication with clients
@@ -40,6 +40,7 @@ The server is designed as a modular application using dependency injection (Inve
4040
- `src/auth/`: Authentication and authorization
4141
- `src/workspace/`: Workspace management
4242
- `src/user/`: User management
43+
- `src/orgs/`: Organization management
4344
- `src/prebuilds/`: Prebuild functionality
4445
- `src/billing/`: Billing and subscription management
4546
- `src/github/`, `src/gitlab/`, `src/bitbucket/`: SCM integrations
@@ -79,8 +80,9 @@ The Server is configured via environment variables and configuration files, incl
7980
The Server exposes multiple API endpoints:
8081

8182
1. **User API**: User management, authentication, and preferences
82-
2. **Workspace API**: Workspace creation, management, and access
83-
3. **SCM Integration APIs**: GitHub, GitLab, Bitbucket webhooks and OAuth
83+
2. **Organization API**: Handles organization creation, settings, member management, and administrative functions like maintenance mode.
84+
3. **Workspace API**: Workspace creation, management, and access
85+
4. **SCM Integration APIs**: GitHub, GitLab, Bitbucket webhooks and OAuth
8486
4. **Billing API**: Subscription and payment management
8587
5. **WebSocket API**: Real-time communication with clients
8688
6. **Health and Metrics API**: System health and monitoring
@@ -94,7 +96,7 @@ The Server supports multiple authentication methods:
9496
3. **OAuth Integration**: With GitHub, GitLab, Bitbucket, etc.
9597
4. **Personal Access Tokens**: For programmatic access
9698

97-
Authorization is handled through a combination of user roles, permissions, and access controls.
99+
Authorization is handled through a combination of user roles and permissions, leveraging SpiceDB for fine-grained access control checks within its service implementations (including for gRPC services).
98100

99101
## Integration Points
100102

0 commit comments

Comments
 (0)