Situation: I'm working on a big startup web-project, which frequently goes to production, so all development is pretty fast. We have several environments - dev (local), QA, stage and production with different data in databases of course (we use postgres). My daily routine is that while I working on some new feature, some QA person can find a critical bug on one of these environments so I have to fix it, or at least look what is wrong.
Problem: to switch from local context to production/qa/stage, I usually dump database from these environments locally and then do the debugging. The problem is that, at first, dumps are very heavy and it takes sometimes up to 30 minutes to download and apply it, at second - when I dump it into local database, I'm loosing my local development context.
Wish: being able to switch contexts locally fast
Example: lets say we have docker container for web server, which is linked to postgres container like in this sample docker-compose.yml
file
version: '3'
services:
pg:
image: "mdillon/postgis"
hostname: pghost
ports:
- "5433:5432"
volumes:
- "~/pgdata:/var/lib/postgresql/data"
...
webserver:
image: "some_app_image"
links:
- pg:postgres
...
And lets pretend that this web-server is really heavy so that to have multiple running containers with this would be a big problem in terms of memory usage and readability.
Question: is there any elegant (or not) way to make fast switch between different database data sets? maybe have different pgdata folders, or somehow link several postgres containers (though I'm not sure it is possible)