Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some ContainerExec experimentation. #6481

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mitchdenny
Copy link
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
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
Member

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
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
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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