feat: restart dependent services on project-level service restart#3103
Open
pkoutsovasilis wants to merge 6 commits into
Open
feat: restart dependent services on project-level service restart#3103pkoutsovasilis wants to merge 6 commits into
pkoutsovasilis wants to merge 6 commits into
Conversation
kmendell
reviewed
Jul 1, 2026
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can stay up-to-date and reviewed. |
…es_restart # Conflicts: # frontend/src/routes/(app)/projects/components/ProjectContainersTable.svelte
kmendell
requested changes
Jul 3, 2026
| EnvironmentID string `path:"id" doc:"Environment ID"` | ||
| ProjectID string `path:"projectId" doc:"Project ID"` | ||
| Body *struct { | ||
| Services []string `json:"services,omitempty" doc:"Service names to restart; empty restarts all services"` |
Member
There was a problem hiding this comment.
I think instead of a Body we should just use a direct paramters of `
Services []string `json:"services,omitempty" doc:"Service names to restart; empty restarts all services"`
| } | ||
|
|
||
| func (s *ProjectService) RestartProject(ctx context.Context, projectID string, user models.User) error { | ||
| return s.RestartProjectServices(ctx, projectID, nil, user) |
Member
There was a problem hiding this comment.
I would just make one function for restarts, and in corperate logic if services isnt nil then restart only those
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can stay up-to-date and reviewed. |
…es_restart # Conflicts: # backend/internal/services/project_service.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
mainbranchm.*())What This PR Implements
What This PR Implements
Makes a per-service restart within a Compose project mirror
docker compose restart <service>: it restarts the targeted service and every service that declaresdepends_on: { <svc>: { restart: true } }on it, in dependency order - instead of doing a raw single-container restart that left dependents running against a service that just restarted underneath them.The per-service restart on the project detail page now routes through the project restart endpoint (the Compose engine) rather than a direct container restart. Restarting a container from the Containers screen is unchanged and still performs a plain container restart.
Addresses: #2935
Changes Made
Backend
pkg/projects/cmds.go-ComposeRestartnow passes the loadedProjectintoapi.RestartOptions, so the Compose engine resolves the dependency graph from the authoritative compose file and applies itsIncludeDependentsresolution (restart +restart:truedependents), matching the CLI.internal/services/project_service.go-RestartProject(projectID, services, user)is now a single function: an emptyserviceslist restarts the whole project; a non-empty list restarts the named services (and theirrestart:truedependents).api/handlers/projects.go-POST /environments/{id}/projects/{projectId}/restartaccepts an optional repeatableservicesquery parameter (?services=web&services=db) routed toRestartProject(no new endpoint; backward compatible - noservices= restart whole project).Frontend
lib/services/project-service.ts-restartProject(projectId, services?)sends the optional services as repeatedservicesquery params (URLSearchParams) and returns the response so the activity toast can link the resulting activity.routes/(app)/projects/components/ProjectContainersTable.svelte- the per-row service restart now callsprojectService.restartProject(projectId, [serviceName])(with the standard spinner/toast/refresh handling) instead of a container restart. The action is gated onprojects:restartto match the backend route'sPermProjectsRestart, and reuses the sharedContainerActionMenuItem.Testing Done
go build ./...,go vet, andgo testforinternal/services,api/handlers,pkg/projects, andpkg/libarcane/edge- all pass.pnpm check(touched files clean) andpnpm buildsucceed; Prettier formatting applied.depends_on: { <svc>: { restart: true } }), restarting the depended-on service from the project page restarted the dependent service(s) as well - matchingdocker compose restart <service>.AI Tool Used (if applicable)
Claude Code (Anthropic, Opus 4.8)
Additional Context
Disclaimer Greptiles Reviews use AI, make sure to check over its work.
To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike
To have Greptile Re-Review the changes, mention
greptileai.Greptile Summary
This PR makes project-page service restarts use the Compose project restart flow. The main changes are:
RestartProjectServicesfor targeted service restarts, with empty service lists restarting the whole project.servicesbody.Confidence Score: 4/5
The change is mostly contained, with one authorization mismatch on the changed service restart UI path.
The backend restart flow appears coherent, but the frontend action uses the project restart API while retaining the container permission gate.
frontend/src/routes/(app)/projects/components/ProjectContainersTable.svelte
What T-Rex did
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat: restart dependent services on proj..." | Re-trigger Greptile