Skip to content

docker.up: Fix --no-django-debug behavior and introduce --detach #202

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions dockerfiles/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ def down(c, volumes=False):
'"17b5-139-47-118-243.ngrok.io"',
'log-level': 'Logging level for the Django application (default: INFO)',
'django-debug': 'Sets the DEBUG Django setting (default: True)',
'detach': 'Start containers in background (default: False)',
})
def up(c, search=True, init=False, reload=True, webpack=False, ext_theme=False, scale_build=1, http_domain="", django_debug=True, log_level='INFO'):
def up(c, search=True, init=False, reload=True, webpack=False, ext_theme=False, scale_build=1, http_domain="", django_debug=True, log_level='INFO', detach=False):
"""Start all the docker containers for a Read the Docs instance"""
cmd = []

Expand All @@ -70,15 +71,17 @@ def up(c, search=True, init=False, reload=True, webpack=False, ext_theme=False,
cmd.insert(0, 'RTD_EXT_THEME_DEV_SERVER_ENABLED=t')
if ext_theme:
cmd.insert(0, 'RTD_EXT_THEME_ENABLED=t')
if django_debug:
cmd.insert(0, 'RTD_DJANGO_DEBUG=t')
cmd.insert(0, 'RTD_DJANGO_DEBUG=t' if django_debug else 'RTD_DJANGO_DEBUG=')
if http_domain:
cmd.insert(0, f'RTD_PRODUCTION_DOMAIN={http_domain}')
cmd.insert(0, f'NGINX_WEB_SERVER_NAME={http_domain}')
cmd.insert(0, f'NGINX_PROXITO_SERVER_NAME=*.{http_domain}')

cmd.append('up')

if detach:
cmd.append('--detach')

cmd.append(f'--scale build={scale_build}')

c.run(' '.join(cmd), pty=True)
Expand Down