Skip to content

Add UpdateComposeSource RPC for existing compose stacks - #7

Merged
igun997 merged 3 commits into
masterfrom
feat/update-compose-source
Aug 8, 2026
Merged

Add UpdateComposeSource RPC for existing compose stacks#7
igun997 merged 3 commits into
masterfrom
feat/update-compose-source

Conversation

@igun997

@igun997 igun997 commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Why

DeployCompose is intentionally create-only: it calls services.compose.createService first. A second call for an existing stack fails with the panel's Service already exists. before updateSourceInline can run. The CLI had an update path, but gRPC did not.

What changed

  • Add paas.PaaS/UpdateComposeSource.
    • Replaces inline compose content of an existing compose service.
    • Redeploys by default; skip_deploy stores content for batched changes.
    • Applies the same compose gate as DeployCompose: invalid YAML and network_mode: host rejected; host ports: removed; expose: retained.
    • Maps Easypanel's missing/wrong-type service response to gRPC NotFound.
  • Stop sending unused composeFile to services.compose.updateSourceInline; panel schema accepts only projectName, serviceName, content.
  • CLI services set-source-inline now documents and accepts 3 args. Legacy 4-arg form remains compatible and warns its compose-file argument is ignored.
  • README, deployment guide, CHANGELOG updated for v0.2.0.

Verification

  • make fmt-check
  • make vet
  • go build ./...
  • go test ./internal/... ./cmd/... -count=1
  • go test ./... -count=1 -timeout 25m — passed; includes live TestGRPC_UpdateComposeSourceE2E twice.

Live E2E asserts missing service maps to NotFound, DeployCompose still rejects an existing service, the new RPC replaces content and strips host ports, skip_deploy stores without deploy, and cleanup destroys the throwaway service.

Summary by CodeRabbit

  • New Features

    • Added support for updating existing Compose service content in place.
    • Compose updates now validate content, sanitize host ports, and optionally redeploy.
    • Added clear deployment status reporting and not-found handling.
    • Updated inline Compose CLI usage to support content without a filename while retaining legacy compatibility.
  • Documentation

    • Updated the README, deployment guide, and changelog for version 0.2.0 and the new Compose update workflow.
  • Bug Fixes

    • Improved Compose source replacement and deployment behavior.

igun997 added 2 commits August 8, 2026 20:34
DeployCompose calls services.compose.createService first, so the panel rejects
it with "Service already exists." before any content is written. There was no
way to replace the compose content of a running stack over gRPC, only via the
CLI's set-source-inline.

UpdateComposeSource writes the content and redeploys, running the same gate as
DeployCompose: invalid YAML and network_mode host are rejected, host-published
ports are stripped, expose is kept. A missing service, or one that exists under
a different type, maps to NotFound rather than a bare panel error, since the
panel answers NOT_FOUND for both. skip_deploy stores the content without
deploying so a caller can batch edits and deploy once.

Also drop composeFile from the updateSourceInline payload. The panel's schema
accepts only projectName, serviceName and content, and silently dropped the
extra field, so both the RPC and the CLI were sending a field that never
existed. services set-source-inline now takes 3 positional arguments; the old
4-argument form still works and warns that compose-file is ignored.
- CHANGELOG: v0.2.0 entry covering the new RPC, the dropped composeFile field
  and the set-source-inline argument change.
- Deployment guide: new "Update an existing Compose stack" section under the
  gRPC Compose chapter, with the exact DeployCompose error it works around and
  a field table. The CLI Compose chapter points at it.
- README: UpdateComposeSource in the RPC table, a grpcurl example, RPC count
  17, corrected set-source-inline usage.
- Bump documented image tags to 0.2.0.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@igun997, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cbb7e929-b7d2-4b35-ab5a-1f3540a7eeb8

📥 Commits

Reviewing files that changed from the base of the PR and between 4e94c4e and e0f140f.

📒 Files selected for processing (1)
  • grpc_e2e_test.go
📝 Walkthrough

Walkthrough

The PR adds UpdateComposeSource for validated replacement of existing Compose content. It supports optional deployment, maps missing services to NotFound, updates CLI argument compatibility, adds unit and end-to-end coverage, and documents the v0.2.0 behavior.

Changes

Compose source update

Layer / File(s) Summary
RPC contract and server flow
proto/paas.proto, internal/easypanel/client.go, internal/server/paas.go
Adds the UpdateComposeSource contract and server method. The method validates and sanitizes YAML, replaces existing content, maps missing services to NotFound, and returns stored or deploying status.
Inline Compose CLI compatibility
cmd/services.go
Accepts both three-argument and legacy four-argument set-source-inline calls. The legacy filename is ignored with a warning.
Server and end-to-end validation
internal/server/updatecomposesource_test.go, internal/server/panel_fake_test.go, internal/easypanel/version_test.go, grpc_e2e_test.go
Tests input validation, port sanitization, storage, deployment, missing services, deployment failures, not-found classification, and end-to-end replacement behavior.
Documentation and release updates
README.md, docs/deployment-guide.md, CHANGELOG.md
Documents Compose source replacement, deployment control, CLI syntax, not-found behavior, and v0.2.0 examples and release notes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant PaaSServer
  participant Easypanel
  Caller->>PaaSServer: UpdateComposeSource request
  PaaSServer->>PaaSServer: Validate and sanitize YAML
  PaaSServer->>Easypanel: Replace Compose source
  Easypanel-->>PaaSServer: Stored result or NOT_FOUND
  PaaSServer->>Easypanel: Redeploy when skip_deploy is false
  PaaSServer-->>Caller: Update response
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: adding the UpdateComposeSource RPC for existing Compose stacks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/update-compose-source

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@grpc_e2e_test.go`:
- Around line 639-651: Extend the Step 6 test after the existing skipDeploy
response assertions to read back the persisted compose source using the test’s
existing source retrieval mechanism. Assert that the returned content contains
“nginx:alpine” and no longer contains “httpd:alpine”, preserving the current
deployed=false/status=stored checks.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4022aa8a-be36-4f16-8f86-9d70d03cf1fd

📥 Commits

Reviewing files that changed from the base of the PR and between ad5fc63 and 4e94c4e.

⛔ Files ignored due to path filters (2)
  • proto/paas.pb.go is excluded by !**/*.pb.go
  • proto/paas_grpc.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (11)
  • CHANGELOG.md
  • README.md
  • cmd/services.go
  • docs/deployment-guide.md
  • grpc_e2e_test.go
  • internal/easypanel/client.go
  • internal/easypanel/version_test.go
  • internal/server/paas.go
  • internal/server/panel_fake_test.go
  • internal/server/updatecomposesource_test.go
  • proto/paas.proto

Comment thread grpc_e2e_test.go
@igun997
igun997 merged commit 1fd03af into master Aug 8, 2026
4 checks passed
@igun997
igun997 deleted the feat/update-compose-source branch August 8, 2026 13:44
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