Rename dev.yml to local.yml

Closes #1226.
This commit is contained in:
Nikita P. Shupeyko 2017-07-10 14:36:01 +03:00
parent afb6b79fc3
commit ab47d8173d
6 changed files with 20 additions and 20 deletions

View File

@ -37,7 +37,7 @@ Build the Stack
This can take a while, especially the first time you run this particular command
on your development system::
$ docker-compose -f dev.yml build
$ docker-compose -f local.yml build
If you want to build the production environment you don't have to pass an argument -f, it will automatically use docker-compose.yml.
@ -51,11 +51,11 @@ runs will occur quickly.
Open a terminal at the project root and run the following for local development::
$ docker-compose -f dev.yml up
$ docker-compose -f local.yml up
You can also set the environment variable ``COMPOSE_FILE`` pointing to ``dev.yml`` like this::
You can also set the environment variable ``COMPOSE_FILE`` pointing to ``local.yml`` like this::
$ export COMPOSE_FILE=dev.yml
$ export COMPOSE_FILE=local.yml
And then run::
@ -69,8 +69,8 @@ using the ``docker-compose run`` command.
To migrate your app and to create a superuser, run::
$ docker-compose -f dev.yml run django python manage.py migrate
$ docker-compose -f dev.yml run django python manage.py createsuperuser
$ docker-compose -f local.yml run django python manage.py migrate
$ docker-compose -f local.yml run django python manage.py createsuperuser
Here we specify the ``django`` container as the location to run our management commands.
@ -82,7 +82,7 @@ When ``DEBUG`` is set to `True`, the host is validated against ``['localhost', '
Production Mode
~~~~~~~~~~~~~~~
Instead of using `dev.yml`, you would use `docker-compose.yml`.
Instead of using `local.yml`, you would use `docker-compose.yml`.
Other Useful Tips
-----------------
@ -104,7 +104,7 @@ If you want to run the stack in detached mode (in the background), use the ``-d`
::
$ docker-compose -f dev.yml up -d
$ docker-compose -f local.yml up -d
Debugging
~~~~~~~~~~~~~
@ -122,7 +122,7 @@ Then you may need to run the following for it to work as desired:
::
$ docker-compose -f dev.yml run --service-ports django
$ docker-compose -f local.yml run --service-ports django
django-debug-toolbar

View File

@ -2,26 +2,26 @@
Database Backups with Docker
============================
The database has to be running to create/restore a backup. These examples show local examples. If you want to use it on a remote server, remove ``-f dev.yml`` from each example.
The database has to be running to create/restore a backup. These examples show local examples. If you want to use it on a remote server, remove ``-f local.yml`` from each example.
Running Backups
================
Run the app with `docker-compose -f dev.yml up`.
Run the app with `docker-compose -f local.yml up`.
To create a backup, run::
docker-compose -f dev.yml run postgres backup
docker-compose -f local.yml run postgres backup
To list backups, run::
docker-compose -f dev.yml run postgres list-backups
docker-compose -f local.yml run postgres list-backups
To restore a backup, run::
docker-compose -f dev.yml run postgres restore filename.sql
docker-compose -f local.yml run postgres restore filename.sql
Where <containerId> is the ID of the Postgres container. To get it, run::

View File

@ -130,7 +130,7 @@ def remove_docker_files():
"""
Removes files needed for docker if it isn't going to be used
"""
for filename in ["dev.yml", "docker-compose.yml", ".dockerignore"]:
for filename in ["local.yml", "docker-compose.yml", ".dockerignore"]:
os.remove(os.path.join(
PROJECT_DIRECTORY, filename
))
@ -296,4 +296,4 @@ if '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower() != 'y':
# 13. Remove files conventional to opensource projects only.
if '{{ cookiecutter.open_source_license }}' == 'Not open source':
remove_open_source_files()
remove_open_source_files()

View File

@ -15,7 +15,7 @@ cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y js_task_runner
cd project_name
# run the project's tests
docker-compose -f dev.yml run django python manage.py test
docker-compose -f local.yml run django python manage.py test
# return non-zero status code if there are migrations that have not been created
docker-compose -f dev.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
docker-compose -f local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }

View File

@ -21,11 +21,11 @@ Next, you have to add new remote python interpreter, based on already tested dep
.. image:: images/3.png
Switch to *Docker Compose* and select `dev.yml` file from directory of your project, next set *Service name* to `django`
Switch to *Docker Compose* and select `local.yml` file from directory of your project, next set *Service name* to `django`
.. image:: images/4.png
Because Pycharm restarts container every time you use Configuration Run, to not have server restarted during running tests, we defined second service in `dev.yml` file called pycharm. To use it, you have to add interpreter of second service as well.
Because Pycharm restarts container every time you use Configuration Run, to not have server restarted during running tests, we defined second service in `local.yml` file called pycharm. To use it, you have to add interpreter of second service as well.
.. image:: images/5.png