I'm part of an initiative where we are moving monolithic-ish applications, each running on their separate VMs and using a common database cluster, to a container architecture with the goal of eventually breaking down all the monoliths to microservices.
A big part of the deployment is initially creating users and databases for the different applications that together make up the whole system. A typical (very simplified) deployment flow would be:
- Create the application instance (virtual machine)
- Create users, databases, tables, etc. in the database cluster (if needed)
- Start the application on the application VM
With some drawbacks to how we do the deployment this generally works fine. Step 2 is part of a framework that runs during instance deployment job where the application packaging provides information on what users to create etc.
Are there any typical approaches to deal with step 2 in a container environment?
My vague idea was something like this:
- Launch a short-lived "deployment" container that creates users, databases, etc. for the soon-to-be deployed application. This would probably be an image packaged by the application that inherits from the "deployment" container.
- Tear down the deployment container
- Deploy the application container(s).
Potentially I'm overthinking this; perhaps step 2 should just be a part of container deployment somehow but I feel like we'd want to decouple this from the application containers.