From 0954ec8dad7ebd58e77d31a9e561655a128ebe8e Mon Sep 17 00:00:00 2001 From: Jannis Gebauer Date: Fri, 8 Apr 2016 08:31:02 +0200 Subject: [PATCH] switch to named docker volumes --- CHANGELOG.md | 4 ++++ docs/deployment-with-docker.rst | 2 +- {{cookiecutter.repo_name}}/dev.yml | 11 +++++++---- {{cookiecutter.repo_name}}/docker-compose.yml | 9 +++++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f085413..7e4e3e360 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All enhancements and patches to cookiecutter-django will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +### [2016-04-08] +### Changed +- Move to named docker volumes (@jayfk) + ### [2016-04-07] ### Changed - Pycharm Support (including debugging in Docker) @noisy diff --git a/docs/deployment-with-docker.rst b/docs/deployment-with-docker.rst index 7e64a50ee..c3e815edd 100644 --- a/docs/deployment-with-docker.rst +++ b/docs/deployment-with-docker.rst @@ -41,7 +41,7 @@ This pass all incoming requests on `nginx-proxy`_ to the nginx service your appl .. _nginx-proxy: https://github.com/jwilder/nginx-proxy -Postgres is saving its database files to `/data/{{cookiecutter.repo_name}}/postgres` by default. Change that if you wan't +Postgres is saving its database files to the `postgres_data` volume by default. Change that if you wan't something else and make sure to make backups since this is not done automatically. To get started, pull your code from source control (don't forget the `.env` file) and change to your projects root diff --git a/{{cookiecutter.repo_name}}/dev.yml b/{{cookiecutter.repo_name}}/dev.yml index 359f6e91e..95353a959 100644 --- a/{{cookiecutter.repo_name}}/dev.yml +++ b/{{cookiecutter.repo_name}}/dev.yml @@ -1,12 +1,15 @@ version: '2' + +volumes: + postgres_data_dev: {} + postgres_backup_dev: {} + services: postgres: build: ./compose/postgres volumes: - # If you are using boot2docker, postgres data has to live in the VM for now until #581 is fixed - # for more info see here: https://github.com/boot2docker/boot2docker/issues/581 - - /data/dev/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data - - /data/dev/{{cookiecutter.repo_name}}/postgres-backups:/backups + - postgres_data_dev:/var/lib/postgresql/data + - postgres_backup_dev:/backups environment: - POSTGRES_USER={{cookiecutter.repo_name}} diff --git a/{{cookiecutter.repo_name}}/docker-compose.yml b/{{cookiecutter.repo_name}}/docker-compose.yml index c1ae2cbf2..4206a7c1a 100644 --- a/{{cookiecutter.repo_name}}/docker-compose.yml +++ b/{{cookiecutter.repo_name}}/docker-compose.yml @@ -1,10 +1,15 @@ version: '2' + +volumes: + postgres_data: {} + postgres_backup: {} + services: postgres: build: ./compose/postgres volumes: - - /data/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data - - /data/{{cookiecutter.repo_name}}/postgres-backups:/backups + - postgres_data:/var/lib/postgresql/data + - postgres_backup:/backups env_file: .env django: