fix: Add a check for existing docker db volume #518
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #517
PostgreSQL DB container uses initdb to initialize the DB data directory. The password/username/DB name is set during this time. If any of these values change, these don't get updated automagically since
initdb
runs only once on an absence of data directory.So, if the
install-prod.sh
script is cancelled midway, thelistmonk-data
docker DB volume is already created. If the script is run again, it will generate a new password and set this indocker-compose
andconfig.toml
. However, this password is wrong, since thelistmonk-data
DB directory was initialized with the script's previous run's password.This script simply checks for an existence of
listmonk_listmonk-data
volume and if it exists, errors out immediately. It is upto the user to continue (by manually changing password inconfig.toml
/docker-compose.yml
) or remove the volume (bydocker-compose down -v