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

bitter-island-28909

08/05/2019, 8:06 PM
Anyone have a pattern they like for installing database migrations to a database created by Pulumi? Right now I’m making an ECS task that runs my migration scripts, and a Pulumi Dynamic Resource to launch the task using the AWS CLI once the database is available. This is a lot of moving parts and rather gross.
b

boundless-monkey-50243

08/06/2019, 4:34 PM
If I have an application (and related database) whose deployment is being controlled by code, I generally roll my migrations into the application's startup.
b

bitter-island-28909

08/06/2019, 5:06 PM
yeah, I might end up going that route. There are several different client applications that rely on this DB though so I was hesitant to do that, but I guess I could always pick one of them to control the schema updates.
b

boundless-monkey-50243

08/07/2019, 12:23 AM
Your business, your rules, but my experience is that IaC without manual intervention only really works well when applications own their own datastores.
i.e., treating some apps as API-based clients
b

bitter-island-28909

08/07/2019, 1:49 AM
I get that pattern. I’m trying to adapt IoC to a more traditional one, where there is a well-regulated central database that is a “source of truth” for an array of different services and jobs. The “main” instance of this, of course, only needs to be set up once. The need to auto-provision it’s schema comes mostly from the desire to quickly spin up full instances of the entire system for development or integration testing.
b

boundless-monkey-50243

08/07/2019, 2:55 PM
Yeah, I get where you're coming from. Hell is legacy stuff, etc. 😉 The best way I've dealt with what you describe is to not have one arbitrary app control database migrations, but have a separate database migration service that is the canonical database mutation source.
b

bitter-island-28909

08/07/2019, 3:42 PM
Interestingly, this is a (fairly) new project: I chose a central DB to get away from my last few microservice-based projects that quickly turned into a rats nest. Also we’re in the finance sector so having something that’s 100% transactional by default gives me peace of mind.