mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-01-24 08:14:13 +03:00
updates docs for docker 1.10
This commit is contained in:
parent
d78df9880d
commit
9b5f91efb3
|
@ -16,8 +16,8 @@ to run docker (with compose) on production.
|
||||||
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
|
|
||||||
* docker (tested with 1.8)
|
* docker (at least 1.10)
|
||||||
* docker-compose (tested with 0.4)
|
* docker-compose (at least 1.6)
|
||||||
|
|
||||||
Before you start, check out the `docker-compose.yml` file in the root of this project. This is where each component
|
Before you start, check out the `docker-compose.yml` file in the root of this project. This is where each component
|
||||||
of this application gets its configuration from. It consists of a `postgres` service that runs the database, `redis`
|
of this application gets its configuration from. It consists of a `postgres` service that runs the database, `redis`
|
||||||
|
@ -67,7 +67,7 @@ To create a superuser, run::
|
||||||
|
|
||||||
If you need a shell, run::
|
If you need a shell, run::
|
||||||
|
|
||||||
docker-compose run django python manage.py shell_plus
|
docker-compose run django python manage.py shell
|
||||||
|
|
||||||
To get an output of all running containers.
|
To get an output of all running containers.
|
||||||
|
|
||||||
|
|
|
@ -7,21 +7,21 @@ The steps below will get you up and running with a local development environment
|
||||||
All of these commands assume you are in the root of your generated project.
|
All of these commands assume you are in the root of your generated project.
|
||||||
|
|
||||||
Prerequisites
|
Prerequisites
|
||||||
--------------
|
-------------
|
||||||
|
|
||||||
If you don't already have these installed, get them all by installing `Docker Toolbox`_.
|
You'll need at least docker 1.10.
|
||||||
|
|
||||||
* docker
|
If you don't already have it installed, follow the instructions for your OS:
|
||||||
* docker-machine
|
|
||||||
* docker-compose
|
|
||||||
* virtualbox
|
|
||||||
|
|
||||||
|
- On Mac OS X/Windows, you'll need `Docker Toolbox`_
|
||||||
|
- On Linux, you'll need `docker-engine`_
|
||||||
.. _`Docker Toolbox`: https://github.com/docker/toolbox/releases
|
.. _`Docker Toolbox`: https://github.com/docker/toolbox/releases
|
||||||
|
.. _`docker-engine`: https://docs.docker.com/engine/installation/
|
||||||
|
|
||||||
Create the Machine (Optional)
|
Create the Machine (Optional)
|
||||||
-------------------------------
|
-----------------------------
|
||||||
|
|
||||||
On Ubuntu you have native Docker, so you don't need to create a VM with
|
On Linux you have native Docker, so you don't need to create a VM with
|
||||||
docker-machine to use it.
|
docker-machine to use it.
|
||||||
|
|
||||||
However, on Mac/Windows/other systems without native Docker, you'll want to
|
However, on Mac/Windows/other systems without native Docker, you'll want to
|
||||||
|
@ -34,7 +34,7 @@ name them accordingly. Instead of 'dev1' you might have 'dev2', 'myproject',
|
||||||
'djangopackages', et al.
|
'djangopackages', et al.
|
||||||
|
|
||||||
Get the IP Address
|
Get the IP Address
|
||||||
--------------------
|
------------------
|
||||||
|
|
||||||
Once your machine is up and running, run this::
|
Once your machine is up and running, run this::
|
||||||
|
|
||||||
|
@ -43,26 +43,6 @@ Once your machine is up and running, run this::
|
||||||
|
|
||||||
This is also the IP address where the Django project will be served from.
|
This is also the IP address where the Django project will be served from.
|
||||||
|
|
||||||
Saving changes
|
|
||||||
--------------
|
|
||||||
|
|
||||||
If you are using OS X or Windows, you need to create a /data partition inside the
|
|
||||||
virtual machine that runs the docker deamon in order make all changes persistent.
|
|
||||||
If you don't do that your /data directory will get wiped out on every reboot.
|
|
||||||
|
|
||||||
To create a persistent folder, log into the virtual machine by running::
|
|
||||||
|
|
||||||
$ docker-machine ssh dev1
|
|
||||||
$ sudo su
|
|
||||||
$ mkdir /data
|
|
||||||
$ echo 'ln -sfn /mnt/sda1/data /data' >> /var/lib/boot2docker/bootlocal.sh
|
|
||||||
|
|
||||||
In case you are wondering why you can't use a host volume to keep the files on
|
|
||||||
your mac: As of `boot2docker` 1.7 you'll run into permission problems with mounted
|
|
||||||
host volumes if the container creates his own user and chown's the directories
|
|
||||||
on the volume. Postgres is doing that, so we need this quick fix to ensure that
|
|
||||||
all development data persists.
|
|
||||||
|
|
||||||
Build the Stack
|
Build the Stack
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
@ -94,7 +74,7 @@ And then run::
|
||||||
$ docker-compose up
|
$ docker-compose up
|
||||||
|
|
||||||
Running management commands
|
Running management commands
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
As with any shell command that we wish to run in our container, this is done
|
As with any shell command that we wish to run in our container, this is done
|
||||||
using the ``docker-compose run`` command.
|
using the ``docker-compose run`` command.
|
||||||
|
@ -107,15 +87,15 @@ To migrate your app and to create a superuser, run::
|
||||||
Here we specify the ``django`` container as the location to run our management commands.
|
Here we specify the ``django`` container as the location to run our management commands.
|
||||||
|
|
||||||
Production Mode
|
Production Mode
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Instead of using `dev.yml`, you would use `docker-compose.yml`.
|
Instead of using `dev.yml`, you would use `docker-compose.yml`.
|
||||||
|
|
||||||
Other Useful Tips
|
Other Useful Tips
|
||||||
------------------
|
-----------------
|
||||||
|
|
||||||
Make a machine the active unit
|
Make a machine the active unit
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
This tells our computer that all future commands are specifically for the dev1 machine.
|
This tells our computer that all future commands are specifically for the dev1 machine.
|
||||||
Using the ``eval`` command we can switch machines as needed.
|
Using the ``eval`` command we can switch machines as needed.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user