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

Initialize codejail_service application #2

Merged
merged 2 commits into from
Jan 28, 2025
Merged

Initialize codejail_service application #2

merged 2 commits into from
Jan 28, 2025

Conversation

timmc-edx
Copy link
Contributor

@timmc-edx timmc-edx commented Jan 23, 2025

Two commits, best reviewed individually:

  • Straight-up output from a cookiecutter run
  • A fairly large commit that mostly deletes unwanted things and updates dependencies (but see its full description for many details)

This is part of edx/edx-arch-experiments#894

Copy link

@robrap robrap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work on this one.

Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
Makefile Outdated
detect_changed_source_translations: ## check if translation files are up-to-date
cd codejail_service && i18n_tool changed

validate_translations: fake_translations detect_changed_source_translations ## install fake translations and check if translation files are up-to-date

docker_build:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted elsewhere (in Slack), I'm unsure what kind of basic in-repo Docker support is still wanted at this point. I think it is fine to delete this while we don't know, and just pointing out that I don't know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the devstack DEPR: openedx/public-engineering#247

It describes removing all of the devstack.py from repos, and contemplates removing all of the docker elements as well, since it's unused in Tutor. I think we want to get out ahead of that.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start reading the conversation starting here: openedx/public-engineering#247 (comment)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timmc-edx: I don't think this conversation is resolved yet.

  1. Please see my last comment.
  2. I don't think this requires any changes to your PR, but I do think it requires a follow-up communication/discussion somewhere about this open question. Let me know if you will initiate that, or if you need me to. Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I misunderstood the meaning of your previous comment. I see now that there might be a role for a base development file that Tutor and Devstack can both build on. But it looks like Diana is already involved in the broader discussion?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I don't know how this (or any other) new service should be treated at this time, and who might be keeping track (if needed) of the services that will need to be updated once they come to resolution.

codejail_service/docker_gunicorn_configuration.py Outdated Show resolved Hide resolved
codejail_service/settings/base.py Outdated Show resolved Hide resolved
codejail_service/settings/test.py Outdated Show resolved Hide resolved
re_path(r'^api/', include(api_urls)),
re_path(r'^api-docs/', get_swagger_view(title='codejail-service API')),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be useful in a development environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I suppose. I could bring some of these things back in for consistency with other IDAs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this maybe requires a DB.

requirements/base.in Outdated Show resolved Hide resolved
django-extensions
django-rest-swagger
django-waffle
djangorestframework
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if DRF will still make sense for consistency or not.

requirements/base.in Outdated Show resolved Hide resolved
README.rst Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
Copy link

@robrap robrap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, including communication questions.

@@ -45,8 +41,13 @@ def root(*path_fragments):
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'codejail_service.wsgi.application'

# No database for codejail
DATABASES = {}
# Django *really* wants a database. So we give it a blank in-memory one.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add any sort of warning in the README that the service should be treated as-if it has no database?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mentioned in the README -- do you think it should be more prominent?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. And I don't just mean that the service does not have a database, but a warning about the required db for Django. For example, something like:

Warning: This service is configured with an in-memory database simply to make Django happy. The service itself should be considered to not to have a database, and should not rely on any database-dependent features, like waffle-based toggles, as one example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Made some changes, take a look.

Makefile Outdated
detect_changed_source_translations: ## check if translation files are up-to-date
cd codejail_service && i18n_tool changed

validate_translations: fake_translations detect_changed_source_translations ## install fake translations and check if translation files are up-to-date

docker_build:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timmc-edx: I don't think this conversation is resolved yet.

  1. Please see my last comment.
  2. I don't think this requires any changes to your PR, but I do think it requires a follow-up communication/discussion somewhere about this open question. Let me know if you will initiate that, or if you need me to. Thank you.

- Use cookiecutter version of .gitignore
- Drop existing LICENSE file in favor of LICENSE.txt provided by
  cookiecutter. Basically same contents, but different path. LICENSE.txt
  is what we use elsewhere. Only contents difference is that cookiecutter
  version doesn't include the "how to use this license" appendix.
@timmc-edx
Copy link
Contributor Author

Rewrote commits to squash fixups but preserve the cookiecutter/changes distinction, and edit commits. Cleaned up license file move/move-back in commit history.

Only change to diff is that the license file no longer includes the "APPENDIX: How to apply the Apache License to your work." section that we usually omit.

Major changes:

- Trim dependencies, settings, and application code to remove anything
  relating to having a database (auth, models, pii-annotations,
  reserved-keywords) or being exposed to the outside world (cors, csrf).
  Add an in-memory DB for to satisfy Django's need for a "database".
- Remove unneeded requirements files. We're going to deploy the base
  layer instead of the production layer, and requirements.txt is
  just not needed at all as far as I can tell.
- Install gunicorn in the base layer. It's not clear if we'll want to
  use it from devstack (or just use runserver) but it should be
  available when we want to use it.
- Don't hardcode gunicorn's bind address; we'll pass it as `--bind`
  from the Dockerfile.
- Remove Dockerfile and devstack.py as these will be provided elsewhere.

Fixes:

- Use Python 3.12 for tox invocation (to match tox.ini and others)

Docs:

- Fill out README. Full documentation has been ticketed in
  #3 and linked
  from the README.
- Removed PyPI badge as this is an IDA and won't be published as a
  package.
- Update catalog-info.yaml from defaults
- Tweaks to PR template

Build:

- Suppress code coverage checks for gunicorn config file

Finally:

- Run `make upgrade`
@timmc-edx timmc-edx merged commit b134742 into main Jan 28, 2025
7 checks passed
@timmc-edx timmc-edx deleted the timmc/init branch January 28, 2025 18:15
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