mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 17:47:08 +03:00
Avoid docker image/volume collision by prefixing with project slug (#3528)
Co-authored-by: Bruno Alla <alla.brunoo@gmail.com> Co-authored-by: Bruno Alla <browniebroke@users.noreply.github.com>
This commit is contained in:
parent
759cc04bbc
commit
4f408810fc
|
@ -167,16 +167,18 @@ docker
|
||||||
|
|
||||||
The ``container_name`` from the yml file can be used to check on containers with docker commands, for example: ::
|
The ``container_name`` from the yml file can be used to check on containers with docker commands, for example: ::
|
||||||
|
|
||||||
$ docker logs worker
|
$ docker logs <project_slug>_local_celeryworker
|
||||||
$ docker top worker
|
$ docker top <project_slug>_local_celeryworker
|
||||||
|
|
||||||
|
|
||||||
|
Notice that the ``container_name`` is generated dynamically using your project slug as a prefix
|
||||||
|
|
||||||
Mailhog
|
Mailhog
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
When developing locally you can go with MailHog_ for email testing provided ``use_mailhog`` was set to ``y`` on setup. To proceed,
|
When developing locally you can go with MailHog_ for email testing provided ``use_mailhog`` was set to ``y`` on setup. To proceed,
|
||||||
|
|
||||||
#. make sure ``mailhog`` container is up and running;
|
#. make sure ``<project_slug>_local_mailhog`` container is up and running;
|
||||||
|
|
||||||
#. open up ``http://127.0.0.1:8025``.
|
#. open up ``http://127.0.0.1:8025``.
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
local_postgres_data: {}
|
{{ cookiecutter.project_slug }}_local_postgres_data: {}
|
||||||
local_postgres_data_backups: {}
|
{{ cookiecutter.project_slug }}_local_postgres_data_backups: {}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
django:{% if cookiecutter.use_celery == 'y' %} &django{% endif %}
|
django:{% if cookiecutter.use_celery == 'y' %} &django{% endif %}
|
||||||
|
@ -10,7 +10,7 @@ services:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./compose/local/django/Dockerfile
|
dockerfile: ./compose/local/django/Dockerfile
|
||||||
image: {{ cookiecutter.project_slug }}_local_django
|
image: {{ cookiecutter.project_slug }}_local_django
|
||||||
container_name: django
|
container_name: {{ cookiecutter.project_slug }}_local_django
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
{%- if cookiecutter.use_celery == 'y' %}
|
{%- if cookiecutter.use_celery == 'y' %}
|
||||||
|
@ -33,16 +33,16 @@ services:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./compose/production/postgres/Dockerfile
|
dockerfile: ./compose/production/postgres/Dockerfile
|
||||||
image: {{ cookiecutter.project_slug }}_production_postgres
|
image: {{ cookiecutter.project_slug }}_production_postgres
|
||||||
container_name: postgres
|
container_name: {{ cookiecutter.project_slug }}_local_postgres
|
||||||
volumes:
|
volumes:
|
||||||
- local_postgres_data:/var/lib/postgresql/data:Z
|
- {{ cookiecutter.project_slug }}_local_postgres_data:/var/lib/postgresql/data:Z
|
||||||
- local_postgres_data_backups:/backups:z
|
- {{ cookiecutter.project_slug }}_local_postgres_data_backups:/backups:z
|
||||||
env_file:
|
env_file:
|
||||||
- ./.envs/.local/.postgres
|
- ./.envs/.local/.postgres
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
image: {{ cookiecutter.project_slug }}_local_docs
|
image: {{ cookiecutter.project_slug }}_local_docs
|
||||||
container_name: docs
|
container_name: {{ cookiecutter.project_slug }}_local_docs
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./compose/local/docs/Dockerfile
|
dockerfile: ./compose/local/docs/Dockerfile
|
||||||
|
@ -59,7 +59,7 @@ services:
|
||||||
|
|
||||||
mailhog:
|
mailhog:
|
||||||
image: mailhog/mailhog:v1.0.0
|
image: mailhog/mailhog:v1.0.0
|
||||||
container_name: mailhog
|
container_name: {{ cookiecutter.project_slug }}_local_mailhog
|
||||||
ports:
|
ports:
|
||||||
- "8025:8025"
|
- "8025:8025"
|
||||||
|
|
||||||
|
@ -68,12 +68,12 @@ services:
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:6
|
image: redis:6
|
||||||
container_name: redis
|
container_name: {{ cookiecutter.project_slug }}_local_redis
|
||||||
|
|
||||||
celeryworker:
|
celeryworker:
|
||||||
<<: *django
|
<<: *django
|
||||||
image: {{ cookiecutter.project_slug }}_local_celeryworker
|
image: {{ cookiecutter.project_slug }}_local_celeryworker
|
||||||
container_name: celeryworker
|
container_name: {{ cookiecutter.project_slug }}_local_celeryworker
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- postgres
|
- postgres
|
||||||
|
@ -86,7 +86,7 @@ services:
|
||||||
celerybeat:
|
celerybeat:
|
||||||
<<: *django
|
<<: *django
|
||||||
image: {{ cookiecutter.project_slug }}_local_celerybeat
|
image: {{ cookiecutter.project_slug }}_local_celerybeat
|
||||||
container_name: celerybeat
|
container_name: {{ cookiecutter.project_slug }}_local_celerybeat
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- postgres
|
- postgres
|
||||||
|
@ -99,7 +99,7 @@ services:
|
||||||
flower:
|
flower:
|
||||||
<<: *django
|
<<: *django
|
||||||
image: {{ cookiecutter.project_slug }}_local_flower
|
image: {{ cookiecutter.project_slug }}_local_flower
|
||||||
container_name: flower
|
container_name: {{ cookiecutter.project_slug }}_local_flower
|
||||||
ports:
|
ports:
|
||||||
- "5555:5555"
|
- "5555:5555"
|
||||||
command: /start-flower
|
command: /start-flower
|
||||||
|
@ -112,7 +112,7 @@ services:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./compose/local/node/Dockerfile
|
dockerfile: ./compose/local/node/Dockerfile
|
||||||
image: {{ cookiecutter.project_slug }}_local_node
|
image: {{ cookiecutter.project_slug }}_local_node
|
||||||
container_name: node
|
container_name: {{ cookiecutter.project_slug }}_local_node
|
||||||
depends_on:
|
depends_on:
|
||||||
- django
|
- django
|
||||||
volumes:
|
volumes:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user