mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-11 15:34:51 +03:00
Update deployment-with-docker.rst
changed `docker-compose` to `docker compose`
This commit is contained in:
parent
7664c4fb3e
commit
611e46b72a
|
@ -1,7 +1,7 @@
|
||||||
Deployment with Docker
|
Deployment with Docker
|
||||||
======================
|
======================
|
||||||
|
|
||||||
.. index:: deployment, docker, docker-compose, compose
|
.. index:: deployment, docker, docker compose, compose
|
||||||
|
|
||||||
|
|
||||||
Prerequisites
|
Prerequisites
|
||||||
|
@ -89,7 +89,7 @@ You can read more about this feature and how to configure it, at `Automatic HTTP
|
||||||
Webpack without Whitenoise limitation
|
Webpack without Whitenoise limitation
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
If you opt for Webpack without Whitenoise, Webpack needs to know the static URL at build time, when running ``docker-compose build`` (See ``webpack/prod.config.js``). Depending on your setup, this URL may come from the following environment variables:
|
If you opt for Webpack without Whitenoise, Webpack needs to know the static URL at build time, when running ``docker compose build`` (See ``webpack/prod.config.js``). Depending on your setup, this URL may come from the following environment variables:
|
||||||
|
|
||||||
- ``AWS_STORAGE_BUCKET_NAME``
|
- ``AWS_STORAGE_BUCKET_NAME``
|
||||||
- ``DJANGO_AWS_S3_CUSTOM_DOMAIN``
|
- ``DJANGO_AWS_S3_CUSTOM_DOMAIN``
|
||||||
|
@ -107,7 +107,7 @@ To solve this, you can either:
|
||||||
2. create a ``.env`` file in the root of the project with just variables you need. You'll need to also define them in ``.envs/.production/.django`` (hence duplicating them).
|
2. create a ``.env`` file in the root of the project with just variables you need. You'll need to also define them in ``.envs/.production/.django`` (hence duplicating them).
|
||||||
3. set these variables when running the build command::
|
3. set these variables when running the build command::
|
||||||
|
|
||||||
DJANGO_AWS_S3_CUSTOM_DOMAIN=example.com docker-compose -f production.yml build``.
|
DJANGO_AWS_S3_CUSTOM_DOMAIN=example.com docker compose -f production.yml build``.
|
||||||
|
|
||||||
None of these options are ideal, we're open to suggestions on how to improve this. If you think you have one, please open an issue or a pull request.
|
None of these options are ideal, we're open to suggestions on how to improve this. If you think you have one, please open an issue or a pull request.
|
||||||
|
|
||||||
|
@ -122,42 +122,42 @@ Building & Running Production Stack
|
||||||
|
|
||||||
You will need to build the stack first. To do that, run::
|
You will need to build the stack first. To do that, run::
|
||||||
|
|
||||||
docker-compose -f production.yml build
|
docker compose -f production.yml build
|
||||||
|
|
||||||
Once this is ready, you can run it with::
|
Once this is ready, you can run it with::
|
||||||
|
|
||||||
docker-compose -f production.yml up
|
docker compose -f production.yml up
|
||||||
|
|
||||||
To run the stack and detach the containers, run::
|
To run the stack and detach the containers, run::
|
||||||
|
|
||||||
docker-compose -f production.yml up -d
|
docker compose -f production.yml up -d
|
||||||
|
|
||||||
To run a migration, open up a second terminal and run::
|
To run a migration, open up a second terminal and run::
|
||||||
|
|
||||||
docker-compose -f production.yml run --rm django python manage.py migrate
|
docker compose -f production.yml run --rm django python manage.py migrate
|
||||||
|
|
||||||
To create a superuser, run::
|
To create a superuser, run::
|
||||||
|
|
||||||
docker-compose -f production.yml run --rm django python manage.py createsuperuser
|
docker compose -f production.yml run --rm django python manage.py createsuperuser
|
||||||
|
|
||||||
If you need a shell, run::
|
If you need a shell, run::
|
||||||
|
|
||||||
docker-compose -f production.yml run --rm django python manage.py shell
|
docker compose -f production.yml run --rm django python manage.py shell
|
||||||
|
|
||||||
To check the logs out, run::
|
To check the logs out, run::
|
||||||
|
|
||||||
docker-compose -f production.yml logs
|
docker compose -f production.yml logs
|
||||||
|
|
||||||
If you want to scale your application, run::
|
If you want to scale your application, run::
|
||||||
|
|
||||||
docker-compose -f production.yml up --scale django=4
|
docker compose -f production.yml up --scale django=4
|
||||||
docker-compose -f production.yml up --scale celeryworker=2
|
docker compose -f production.yml up --scale celeryworker=2
|
||||||
|
|
||||||
.. warning:: don't try to scale ``postgres``, ``celerybeat``, or ``traefik``.
|
.. warning:: don't try to scale ``postgres``, ``celerybeat``, or ``traefik``.
|
||||||
|
|
||||||
To see how your containers are doing run::
|
To see how your containers are doing run::
|
||||||
|
|
||||||
docker-compose -f production.yml ps
|
docker compose -f production.yml ps
|
||||||
|
|
||||||
|
|
||||||
Example: Supervisor
|
Example: Supervisor
|
||||||
|
@ -165,12 +165,12 @@ Example: Supervisor
|
||||||
|
|
||||||
Once you are ready with your initial setup, you want to make sure that your application is run by a process manager to
|
Once you are ready with your initial setup, you want to make sure that your application is run by a process manager to
|
||||||
survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All
|
survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All
|
||||||
it needs to do is to run ``docker-compose -f production.yml up`` in your projects root directory.
|
it needs to do is to run ``docker compose -f production.yml up`` in your projects root directory.
|
||||||
|
|
||||||
If you are using ``supervisor``, you can use this file as a starting point::
|
If you are using ``supervisor``, you can use this file as a starting point::
|
||||||
|
|
||||||
[program:{{cookiecutter.project_slug}}]
|
[program:{{cookiecutter.project_slug}}]
|
||||||
command=docker-compose -f production.yml up
|
command=docker compose -f production.yml up
|
||||||
directory=/path/to/{{cookiecutter.project_slug}}
|
directory=/path/to/{{cookiecutter.project_slug}}
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
autostart=true
|
autostart=true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user