Hi, I have a general question about Pulumi and rel...
# general
a
Hi, I have a general question about Pulumi and relational databases. So, Pulumi is pretty great at creating empty relational databases in the cloud (AWS RDS, Azure SQL DB, etc.). There are some handy examples of that in the pulumi/examples repo. But most of the time I also need to populate that database (with schemas and data) before it’s useful to my application. At the moment I’m just restoring the contents of my database manually outside of Pulumi, but there’s gotta be a better way. Is anyone aware of a good workflow for deploying relational database schema+data to a Pulumi stack?
👍 1
c
@alert-lizard-82628 this is an interesting use case. Do you have an idea of approximately what experience you’d like?
I’ve thought a lot about problems like this in pulumi’s model of persistent volumes.
a
Just spitballing, but: it would be nice if I could point Pulumi at a database backup file on disk (say a .bak file for SQL Server) and Pulumi would restore from the backup once the empty database is up+running on Azure
b
We have a work item tracking better workflows here: https://github.com/pulumi/pulumi/issues/127. In our own CD pipeline, we do schema migrations as part of the Pulumi deployments (@colossal-beach-47527 can comment on this). We definitely want you to be able to do this sort of thing from within the system, rather than manual steps outside of it.
👍 1
c
The “create database and seed with this backup” is a really good feature idea, definitely 👍🏽 . As far as the “regular care and maintenance” aspect, we use the
migrate
tool[1] before we run
pulumi update
, to run any schema migrations before we update the app. We haven’t done the work to run
migrate
as part of the Pulumi program executed during
pulumi update
. But it should just be a matter of using the Node APIs to start a new process. (And then wrapping and exposing it as some friendly NPM package.)
a
Thanks Chris. Is this the
migrate
tool you're referring to? https://github.com/golang-migrate/migrate
m
Yes, that’s the tool we use.
👍 1