name: Issue #6 persist database as a Docker volume
about: create a persistent database via a Docker volume
IMPORTANT: Please do not create a Pull Request without creating an issue first.
What does this do and why?
This is a revised fix for Issue #6. We have database persistence in the master branch but it was done with a host directory in the repository mounted into the database container. This causes data corrupution if someone accidentally or deliberately changes that directory.
See issue #6
Additional notes for reviewers
None
Pre-Review Tasks
Place an ‘x’ between the brackets.
[ ] I wrote tests covering these changes
[x] I reviewed my own PR before asking for review from others
[x] I added PR comments providing additional context for reviewers where appropriate, or calling attention to especially sensitive changes.
[x] If deps were added, I verified the licenses / no dependencies
Verification steps
docker-compose up -d --build. This creates the images and containers.
docker logs pandaid-api_web_1. This shows what the web server did to create the database.
Verify that the API comes up on <localhost:8000]>.
docker-compose down. This stops and deletes the containers and the network.
docker volume list. This will list the volume pandaid-api_postgresql-data.
docker-compose up -d. This creates a new network and containers.
docker logs pandaid-api_web_1 again. Note that the web server did not have to re-create the database.
Verify that the API still comes up on <localhost:8000>.
name: Issue #6 persist database as a Docker volume about: create a persistent database via a Docker volume
IMPORTANT: Please do not create a Pull Request without creating an issue first.
What does this do and why?
This is a revised fix for Issue #6. We have database persistence in the
master
branch but it was done with a host directory in the repository mounted into the database container. This causes data corrupution if someone accidentally or deliberately changes that directory.See issue #6
Additional notes for reviewers
None
Pre-Review Tasks
Place an ‘x’ between the brackets.
[ ] I wrote tests covering these changes
[x] I reviewed my own PR before asking for review from others
[x] I added PR comments providing additional context for reviewers where appropriate, or calling attention to especially sensitive changes.
[x] If deps were added, I verified the licenses / no dependencies
Verification steps
docker-compose up -d --build
. This creates the images and containers.docker logs pandaid-api_web_1
. This shows what the web server did to create the database.<localhost:8000]>
.docker-compose down
. This stops and deletes the containers and the network.docker volume list
. This will list the volumepandaid-api_postgresql-data
.docker-compose up -d
. This creates a new network and containers.docker logs pandaid-api_web_1
again. Note that the web server did not have to re-create the database.<localhost:8000>
.