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
Ensure we only rebuild indexes when necessary #265
base: main
Are you sure you want to change the base?
Conversation
Breaking the automatic creation of stats for collectstatic is absolutely fine, but I wonder if a better way is to rely less on make for docker builds and drive those Django commands directly. I assume (but may be wrong) that the preferred way (if not now then in theory in future) of doing dev is via docker, so make stops being a sensible choice fairly quickly. Prior to this PR the semantics of My instinct is to break the OR don't do that and change the commit message to state that it's fine but slightly confusing but we can't eliminate use of make because of the current complexity of CSS building. |
a5c993e
to
04c61f2
Compare
@jaylett The more I think about it, the more I think the correct solution here is for me to not be quite so lazy, and to make the To make that work well, though, I've had to remove the mission name from the graph files (which appear to date back to the fort, and are the only images with that namespacing, and seem to work fine without) and make it possible to build a single mission's graphs. It doesn't seem like Docker's To your wider point: I'm already using Docker as the default way to develop (and updated the readme to suggest that's the default, too), but am of the opinion that the (I've pushed a Let me know what you think! |
Yes, that looks better to me than what I was suggesting. Does there need to be a note somewhere about what will Just Work and what Required Commands when developing? Since some of it will be baked into the container, I assume that sometimes you need to stop and rebuild, depending on what you're editing? |
657eeae
to
698273c
Compare
Previously, we were reindexing on every container rebuild, regardless of whether the mission data or backend code had changed. Given these are the only things that actually impact indexing, though, we can copy just those to the container, reindex, then copy everything else, meaning that in the majority of cases, container builds are much faster because they're not spending 3-4 minutes reindexing. To make this work, I've made the Makefile more accurately describe the dependency relationship between stats graphs (at least, the 0th graph, which every mission will have) and transcript files. That way, the later call to `make collectstatic` doesn't try to re-run the previously always-run `make statsporn`. Because of a limitation in GNU Make's patterns (pattern targets can only have one `%`), we have to remove the mission ID from the graph files. This mission ID doesn't appear to serve any purpose (and are only used on graph images), and dates back to the fort. There's a slightly weird behaviour in Docker's `COPY` that means it doesn't appear to properly maintain file timestamps when building containers, so the images are always regenerated when building the container (no change from before), but CI builds always start clean, so that's only a slight issue locally (where we might have already built the images).
This allows us to pass a list of mission names for generation. It could probably be smarter, de-duping and so on, but we don't really need that.
I missed a few things when updating the README to migrate us to a Docker-first world. Specifically, the guidance on reindexing mission content wasn't clear enough on what to do. This also fixes a couple of typos, and updates the deployment guidance now we have continuous deployment to Fly set up.
698273c
to
70806e7
Compare
Most of that is actually documented already, but I've noticed a few inconsistencies in the README, so have gone through with a fine-toothed comb to update the guidance on reindexing. I've also rebased to integrate the |
I've just noticed, however, that the current build process (even prior to these changes) results in non-existent graphs in the dev environment unless you've already built them another way (or run the build process in-container with the external filesystem mounted). I'll work out a fix for that separately (as with getting search working in dev). |
Previously, we were reindexing on every container rebuild, regardless of whether the mission data or backend code had changed.
Given these are the only things that actually impact indexing, though, we can copy just those to the container, reindex, then copy everything else, meaning that in the majority of cases, container builds are much faster because they're not spending 3-4 minutes reindexing.
To make this work, I've made the Makefile more accurately describe the dependency relationship between stats graphs (at least, the 0th graph, which every mission will have) and transcript files. That way, the later call to
make collectstatic
doesn't try to re-run the previously always-runmake statsporn
.This also enables single-mission stats generation, and clarifies some instructions in the README around reindexing (and some other minor bits and bobs).