https://pulumi.com logo
#general
Title
# general
a

alert-lizard-82628

11/12/2018, 4:33 PM
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

creamy-potato-29402

11/12/2018, 6:58 PM
@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

alert-lizard-82628

11/12/2018, 7:11 PM
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

big-piano-35669

11/12/2018, 10:50 PM
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

colossal-beach-47527

11/12/2018, 11:05 PM
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

alert-lizard-82628

11/12/2018, 11:14 PM
Thanks Chris. Is this the
migrate
tool you're referring to? https://github.com/golang-migrate/migrate
m

microscopic-pilot-97530

11/13/2018, 5:46 PM
Yes, that’s the tool we use.
👍 1
6 Views