Skip to content

Commit acc68e5

Browse files
authored
New invoke options: --no-django-debug and --http-proxy (rename) (#178)
* New invoke flags to set environment variables for docker-compose development * Remove dev environment support for https
1 parent c8ecfc1 commit acc68e5

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

dockerfiles/docker-compose.yml

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ services:
4444
- DOCKER_NO_RELOAD
4545
- RTD_PRODUCTION_DOMAIN
4646
- RTD_LOGGING_LEVEL
47+
- RTD_DJANGO_DEBUG
4748

4849
# Allow us to run `docker attach readthedocsorg_proxito_1` and get
4950
# control on STDIN and be able to debug our code with interactive pdb
@@ -79,6 +80,7 @@ services:
7980
- MINIO_ROOT_USER=admin
8081
- MINIO_ROOT_PASSWORD=password
8182
- RTD_LOGGING_LEVEL
83+
- RTD_DJANGO_DEBUG
8284
stdin_open: true
8385
tty: true
8486
networks:
@@ -107,6 +109,7 @@ services:
107109
- CELERY_LOG_LEVEL=${CELERY_LOG_LEVEL:-INFO}
108110
- RTD_PRODUCTION_DOMAIN
109111
- RTD_LOGGING_LEVEL
112+
- RTD_DJANGO_DEBUG
110113
stdin_open: true
111114
tty: true
112115
networks:
@@ -127,6 +130,7 @@ services:
127130
- CELERY_LOG_LEVEL=${CELERY_LOG_LEVEL:-INFO}
128131
- RTD_PRODUCTION_DOMAIN
129132
- RTD_LOGGING_LEVEL
133+
- RTD_DJANGO_DEBUG
130134
stdin_open: true
131135
tty: true
132136
networks:
@@ -162,6 +166,7 @@ services:
162166
- CELERY_LOG_LEVEL=${CELERY_LOG_LEVEL:-INFO}
163167
- RTD_PRODUCTION_DOMAIN
164168
- RTD_LOGGING_LEVEL
169+
- RTD_DJANGO_DEBUG
165170
stdin_open: true
166171
tty: true
167172
networks:

dockerfiles/tasks.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ def down(c, volumes=False):
4242
'webpack': 'Start webpack development server (default: False)',
4343
'ext-theme': 'Enable new theme from ext-theme (default: False)',
4444
'scale-build': 'Add additional build instances (default: 1)',
45-
'ngrok': 'ngrok domain to serve the application. Example: "17b5-139-47-118-243.ngrok.io"',
45+
'http-domain': 'Configure a production domain for HTTP traffic. Subdomains included, '
46+
'example.dev implies *.examples.dev for proxito. Example: '
47+
'"17b5-139-47-118-243.ngrok.io"',
4648
'log-level': 'Logging level for the Django application (default: INFO)',
49+
'django-debug': 'Sets the DEBUG Django setting (default: True)',
4750
})
48-
def up(c, search=True, init=False, reload=True, webpack=False, ext_theme=False, scale_build=1, ngrok="", log_level='INFO'):
51+
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'):
4952
"""Start all the docker containers for a Read the Docs instance"""
5053
cmd = []
5154

@@ -67,10 +70,12 @@ def up(c, search=True, init=False, reload=True, webpack=False, ext_theme=False,
6770
cmd.insert(0, 'RTD_EXT_THEME_DEV_SERVER_ENABLED=t')
6871
if ext_theme:
6972
cmd.insert(0, 'RTD_EXT_THEME_ENABLED=t')
70-
if ngrok:
71-
cmd.insert(0, f'RTD_PRODUCTION_DOMAIN={ngrok}')
72-
cmd.insert(0, f'NGINX_WEB_SERVER_NAME={ngrok}')
73-
cmd.insert(0, f'NGINX_PROXITO_SERVER_NAME=*.{ngrok}')
73+
if django_debug:
74+
cmd.insert(0, 'RTD_DJANGO_DEBUG=t')
75+
if http_domain:
76+
cmd.insert(0, f'RTD_PRODUCTION_DOMAIN={http_domain}')
77+
cmd.insert(0, f'NGINX_WEB_SERVER_NAME={http_domain}')
78+
cmd.insert(0, f'NGINX_PROXITO_SERVER_NAME=*.{http_domain}')
7479

7580
cmd.append('up')
7681

0 commit comments

Comments
 (0)