From 9dbc980330bd2b58c29cc8360290d0df61dccff8 Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Thu, 22 Feb 2024 14:25:06 +0000 Subject: [PATCH 1/2] docker.up: Fix --no-django-debug behavior RTD_DJANGO_DEBUG has a default value of True, so ensure that an empty variable is passed to docker compose when --no-django-debug is passed to `inv docker.up`. Signed-off-by: Diego Sueiro Signed-off-by: Peter Hoyes --- dockerfiles/tasks.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dockerfiles/tasks.py b/dockerfiles/tasks.py index 8926135..fd5c1ac 100644 --- a/dockerfiles/tasks.py +++ b/dockerfiles/tasks.py @@ -70,8 +70,7 @@ 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}') From ce3a62f0e5e8e7ce76393a85308e04acc94d999f Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Thu, 22 Feb 2024 14:25:15 +0000 Subject: [PATCH 2/2] docker.up: Introduce the --detach parameter This makes it simple to start the application in detached/daemon mode without requiring a terminal to output to. Signed-off-by: Ryan Roberts Signed-off-by: Diego Sueiro Signed-off-by: Peter Hoyes --- dockerfiles/tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dockerfiles/tasks.py b/dockerfiles/tasks.py index fd5c1ac..a8c291e 100644 --- a/dockerfiles/tasks.py +++ b/dockerfiles/tasks.py @@ -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 = [] @@ -78,6 +79,9 @@ def up(c, search=True, init=False, reload=True, webpack=False, ext_theme=False, cmd.append('up') + if detach: + cmd.append('--detach') + cmd.append(f'--scale build={scale_build}') c.run(' '.join(cmd), pty=True)