diff --git a/Makefile b/Makefile index b70a9d5..5af0635 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,11 @@ down: ${DOCKER_COMPOSE} down +# Create all external volumes needed for production. Using external volumes is useful to prevent data loss (as they are not deleted when performing docker down -v) +create_external_volumes: + @echo "🥫 Creating external volumes (production only) …" + docker volume create nutripatrol-postgres-data + #-----------# # Utilities # #-----------# diff --git a/docker-compose.yml b/docker-compose.yml index 5af2c7e..8469ab3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,4 +35,5 @@ services: - "${POSTGRES_EXPOSE:-127.0.0.1:5432}:5432" volumes: - postgres-data: \ No newline at end of file + postgres-data: + name: ${COMPOSE_PROJECT_NAME:-nutripatrol}-postgres-data \ No newline at end of file diff --git a/docker/prod.yml b/docker/prod.yml index c404b8b..316c287 100644 --- a/docker/prod.yml +++ b/docker/prod.yml @@ -1,3 +1,5 @@ -version: "3.7" +version: "3.9" -# modifications to docker-compose for production settings \ No newline at end of file +volumes: + postgres-data: + external: true