# @serve.zone/gitops A unified dashboard for managing Gitea and GitLab instances β€” browse projects, manage secrets, monitor CI/CD pipelines, stream build logs, and receive webhook notifications, all from a single app. ## Issue Reporting and Security For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly. ## πŸš€ Features - **Multi-Provider** β€” Connect to Gitea and GitLab simultaneously via a unified provider abstraction - **Secrets Management** β€” View, create, update, and delete CI/CD secrets across projects and groups - **Pipeline Monitoring** β€” Browse pipelines, view jobs, retry failed builds, cancel running ones - **Build Log Streaming** β€” Fetch and display raw job logs with monospace rendering - **Webhook Integration** β€” Receive push/PR/pipeline events via `POST /webhook/:connectionId` and broadcast to all connected clients in real-time via WebSocket - **Secrets Cache & Scanning** β€” Background scan service fetches and caches all secrets every 24h with upsert-based deduplication - **Secure Token Storage** β€” Connection tokens stored in OS keychain via `@push.rocks/smartsecret` (encrypted file fallback), never in plaintext on disk - **Auto-Refresh** β€” Frontend polls for updates every 30s, with manual refresh available on every view - **Embedded SPA** β€” Frontend is bundled (base64-encoded) and served from memory, no static file server needed ## πŸ“¦ Install ### Prerequisites - [Deno](https://deno.land/) v2+ - [pnpm](https://pnpm.io/) (for frontend deps and bundling) - MongoDB-compatible database (auto-provisioned via `@push.rocks/smartmongo` / `LocalTsmDb`) ### Setup ```bash # Clone the repository git clone https://code.foss.global/serve.zone/gitops.git cd gitops # Install frontend dependencies pnpm install # Build the frontend bundle pnpm build # Start the server deno run --allow-all mod.ts server ``` The app will be available at `http://localhost:3000`. ## βš™οΈ Configuration All configuration is done through environment variables: | Variable | Default | Description | |---|---|---| | `GITOPS_PORT` | `3000` | HTTP/WebSocket server port | | `GITOPS_ADMIN_USERNAME` | `admin` | Admin login username | | `GITOPS_ADMIN_PASSWORD` | `admin` | Admin login password | Data is stored at `~/.serve.zone/gitops/`: ``` ~/.serve.zone/gitops/ β”œβ”€β”€ storage/ # Connection configs (JSON, tokens replaced with keychain refs) β”‚ └── connections/ # One file per connection └── tsmdb/ # Embedded MongoDB data (cached secrets, projects) ``` ## πŸ—οΈ Architecture ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ GitOps App β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ OpsServerβ”‚ ConnectionMgr β”‚ SecretsScanService β”‚ β”‚ (HTTP/WS)β”‚ (Providers) β”‚ (24h background scan) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Handlers β”‚ GiteaProviderβ”‚ CacheDb β”‚ β”‚ (9 total)β”‚ GitLabProviderβ”‚ (LocalTsmDb + SmartdataDb)β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ StorageManager β”‚ β”‚ (filesystem key-value store) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ SmartSecret β”‚ β”‚ (OS keychain / encrypted file) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Frontend SPA β”‚ β”‚ Lit + dees-catalog + smartstate β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Dashboard β”‚ 8 Views β”‚ WebSocket Client β”‚ Auto-Refreshβ”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### Backend (`ts/`) - **`GitopsApp`** β€” Main orchestrator. Owns all subsystems, handles startup/shutdown lifecycle. - **`ConnectionManager`** β€” CRUD for provider connections. Tokens secured in OS keychain. Background health checks on startup. - **`BaseProvider`** β†’ **`GiteaProvider`** / **`GitLabProvider`** β€” Unified interface over both APIs (projects, groups, secrets, pipelines, jobs, logs). - **`OpsServer`** β€” TypedServer-based HTTP/WebSocket server with 9 handler modules: - `AdminHandler` β€” JWT-based auth (login/logout/verify) - `ConnectionsHandler` β€” Connection CRUD + test - `ProjectsHandler` / `GroupsHandler` β€” Browse repos and orgs - `SecretsHandler` β€” Cache-first secret CRUD - `PipelinesHandler` β€” Pipeline list/jobs/retry/cancel - `LogsHandler` β€” Job log fetch - `WebhookHandler` β€” Custom HTTP route for incoming webhooks - `ActionsHandler` β€” Force scan / scan status - **`SecretsScanService`** β€” Background scanner with upsert-based deduplication. Runs on startup and every 24h. - **`CacheDb`** β€” Embedded MongoDB via `LocalTsmDb` + `SmartdataDb`. TTL-based expiration with periodic cleanup. - **`StorageManager`** β€” Filesystem-backed key-value store with atomic writes. ### Frontend (`ts_web/`) - Built with [Lit](https://lit.dev/) web components and [@design.estate/dees-catalog](https://code.foss.global/design.estate/dees-catalog) UI library - Reactive state management via `smartstate` (4 state parts: login, connections, data, UI) - 8 tabbed views: Overview, Connections, Projects, Groups, Secrets, Pipelines, Build Log, Actions - WebSocket client for real-time webhook push notifications - Bundled to `ts_bundled/bundle.ts` via `@git.zone/tsbundle` (base64-encoded, committed to git) ### Shared Types (`ts_interfaces/`) - `data/` β€” Data models (`IProject`, `ISecret`, `IPipeline`, `IIdentity`, etc.) - `requests/` β€” TypedRequest interfaces for all RPC endpoints ## πŸ”Œ API All endpoints use [TypedRequest](https://code.foss.global/api.global/typedrequest) β€” a typed RPC protocol over HTTP POST to `/typedrequest`. ### Authentication ```typescript // Login β†’ returns JWT identity { method: 'adminLogin', request: { username, password } } // β†’ { identity: { jwt, userId, role, expiresAt } } // All other requests require identity { method: 'getProjects', request: { identity, connectionId } } ``` ### Connections | Method | Description | |---|---| | `getConnections` | List all connections (tokens masked) | | `createConnection` | Add a new Gitea/GitLab connection | | `updateConnection` | Update connection name/URL/token | | `testConnection` | Verify connection is reachable | | `deleteConnection` | Remove a connection | ### Data | Method | Description | |---|---| | `getProjects` | List projects (with search/pagination) | | `getGroups` | List groups/orgs (with search/pagination) | | `getAllSecrets` | Get all secrets for a connection+scope (cache-first) | | `getSecrets` | Get secrets for a specific entity (cache-first) | | `createSecret` / `updateSecret` / `deleteSecret` | Secret CRUD | | `getPipelines` | List pipelines for a project | | `getPipelineJobs` | List jobs for a pipeline | | `retryPipeline` / `cancelPipeline` | Pipeline actions | | `getJobLog` | Fetch raw build log for a job | ### Actions | Method | Description | |---|---| | `forceScanSecrets` | Trigger immediate full secrets scan | | `getScanStatus` | Get scan status, last result, timestamp | ### Webhooks ```bash # Register this URL in your Gitea/GitLab webhook settings POST http://your-server:3000/webhook/ ``` Events are parsed from `X-Gitea-Event` / `X-Gitlab-Event` headers and broadcast to all connected WebSocket clients as `webhookNotification`. ## πŸ§ͺ Development ```bash # Watch mode β€” auto-rebuilds frontend + restarts backend on changes pnpm run watch # Run tests (Deno) pnpm test # Build frontend bundle only pnpm build # Start server directly deno run --allow-all mod.ts server ``` ### Project Structure ``` gitops/ β”œβ”€β”€ mod.ts # Entry point β”œβ”€β”€ deno.json # Deno config + import map β”œβ”€β”€ package.json # npm metadata + scripts β”œβ”€β”€ npmextra.json # tsbundle + tswatch config β”œβ”€β”€ html/index.html # HTML shell β”œβ”€β”€ ts/ # Backend β”‚ β”œβ”€β”€ classes/ # GitopsApp, ConnectionManager β”‚ β”œβ”€β”€ providers/ # BaseProvider, GiteaProvider, GitLabProvider β”‚ β”œβ”€β”€ storage/ # StorageManager β”‚ β”œβ”€β”€ cache/ # CacheDb, CacheCleaner, SecretsScanService β”‚ β”‚ └── documents/ # CachedProject, CachedSecret β”‚ └── opsserver/ # OpsServer + 9 handlers β”‚ β”œβ”€β”€ handlers/ # AdminHandler, SecretsHandler, etc. β”‚ └── helpers/ # Guards (JWT verification) β”œβ”€β”€ ts_interfaces/ # Shared TypeScript types β”‚ β”œβ”€β”€ data/ # IProject, ISecret, IPipeline, etc. β”‚ └── requests/ # TypedRequest interfaces β”œβ”€β”€ ts_web/ # Frontend SPA β”‚ β”œβ”€β”€ appstate.ts # Smartstate store + actions β”‚ └── elements/ # Lit web components β”‚ └── views/ # 8 view components β”œβ”€β”€ ts_bundled/bundle.ts # Embedded frontend (base64, committed) └── test/ # Deno tests ``` ## License and Legal Information This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file. **Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file. ### Trademarks This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar. ### Company Information Task Venture Capital GmbH Registered at District Court Bremen HRB 35230 HB, Germany For any legal inquiries or further information, please contact us via email at hello@task.vc. By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.