Skip to content

Bugs fixes - #45

Merged
Lftobs merged 53 commits into
devfrom
bugs-fixes
Sep 5, 2026
Merged

Bugs fixes#45
Lftobs merged 53 commits into
devfrom
bugs-fixes

Conversation

@Lftobs

@Lftobs Lftobs commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added Docker Compose deployment support for remote servers, including service routing and teardown.
    • Added settings for API keys, GitHub integration, SMTP, server management, and project deletion.
    • Added a “Connect GitHub” action when repository loading fails.
    • Added support for managing multiple Compose service routes and domains.
  • Bug Fixes

    • Improved validation and handling of invalid domain and route configurations.
    • GitHub sessions are now securely persisted across restarts.
  • Release

    • Promoted the project from release candidate 0.3.0-rc.8 to stable version 0.3.0.

Lftobs added 30 commits August 13, 2026 03:16
- Add `apps/agent` for remote deployment
  orchestration
- Implement agent-server P2P protocol with
  heartbeat, job leasing, and task execution
- Add WireGuard tunneling support for
  agent-to-server connectivity
- Extend API to support agent registration, job
  queuing, and status sync
- Update UI to allow selecting deployment targets
  for projects
- Add database migrations for agent foundations,
  credentials, and job state management
failover

- Implement `prepare` service for remote SSH and
  Agent server setup.
- Add `failoverProject` logic to automatically
  redeploy projects when servers become
  unreachable.
- Introduce `routes` database table and ingress
  routing management.
- Add `platform_settings` table to track ingress
  server configuration.
- Update Docker Compose to support configurable
  profiles (default: control-plane).
Update Caddy and database utilities to accept
dependencies via options,
enabling synchronous file system access and easier
mocking in tests.
…rch-scaling-eng

# Conflicts:
#	.gitignore
#	apps/agent/src/config.ts
#	apps/agent/src/executor.test.ts
#	apps/agent/src/executor.ts
#	apps/agent/src/protocol.ts
#	apps/agent/src/stats.ts
#	apps/api/src/agents/deployments.ts
#	apps/api/src/agents/job-channel.ts
#	apps/api/src/agents/protocol.ts
#	apps/api/src/agents/stats-cache.ts
#	apps/api/src/api/deployments/index.ts
#	apps/api/src/api/projects/index.ts
#	apps/api/src/api/servers/index.ts
#	apps/api/src/db/migrations/meta/_journal.json
#	apps/api/src/db/repo/servers.ts
#	apps/api/src/db/schema.ts
#	apps/api/src/executors/__tests__/dispatch.test.ts
#	apps/api/src/executors/agent.ts
#	apps/api/src/executors/ssh.ts
#	apps/api/src/orchestrator/runtime.ts
#	apps/api/src/servers/manager.ts
#	apps/web/src/routes/Settings.tsx
#	apps/web/src/types/index.ts
- Update Drizzle configuration and schema to
  PostgreSQL
- Replace `bun:sqlite` with `pg` and
  `drizzle-orm/node-postgres`
- Update migrations to use PostgreSQL syntax
- Reorganize test infrastructure to support
  Postgres pools
- Update configuration to use `DATABASE_URL`
  instead of `DATABASE_PATH`
- Replace SQLite with PostgreSQL
- Introduce `deployment_events` table for tracking
- Add event repository
- Update migration runner to handle existing
  tables
- Update docker-compose and test configurations
external runners

Move complex database-dependent tests to
standalone runners to ensure
proper environment setup, and update repository
and orchestrator logic
to support required operations.
improve stability

- Introduce `docker_tcp` server mode
- Add timeout configurations for SSH and API
  operations
- Enhance WireGuard tunnel recovery logic
- Improve agent registration error handling and
  stats validation
- Update server preparation and scaling engine for
  better compatibility
update release pipeline

- Introduce standardized `ApiResponse` type and
  helper functions (`ok`, `created`, `fail`)
- Update API routes to use new response wrappers
- Update CI workflow to support pre-release
  tagging and image naming
- Enhance CLI `update` and `install` scripts to
  support pre-release versions
- Add `.env.example` for better configuration
  management
- Enhance database security with generated
  passwords and improved URL handling
- Update `rerenderAllIngressRoutes` to prevent
  unnecessary route syncing
- Fix race conditions in `AgentStatsCache` and
  `domains-status-runner`
- Improve database connection management in tests
  and migrations
- Add `isPrivateGitUrl` utility for improved
  security validation
- Fix secure cookie blocking HTTP login (derive from X-Forwarded-Proto)
- Add getCaddyContainer function for Caddy reload
- Add missing DB migration for ssh_key/ssh_password columns
- Document E2E test findings
- Added 5s AbortController timeout to request-logs Loki fetch to prevent infinite loading
- Changed LogsTab default from 'request' to 'runtime' since request logs require Loki
The monitoring stack (Loki, Promtail, Grafana, Prometheus, cAdvisor) is
required for request logs to work. Profiles added complexity and broke
features silently when the default excluded monitoring.

- Remove profiles: ['monitoring'] from cadvisor, prometheus, loki, promtail, grafana
- Remove profile logic from dequel CLI and install.sh
- Update docs to reflect simplified setup
- All services now start with 'dequel start' or 'docker compose up -d'
- Textarea for pasting PEM private key content
- Key shown in server table as [key] indicator
- API already supports sshKey field, UI was missing it
- Add ssh_key_iv and ssh_key_tag columns to servers table
- Encrypt sshKey with AES-256-GCM before storing in database
- Decrypt on read in mapServer and listServerConnections
- Uses existing encryptValue/decryptValue from crypto.ts
- Migration: 0003_add_server_ssh_key_encryption.sql
Lftobs added 16 commits August 29, 2026 18:45
…start

- dequel update vX.Y.Z-rc.N | --rc | --pre | --pre-release targets
- pull images before recreating only api/web (deployed apps untouched)
- graceful caddy reload applies new Caddyfile without dropped traffic
- health check after update with rollback hint
Remove hardcoded default email and update base
domain handling to support
flexible deployment environments.
- New ssh-compose-script.ts: bash script generator, result parser, destroy script
- SSH executor now checks buildType and branches to compose path
- Full ingress routing: worker Caddy gets :80 listener, control plane gets hostname route
- Compose-aware destroy and rollback rejection
Worker Caddy only exposes port 80 via Docker. Hostname-only routes
(open-saas-openship.intrep.xyz { }) default to HTTPS (port 443) which
is unreachable. Append :80 to all domains in each route block when
viaIngress is true, so Caddy creates a single HTTP server that can
match on hostname. This fixes multi-project routing on workers where
Superteam's catch-all :80 route was winning over hostname-specific
routes.

Also moved ingress detection before snippet generation for cleaner
control flow.
Add BUILD_TIME build arg and scope cache per image per commit.
This prevents stale layer reuse when only source files change
between tag pushes.
Previously, deployComposeRemote() only created one ingress route on the
control plane Caddy for the primary hostname. Subdomains like
api.{slug}.{domain} had Caddy blocks on the worker but no matching
route on the control plane, so external traffic to those subdomains
never reached the worker.

- Add computeComposeIngressHostnames() to compute all ingress hostnames
  for a compose stack (primary + subdomains), excluding DB services
- Add syncComposeIngressRoutes() and removeComposeIngressRoutes() to
  manage per-subdomain route files on the control plane
- Add listRoutesByDeployment() query for cleanup
- Modify deployComposeRemote() to create routes for all subdomains
- Modify destroy() to clean up all subdomain route files from both
  worker and control plane
Non-primary services without custom mappings (e.g. 'server' when no
composeServicesJson is configured) were excluded from webServices,
causing computeComposeIngressHostnames to only see the primary service
and produce no subdomain routes.
…routes

The remote compose script now outputs port mappings via
docker compose ps --format '{{.Service}}|{{.Name}}|{{.Ports}}'.
parseRemoteComposeResult extracts the host port from each service.
The webServices array now uses these parsed ports for Caddy reverse
proxy configuration, ensuring routes point to the correct container
port (e.g. server:3001 instead of server:3000).
The regex now captures group 2 (container port) instead of group 1
(host port) from docker compose ps port output like
'0.0.0.0:32793->3001/tcp'. Caddy runs on the same Docker network
and needs the container-internal port to connect.
- buildCaddySnippet now falls back to slug.baseDomain if defaultDomains
  is empty, preventing catch-all :80 blocks
- deployComposeRemote adds a safety check: if the generated snippet
  starts with ':' (empty domain), it rebuilds with slug.baseDomain
- Fixes superteam catch-all :80 overriding specific hostname routes
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 79680b28-7bc7-4b52-bf4f-22d8999315b3

📥 Commits

Reviewing files that changed from the base of the PR and between fe80e96 and 430384e.

📒 Files selected for processing (38)
  • .github/workflows/release.yml
  • .gitignore
  • VERSION
  • apps/agent/Dockerfile
  • apps/agent/package.json
  • apps/agent/src/config.ts
  • apps/agent/src/executor.ts
  • apps/agent/src/protocol.ts
  • apps/agent/src/stats.ts
  • apps/api/Dockerfile
  • apps/api/package.json
  • apps/api/src/agents/job-channel.ts
  • apps/api/src/agents/stats-cache.ts
  • apps/api/src/api/github/index.ts
  • apps/api/src/db/migrations/0021_add_github_sessions.sql
  • apps/api/src/db/repo/github-sessions.ts
  • apps/api/src/db/repo/index.ts
  • apps/api/src/db/repo/routes.ts
  • apps/api/src/db/schema.ts
  • apps/api/src/executors/agent.ts
  • apps/api/src/executors/ssh-compose-script.ts
  • apps/api/src/executors/ssh.ts
  • apps/api/src/utils/compose-ingress.ts
  • apps/api/src/utils/domain-verifier.ts
  • apps/api/src/utils/ssh.ts
  • apps/api/src/utils/validate.ts
  • apps/docs/package.json
  • apps/web/Dockerfile
  • apps/web/package.json
  • apps/web/src/components/github/RepoPicker.tsx
  • apps/web/src/components/project/create/SourceSelectionSection.tsx
  • apps/web/src/components/settings/ApiKeysSection.tsx
  • apps/web/src/components/settings/DeleteProjectsSection.tsx
  • apps/web/src/components/settings/GithubIntegrationSection.tsx
  • apps/web/src/components/settings/ServersSection.tsx
  • apps/web/src/components/settings/SmtpSection.tsx
  • apps/web/src/routes/Settings.tsx
  • infra/caddy/Caddyfile

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

The release becomes stable and adds scoped image builds. The API adds encrypted GitHub session storage and remote Docker Compose deployment. The web adds settings management screens. Ingress and Caddy configuration now support Compose services and reject bare port domains.

Changes

Release and deployment platform

Layer / File(s) Summary
Release packaging and image builds
.github/workflows/release.yml, .gitignore, VERSION, apps/*/Dockerfile, apps/*/package.json
Stable version metadata, BUILD_TIME arguments, scoped Buildx caches, Docker Compose tooling, esbuild packages, and ignore rules are updated.
Database-backed GitHub sessions
apps/api/src/api/github/index.ts, apps/api/src/db/migrations/..., apps/api/src/db/repo/*, apps/api/src/db/schema.ts
GitHub sessions move from file persistence to encrypted database rows. OAuth creation, lookup, validation cleanup, and disconnect now use asynchronous repository functions.
Remote Compose script execution
apps/api/src/executors/ssh-compose-script.ts, apps/api/src/executors/ssh.ts
The API generates remote Compose scripts, starts and parses Compose projects, and generates destroy scripts.
Compose ingress and route validation
apps/api/src/utils/compose-ingress.ts, apps/api/src/utils/domain-verifier.ts, apps/api/src/utils/ssh.ts, apps/api/src/utils/validate.ts, infra/caddy/Caddyfile
Compose services receive ingress hostnames and routes. Bare port domains are rejected. Caddy host and logging directives are updated.
Compose deployment lifecycle
apps/api/src/executors/ssh.ts, apps/api/src/db/repo/routes.ts, apps/api/src/db/schema.ts
Compose deployments use a dedicated deploy path, reject rollback, destroy Compose projects, remove all deployment routes, and cascade deployment log deletion.
Settings and GitHub connection screens
apps/web/src/components/settings/*, apps/web/src/components/github/RepoPicker.tsx, apps/web/src/components/project/create/SourceSelectionSection.tsx, apps/web/src/routes/Settings.tsx
Settings sections are split into components for servers, SMTP, GitHub integration, API keys, and project deletion. Repository errors can display a GitHub connection action.
Formatting-only edits
apps/agent/src/*, apps/api/src/agents/*, apps/api/src/executors/agent.ts, apps/api/src/executors/ssh.ts
Several source changes only reformat or relocate existing declarations without changing behavior.

Estimated code review effort: 5 (Critical) | ~90+ minutes

Sequence Diagram(s)

sequenceDiagram
  participant SSHExecutor
  participant RemoteHost
  participant DockerCompose
  participant RouteStore
  SSHExecutor->>RemoteHost: Run generated Compose script
  RemoteHost->>DockerCompose: Build and start deployment
  DockerCompose-->>RemoteHost: Return containers and ports
  RemoteHost-->>SSHExecutor: Return parsed Compose result
  SSHExecutor->>RouteStore: Upsert service ingress routes
  SSHExecutor->>RemoteHost: Write Caddy routes
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugs-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Lftobs
Lftobs changed the base branch from dev to feat/multi-servers September 3, 2026 12:55
@Lftobs
Lftobs changed the base branch from feat/multi-servers to pg-migration September 3, 2026 12:56
@Lftobs
Lftobs changed the base branch from pg-migration to dev September 3, 2026 12:56
When GitHub OAuth sessions are lost (e.g. API restart), the RepoPicker
now shows a 'Connect GitHub' button alongside 'Retry' so users can
re-authenticate without manually navigating to the OAuth URL.

Also passes onConnectGithub from SourceSelectionSection to RepoPicker.
Replace in-memory file-based GitHub sessions with encrypted DB storage.
Sessions survive API container restarts. Uses the same encryptValue/
decryptValue pattern as env vars and SSH keys.
@Lftobs
Lftobs marked this pull request as ready for review September 5, 2026 14:59
@Lftobs
Lftobs merged commit 506bb22 into dev Sep 5, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant