Skip to content

Migrate to resonant_settings#181

Merged
naglepuff merged 37 commits intomainfrom
migrate-django-config
Jul 17, 2025
Merged

Migrate to resonant_settings#181
naglepuff merged 37 commits intomainfrom
migrate-django-config

Conversation

@naglepuff
Copy link
Collaborator

@naglepuff naglepuff commented Jun 4, 2025

Remove django-composed-configuration and replace with django-resonant-settings. A lot of this is a copy/paste job pulling from existing settings and defaults from the resonant cookiecutter.

@BryonLewis please take a look when you get a chance. I'm particularly interested to know if you think I missed anything with respect to the existing deployments. The testing/dev environments seem to be set up correctly. I was able to successfully test the major features of the application with the new method of defining django settings.

@naglepuff naglepuff force-pushed the migrate-django-config branch 4 times, most recently from 0e4ea56 to d88a5b6 Compare June 4, 2025 21:05
@naglepuff naglepuff linked an issue Jun 5, 2025 that may be closed by this pull request
@naglepuff naglepuff force-pushed the migrate-django-config branch 3 times, most recently from ea5ecf7 to f33b42c Compare June 5, 2025 16:46
@naglepuff naglepuff marked this pull request as ready for review June 6, 2025 17:14
@naglepuff naglepuff requested a review from BryonLewis June 6, 2025 17:14
@naglepuff naglepuff force-pushed the migrate-django-config branch from f669078 to e3f8210 Compare June 25, 2025 19:18
@naglepuff naglepuff force-pushed the migrate-django-config branch from 0f46812 to 3aed18a Compare July 7, 2025 22:04
Copy link
Collaborator

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

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

Could you remove the ./.tox file from this PR?

Some other minor questions/changes

DEPLOYMENT.md Outdated

Then run `docker compose -f docker-compose.prod.yml run \
--rm django ./manage.py importGRTSCells /app/csv/grts.csv`
--rm django ./manage.py importGRTSCells /opt/django-project/app/csv/grts.csv`
Copy link
Collaborator

Choose a reason for hiding this comment

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

The mounting location for /app/csv/grts.csv needs to by synced between the overrride docker compose in the root of the proejct and the ./prod/docker-compose.prod.yml.

docker-compose.override.yml - has it at this location where it will be under /opt/django-project/app/csv/grts.csv
./prod/docker-compose.prod.yml - has it mounted at /app/csv/grts.csv

We needs these to probably be consistent or have two different instructions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we should just be able to change the /app/ part to /dev, and remove the mount entirely. The prod dockerfile copies everything in its context into the /opt/django-project directory, so as long as it is built with that file in context, it should work ok.

For dev/the override, we mount the root directory to /opt/django-project, so I think it would just be the same command for both. I also see this as the only reference to running the command in the codebase. Maybe we should add something to the root's README?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah if you don't mind adding someting.

def get_or_create_processing_task(request_id):
"""
Fetches or creates a ProcessingTask with the given metadata and status filters.
Fetch or creat a ProcessingTask with the given metadata and status filters.
Copy link
Collaborator

Choose a reason for hiding this comment

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

creates? Althought right now I'm noticiing this being used in multiple places, may be something that I refactor out into a utils location.

@@ -1,23 +1,2 @@
.DS_Store
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can leave it as is, but I'm curious about the adjustment to move client-specific ignores to the root while still maintaining this one for local .env files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could probably get rid of the client/.gitignore altogether. Any objections to that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That should work.

image: traefik
container_name: traefik
env_file: ./dev/.env.prod.docker-compose
env_file: ./.env.kitware-production.template
Copy link
Collaborator

Choose a reason for hiding this comment

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

further down: https://github.com/Kitware/batai/pull/181/files#diff-b23aa267b8a3bfc3bcca0f7f5b84b380f6b1b1ac8ff559abca8e3111ac5906e1R33
You changed the location of this file that is mounted so it needs to be updated

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm confused, isn't the template env file in the same directory as this docker compose file?

@naglepuff naglepuff force-pushed the migrate-django-config branch from a790397 to 812050c Compare July 15, 2025 21:30
@naglepuff naglepuff requested a review from BryonLewis July 16, 2025 18:01
Copy link
Collaborator

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

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

Just one comment about the node_modules and permissions but I don't think it needs to be resolved in this PR.

After this is merged I may have some other minor PR's as try to deploy in the different modes on the batdetectai.kitware.com server and attempt the subpath elements as well.

Comment on lines -51 to -53
# If node_modules is not writable by others, make it so the host can modify and delete them
[ \"\$(stat -c '%A' node_modules | cut -c9)\" != 'w' ] && chmod o+w node_modules;
# Always run the dev server
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought I added this to the last review but maybe I forgot to click to add the comment. This was done so that the host system when launched had access to delete and modify the node_modules folder without requiring a sudo chown -R ./client/node_modules. If you want to delete the node_modules or npm install new dependencies the host machine won't have write access to the folder because inside the container npm install is run by root.

This is similar to how django manage.py migrate creates a migration file using the root user. We can leave this for now. I'll see if I can find a way to make this easier for both instances.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe @brianhelba can help refresh my memory here, but I believe that adding the /app/node_modules as a volume gets around this issue.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah that means that it doesn't include a node_modules within the host. It allows the npm install to work in terms of editing the package and package-lock but won't actually install the dependency locally. I think it's fine for now and I'll review only if I start hitting annoying issues (which hopefulyl shouldn't happen often)

This is used by eslint, so we'll keep it for now.
Remove large image related packages
@naglepuff naglepuff merged commit 8203b99 into main Jul 17, 2025
4 checks passed
@naglepuff naglepuff linked an issue Jul 23, 2025 that may be closed by this pull request
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.

Remove django-compose configuration Use uv as the installer and update BatAI to use updated cookie-cutter

2 participants