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

Configure django rest applications using environment variables #1

Closed
annashamray opened this issue Feb 2, 2024 · 1 comment · Fixed by open-zaak/open-zaak#1572, #2 or open-zaak/open-notificaties#131
Assignees

Comments

@annashamray
Copy link
Contributor

annashamray commented Feb 2, 2024

Description

Registration APIs (but not limited to these projects) should be configurable without manual actions in the Admin (following the configuration-as-code infrastructure principle). So the configuration using only environment variables is needed for the following APIs:

  • Open Zaak (1st prio)
  • Open Notificaties (1st prio)
  • Objects API (2nd prio)
  • Objecttypes API (2nd prio)
  • Open Klant (2nd prio)

Tasklist

1st iteration

  • create a management command setup_configuration, which would run through all the configuration steps, execute them and (optionally) self-test them. This management command should be run in non-interactive mode. It can be executed in k8s job or init container.
  • The command should have an option overwrite, which will replace the existing configuration - making the command viable for first-time setup or to enforce a specific configuration
  • the steps and their order should be set up as a django setting in the same fashion as, for example, MIDDLEWARE variable
  • each step should have the same shape/signature and be a subclass of the same ConfigurationStep base class
  • each API will create its own configurations steps with provided env variables.

2nd iteration

  • some env variables can point to yaml files to store complicated configuration for the whole tables (for example, zgw_consumers.Service). The could be used to load data similar to django fixtures, but with a framework-agnostic format. Where relevant, the data in the YAML files should follow the shape/format as the API endpoints that disclose this information. The files can be mounted as files or configmaps (kubernetes) to provide them to the application container(s).
  • each relevant library loading the data is responsible for dictating the format, parsing, validating and importing the data
  • loading the data needs to happen in an atomic transaction by dropping existing records and re-inserting them, or possibly updating existing records (there is a complexity risk here with breaking FK references). The truncate + load approach is preferred for simplicity sake

Result / acceptance criteria

  • a docker compose for Open Zaak and Open Notificaties, which has with init containers with setup_configurationcommand. The APIs should be able to interaction with each other and pass a smoke test

Related issues in other projects

@annashamray annashamray self-assigned this Feb 2, 2024
@joeribekker
Copy link
Member

Example:

export OPEN_ZAAK_DEFAULT_SELECTIELIJST_YEAR=2020
export OPEN_ZAAK_AUTH_APPLICATIONS=/volumes/auth.yaml

$ python src/manage.py setup_configuration --overwrite 

This will set the default selectielijst year to 2020 and will store/overwrite all applications with the permission in the yaml file.

annashamray added a commit that referenced this issue Feb 9, 2024
annashamray added a commit that referenced this issue Feb 9, 2024
annashamray added a commit that referenced this issue Feb 9, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 15, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 15, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 15, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 15, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 15, 2024
annashamray added a commit that referenced this issue Feb 20, 2024
annashamray added a commit that referenced this issue Feb 21, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 21, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 21, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 21, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 21, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 21, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 23, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 23, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 23, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 23, 2024
annashamray added a commit to open-zaak/open-zaak that referenced this issue Feb 26, 2024
annashamray added a commit to open-zaak/open-notificaties that referenced this issue Apr 2, 2024
annashamray added a commit to open-zaak/open-notificaties that referenced this issue Apr 2, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objecttypes-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 22, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 23, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 23, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 23, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 23, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 23, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 23, 2024
annashamray added a commit to maykinmedia/objects-api that referenced this issue Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment