docker-compose: explicitly define COMPOSE_PROJECT_NAME #75
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.
COMPOSE_PROJECT_NAME defines a namespace that docker-compose prefixes all networks, containers, and volumes with. This environment variable wasn't previously set, in which case
docker-compose
defaultsCOMPOSE_PROJECT_NAME
to thebasename
of the folder that contains thedocker-compose.yaml
file (literallydocker-compose
in our case).Not defining this variable has worked up until now, but docker-compose will treat all resources defined in
docker-compose.yaml
as brand new if the folder containsdocker-compose.yaml
was ever renamed. All the data from the old volumes will have to be manually moved over. Defining this environment variable (and making sure all docker-compose commands are run relative to this file) will prevent this from happening.I debated between two values for
COMPOSE_PROJECT_NAME
:docker-compose
sourcegraph-docker-compose
.docker-compose
should allow our existing users to upgrade without any manual migrations, but it's more ambiguous thansourcegraph-docker-compose
. We could choose to setCOMPOSE_PROJECT_NAME=sourcegraph-docker-compose
, but we'll need to figure out a migration path for our existing users (dump the PostgreSQL database?) .