Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DOCKER_NORELOAD to compose settings #6461

Merged
merged 2 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ services:
- database
- cache
environment:
- DOCKER_NO_RELOAD
- DJANGO_SETTINGS_MODULE=readthedocs.settings.proxito

# Allow us to run `docker attach readthedocsorg_proxito_1` and get
Expand Down Expand Up @@ -70,6 +71,7 @@ services:
- azure-cli
environment:
- INIT=${INIT}
- DOCKER_NO_RELOAD
- DJANGO_SETTINGS_MODULE=readthedocs.settings.web
stdin_open: true
tty: true
Expand All @@ -93,6 +95,7 @@ services:
- azure-cli
environment:
- DJANGO_SETTINGS_MODULE=readthedocs.settings.celery
- DOCKER_NO_RELOAD
stdin_open: true
tty: true
command: ["../../docker/celery.sh"]
Expand Down Expand Up @@ -121,6 +124,7 @@ services:
- cache
environment:
- DJANGO_SETTINGS_MODULE=readthedocs.settings.build
- DOCKER_NO_RELOAD
stdin_open: true
tty: true
command: ["../../docker/build.sh"]
Expand Down
15 changes: 12 additions & 3 deletions dockerfiles/entrypoints/build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#! /bin/sh
#! /bin/bash

../../docker/common.sh

watchmedo auto-restart \
CMD='python3 -m celery worker -A readthedocs.worker -Ofair -c 2 -Q builder,celery,default,build01 -l DEBUG'

if [ -n "${DOCKER_NO_RELOAD}" ]; then
echo "Running Docker with no reload"
$CMD
else
echo "Running Docker with reload"
watchmedo auto-restart \
--patterns="*.py" \
--ignore-patterns="*.#*.py;./user_builds/*;./public_*;./private_*;*.pyo;*.pyc;*flycheck*.py;./media/*;./.tox/*" \
--ignore-directories \
Expand All @@ -11,4 +18,6 @@ watchmedo auto-restart \
--kill-after=5 \
--interval=5 \
-- \
python3 -m celery worker -A readthedocs.worker -Ofair -c 2 -Q builder,celery,default,build01 -l DEBUG
$CMD
fi

14 changes: 11 additions & 3 deletions dockerfiles/entrypoints/celery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@

python3 ../../docker/scripts/wait_for_search.py

watchmedo auto-restart \
CMD='python3 -m celery worker -A readthedocs.worker -Ofair -c 2 -Q web,web01,reindex -l DEBUG'

if [ -n "${DOCKER_NO_RELOAD}" ]; then
echo "Running Docker with no reload"
$CMD
else
echo "Running Docker with reload"
watchmedo auto-restart \
--patterns="*.py" \
--ignore-patterns="*.#*.py;./user_builds/*;./public_*;./private_*;*.pyo;*.pyc;*flycheck*.py;./media/*;./.tox/*" \
--ignore-directories \
--recursive \
--signal=SIGTERM \
--kill-after=5 \
--interval=5 \
-- \
python3 -m celery worker -A readthedocs.worker -Ofair -c 2 -Q web,web01,reindex -l DEBUG
--
$CMD
fi
11 changes: 10 additions & 1 deletion dockerfiles/entrypoints/proxito.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@

../../docker/common.sh

python3 manage.py runserver 0.0.0.0:8000
if [ -n "${DOCKER_NO_RELOAD}" ];
then
RELOAD='--noreload'
echo "Running Docker with no reload"
else
RELOAD=''
echo "Running Docker with reload"
fi

python3 manage.py runserver 0.0.0.0:8000 $RELOAD
11 changes: 10 additions & 1 deletion dockerfiles/entrypoints/web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ then
python3 manage.py loaddata test_data
fi

python3 manage.py runserver 0.0.0.0:8000
if [ -n "${DOCKER_NO_RELOAD}" ];
then
RELOAD='--noreload'
echo "Running Docker with no reload"
else
RELOAD=''
echo "Running Docker with reload"
fi

python3 manage.py runserver 0.0.0.0:8000 $RELOAD
13 changes: 9 additions & 4 deletions dockerfiles/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,22 @@ def down(c, volumes=False):
else:
c.run(f'{DOCKER_COMPOSE_COMMAND} down', pty=True)


@task
def up(c, no_search=False, init=False):
def up(c, no_search=False, init=False, no_reload=False):
"""Start all the docker containers for a Read the Docs instance"""
INIT = ''
INIT = 'INIT='
DOCKER_NO_RELOAD = 'DOCKER_NO_RELOAD='
if init:
INIT = 'INIT=t'
if no_reload:
DOCKER_NO_RELOAD = 'DOCKER_NO_RELOAD=t'

if no_search:
c.run(f'{INIT} docker-compose -f {DOCKER_COMPOSE} up', pty=True)
c.run(f'{INIT} {DOCKER_NO_RELOAD} docker-compose -f {DOCKER_COMPOSE} up', pty=True)
else:
c.run(f'{INIT} {DOCKER_COMPOSE_COMMAND} up', pty=True)
c.run(f'{INIT} {DOCKER_NO_RELOAD} {DOCKER_COMPOSE_COMMAND} up', pty=True)


@task
def shell(c, running=False, container='web'):
Expand Down