Closed brandonbarry123 closed 4 years ago
Note if this warning is shown when running docker-compose commands
WARNING: Service "asrg-db" is using volume "/var/lib/postgresql/data" from the previous container. Host mapping "/home/bogdan/projects/asrg/asrg.io/member-portal/django-dashboard-coreui/db_backup" has no effect. Remove the existing containers (with `docker-compose rm asrg-db`)
after compose, db_backup
folder should contain an asrg
folder
>ls -lah db_backup/
total 12
drwxr-xr-x 3 root root 4096 Nov 4 17:51 ./
drwxrwxrwx 12 bogdan bogdan 4096 Nov 4 17:44 ../
drwx------ 19 999 root 4096 Nov 4 17:51 asrg/
! Be careful not to push this folder to master when you make your commits, db_backup/
is added to gitignore files if it does not work for you, you might need to run the following command to update the changes in .gitignore
:
git rm -r --cached .
git add .
Done.
We need to address the following challenges:
1) Developers would like the database to remain through multiple docker builds/deploys.
2) Need the database to remain in production (i.e. push an update and not refresh the database). In addition, we need to hold a COPY of the database (offsite - in a "storage account).
3) Mounting directory from host inside of Docker container behaves oddly on Windows.
Solution:
Instead of hosting database data INSIDE of the asrg-postgres container, host the data in a volume on the host.
We will do this understanding that Windows developers may run into issues, but appears to work fine on Mac/Linux.
Mounted data directory will be added to .gitignore.