Skip to content

Some ContainerExec experimentation.#6481

Closed
mitchdenny wants to merge 1 commit intomainfrom
mitchdenny/container-exec-experimentation
Closed

Some ContainerExec experimentation.#6481
mitchdenny wants to merge 1 commit intomainfrom
mitchdenny/container-exec-experimentation

Conversation

@mitchdenny
Copy link
Copy Markdown
Member

@mitchdenny mitchdenny commented Oct 24, 2024

Something to look at post 9.0.

This is just a draft PR for some discussion. In the DCP types we have ContainerExec. It allows us to invoke a command against an existing container. I'm thinking it might enable us to do things like run backup/restore commands inside container images.

This would allow for some interesting advanced scenarios such as triggering a backup/restore of a postgres database using something like pg_dump within the container (the file would be copied to a databindmount.

@danegsta @karolz-ms @DamianEdwards @davidfowl @drewnoakes @JamesNK @adamint

Microsoft Reviewers: Open in CodeFlow

@mitchdenny mitchdenny added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 24, 2024
@mitchdenny
Copy link
Copy Markdown
Member Author

I should note that PgAdmin allows you to backup and restore databases but the idea here is that you could do things like automate the restore of a database from a known baseline.

var databases = e.Model.Resources.OfType<IResourceWithParent<PostgresServerResource>>().Where(r => r.Parent == builder.Resource).ToList();
foreach (var db in databases)
{
var dbBuilder = builder.ApplicationBuilder.CreateResourceBuilder(db);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This super late model of mutating the resource builder is pretty broken... you know how I feel about this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is BeforeStart. Not late at all.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is. At this point you should be adding the annotation directly.

@mitchdenny mitchdenny closed this Nov 22, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 22, 2024
@mitchdenny mitchdenny deleted the mitchdenny/container-exec-experimentation branch March 5, 2025 03:32
@github-actions github-actions Bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Mar 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants