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

feat: dev provisioner for postgres #2967

Merged
merged 7 commits into from
Oct 7, 2024
Merged

feat: dev provisioner for postgres #2967

merged 7 commits into from
Oct 7, 2024

Conversation

jvmakine
Copy link
Contributor

@jvmakine jvmakine commented Oct 3, 2024

This contains a bit of refactoring to remove unnecessary Provisioner interface, and use the plugin API directly for embedded provisioners.

We also extract SetupDB from ftl serve to start the docker image for postgres in the dev provisioner if it is not running.

Next, we should automatically inject the secrets to make the created DB actually usable.

@jvmakine jvmakine requested review from a team and alecthomas as code owners October 3, 2024 01:39
@jvmakine jvmakine requested review from a team and wesbillman and removed request for a team October 3, 2024 01:39
@github-actions github-actions bot changed the title dev provisioner for postgres feat: dev provisioner for postgres Oct 3, 2024
@ftl-robot ftl-robot mentioned this pull request Oct 3, 2024
@jvmakine jvmakine marked this pull request as draft October 3, 2024 02:00
resp, err := t.handler.Provision(ctx, connect.NewRequest(&provisioner.ProvisionRequest{
Module: t.module,
// TODO: We need a proper cluster specific ID here
FtlClusterId: "ftl",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is available in the ProjectConfig as "Realm"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 I might wire that in in a separate PR. That seems to be a bit of work to get in place properly.

backend/provisioner/deployment.go Show resolved Hide resolved
done atomic.Bool
}

// Provisioner is a provisioner for running FTL locally
Copy link
Collaborator

Choose a reason for hiding this comment

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

Glorious!

backend/provisioner/dev/dev_provisioner.go Outdated Show resolved Hide resolved
backend/provisioner/dev/dev_provisioner.go Show resolved Hide resolved
step := &step{resource: r.Resource}
task.steps = append(task.steps, step)

d.provisionPostgres(ctx, tr, req.Msg.Module, r.Resource.ResourceId, step)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this not return errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it stores the result to step which could include an error if the step failed.

backend/provisioner/dev/dev_provisioner.go Show resolved Hide resolved
backend/provisioner/dev/dev_provisioner.go Outdated Show resolved Hide resolved
backend/provisioner/dev/dev_provisioner.go Outdated Show resolved Hide resolved
@alecthomas
Copy link
Collaborator

Awesome, I'm really looking forward to this going in, it will make life so much nicer for users.

@jvmakine jvmakine force-pushed the juho/dev-provisioner branch from 540cd70 to 2c37798 Compare October 3, 2024 05:05
@jvmakine jvmakine force-pushed the juho/dev-provisioner branch 9 times, most recently from 0645135 to 842a530 Compare October 6, 2024 22:46
@jvmakine jvmakine force-pushed the juho/dev-provisioner branch from c8ff500 to 35a524c Compare October 6, 2024 23:27
@jvmakine jvmakine force-pushed the juho/dev-provisioner branch from a4e37df to ebf83e9 Compare October 6, 2024 23:55
@jvmakine jvmakine marked this pull request as ready for review October 6, 2024 23:56
@jvmakine jvmakine merged commit 5b59147 into main Oct 7, 2024
95 checks passed
@jvmakine jvmakine deleted the juho/dev-provisioner branch October 7, 2024 00:04
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.

2 participants