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

Load admin-index fixtures in docker startup script #1296

Closed
wants to merge 3 commits into from

Conversation

alextreme
Copy link
Member

Taken from open_zaak Dockerfile

@alextreme alextreme requested review from swrichards and pi-sigma July 5, 2024 09:13
@codecov-commenter
Copy link

codecov-commenter commented Jul 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.10%. Comparing base (ab1950d) to head (73e2881).
Report is 23 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1296      +/-   ##
===========================================
- Coverage    95.13%   95.10%   -0.04%     
===========================================
  Files          983      983              
  Lines        35837    35845       +8     
===========================================
- Hits         34094    34090       -4     
- Misses        1743     1755      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pi-sigma pi-sigma left a comment

Choose a reason for hiding this comment

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

Can we exclude the possibility that fixtures need to be loaded in a certain order? Might not work for us even if it works for OpenZaak.

@alextreme alextreme marked this pull request as draft July 8, 2024 12:27
@alextreme
Copy link
Member Author

Afaik this only should be necessary for django-admin-index. The other fixtures in our project have unintended consequences.

Lets create a separate dir for the fixtures to be auto-loaded, and ensure that this fixture_dir is also copied over within our Dockerfile. Copying over the Open Zaak functionality is too simple and will break things

alextreme and others added 2 commits July 12, 2024 16:34
    - include autoload directory for fixtures that should be
      automatically loaded when building the Docker container
    - update generate_admin_index_fixture script to copy
      fixture to autoload directory
    - taken from the open_zaak Dockerfile
@pi-sigma pi-sigma force-pushed the issue/dimpact-105-autoload-fixtures branch from e0c0cab to 67f41ed Compare July 12, 2024 14:34
@pi-sigma pi-sigma changed the title Update docker_start.sh Load admin-index fixtures in docker startup script Jul 12, 2024
@pi-sigma
Copy link
Contributor

pi-sigma commented Jul 12, 2024

It seems that loading the django-admin-index fixture through Django's post-migrate signal is broken (see https://taiga.maykinmedia.nl/project/dimpact-enschede-ssc-ict-1/issue/107). Running the migrations produces the error, but manually loading the fixture immediately afterwards works (after updating the fixture, that is). I could not figure out why this started happening, so this needs further investigation.

For immediate purposes, I updated the fixture and disabled automatic loading via the signal for manual builds. I also updated the docker startup script, so we have the autoload functionality when the app is build and run with Docker.

@pi-sigma pi-sigma force-pushed the issue/dimpact-105-autoload-fixtures branch from 67f41ed to 73e2881 Compare July 12, 2024 15:43
@swrichards
Copy link
Contributor

swrichards commented Jul 15, 2024

@alextreme I discussed this with @pi-sigma and we identified two reasons autoload using the post_migration hook might fail:

  1. The fixture is out of date
  2. Not all the contenttypes on which the fixture depends are created

Both have been fixed in #1307. Point 1 is a structural issue that recurs quite frequently: the solution here is to add a CI step that warns us when the admin-index fixture is stale. A Taiga issue has been created for this the solution was more simply: simply add a test to load the fixtures, which I've now done in #1307.

With #1307 we should have the desired behavior in both vanilla and Docker environments. Given that we don't currently auto-load any other fixtures, we decided that this PR can be abandoned for now, until we actually have >1 fixtures we want to auto-load.

Closing this, but we can re-open it if you feel differently.

@swrichards swrichards closed this Jul 15, 2024
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.

4 participants