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

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hoyes
Copy link

@hoyes hoyes commented Feb 26, 2024

I'd like to propose a couple of small tweaks to inv docker.up

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.

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.

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 <diego.sueiro@arm.com>
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
This makes it simple to start the application in detached/daemon
mode without requiring a terminal to output to.

Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
@humitos
Copy link
Member

humitos commented Feb 26, 2024

Thanks for your contribution. I have a few questions before moving forward with this PR.

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.

What's the reasoning behind this behavior? As far as I can tell, all the other environment work in the same way: only define it when it's enabled.

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.

I don't have a strong preference for this parameter and I never needed while doing development. I usually always need to check the output to understand how the application is working. Can you expand on what is the use case behind this?

@hoyes
Copy link
Author

hoyes commented Feb 26, 2024

Thanks for your response.

What's the reasoning behind this behavior? As far as I can tell, all the other environment work in the same way: only define it when it's enabled.

Currently inv docker.up --no-django-debug seems to be ineffective because https://github.com/readthedocs/readthedocs.org/blob/main/readthedocs/settings/docker_compose.py#L11 defaults to True if the env var is not set. This change explicitly sets RTD_DJANGO_DEBUG to a false-y value.

I don't have a strong preference for this parameter and I never needed while doing development. I usually always need to check the output to understand how the application is working. Can you expand on what is the use case behind this?

Both these changes are related to a small RTD internal deployment at Arm, where we want to leave the instance unattended. I'm not asking for support with this (it's an internal-facing instance for private projects only)... but wondered if you'd be willing to include the extra parameter upstream to minimize patching.

@humitos
Copy link
Member

humitos commented Feb 26, 2024

Currently inv docker.up --no-django-debug seems to be ineffective because readthedocs/readthedocs.org@main/readthedocs/settings/docker_compose.py#L11 defaults to True if the env var is not set. This change explicitly sets RTD_DJANGO_DEBUG to a false-y value.

Interesting. I think we should change the docker_compose.py settings then to default to False when it's not defined.

Both these changes are related to a small RTD internal deployment at Arm, where we want to leave the instance unattended. I'm not asking for support with this (it's an internal-facing instance for private projects only)... but wondered if you'd be willing to include the extra parameter upstream to minimize patching.

Note that we explicitly say to not use this setup for production or custom installations in https://dev.readthedocs.io/en/latest/install.html

Take into account that this setup is intended for development purposes. We do not recommend to follow this guide to deploy an instance of Read the Docs for production.

and

https://github.com/readthedocs/readthedocs.org/blob/92afef7b9bc31849765d1f9488f6d7a55ee90207/dockerfiles/README.rst?plain=1#L1-L7

If you want to have private projects only, we strongly recommend you Read the Docs for Business. Read more about this at https://about.readthedocs.com/

@hoyes
Copy link
Author

hoyes commented Feb 26, 2024

Interesting. I think we should change the docker_compose.py settings then to default to False when it's not defined.

Makes sense, I'll raise a PR over on that repo.

Note that we explicitly say to not use this setup for production or custom installations

Yea, I've read this but we've proceeded at risk due to some complex compliance requirements combined with a desire to use the same platform as we already use for public docs (where we already use RTD for Business). I'll discuss this some more internally to make sure we're doing the "right thing" still.

Would you accept a PR which allows arbitrary arguments to be forwarded to docker compose inv docker.up --arg="-e RTD_FOO=BAR" ?

@humitos
Copy link
Member

humitos commented Feb 26, 2024

Yea, I've read this but we've proceeded at risk due to some complex compliance requirements combined with a desire to use the same platform as we already use for public docs (where we already use RTD for Business). I'll discuss this some more internally to make sure we're doing the "right thing" still.

I would be interested in receiving this feedback if you able to share it 😄 . I strongly recommend you to not use our development environment for production purposes because it will be a nightmare to maintain. I'm sure about that. If you have doubts about Read the Docs for Business being a good fit for your company, you can always give it a try by signing up for our 30-day free trial and/or contact our support team to clarify your doubts.

Would you accept a PR which allows arbitrary arguments to be forwarded to docker compose inv docker.up --arg="-e RTD_FOO=BAR" ?

It depends. What would be the use case for this? I'm happy to add/accept any feature that's useful for the main purpose of this Docker environment, which is development. If we require this flexibility to help with the development of Read the Docs, I'm 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants