backport changes from identity-system
Apologies that this is a mega commit. Most of it was semi-automatically generated from the history of the identity-system repo.
Back-port the recent changes from identity system. Specifically:
- Poetry is now used to manage dependencies. (See below for how we keep the poetry.lock fresh.)
- The compose/ directory, and associated shell scripts, have been removed in favour of more modern docker compose features.
- Helper poe tasks have been added to start the application, run migrations, etc.
- The production container no longer runs migrations when it starts. Our gcp-cloud-run-app terraform module now supports "pre-deploy jobs" which can be used to run migrations at deploy time.
- Pytest now manages the django database via Docker. This increases the flexibility w.r.t. running tests on the host versus within a container.
- GitLab CI configuration has been updated to use the common pipeline. In the fullness of time, webapp.gitlab-ci.yml may be moved into the common CI template repo.
- The API Gateway emulator is included and pre-configured. This isn't made optional because it is entirely transparent if the application doesn't make use of it.
- One can now generate "pure" API applications without a TypeScript UI or the ui module.
- Pre-commit checks have been added.
- There is one Dockerfile which builds various flavours of image using multi-stage builds.
Test suite changes
The test suite (for this repo, not the boilerplate) has been updated to run the pre-commit checks in the generated template along with checking that the tox test suite passes in the generated template.
Complexity multiplication
We have a bit of a complexity multiplication going on with the various "optional" bits of the template. I've decided that I don't want to add more axes of variation and so I've replaced the "use ucamlookup" option with "include UI" so we keep our existing count of 2 options. These are now:
- "Has UI" versus "pure API"
- "Respects X-Forward-Protocol" versus "ignores X-Forward-Protocol"
The reason to keep these small is that the test suite has been updated in this commit to try and run pre-commit checks and tox for:
- The default configuration
- Disabling UI
- Disabling Respects X-Forward-Protocol
Adding more options would make that test matrix grow quite large.
Adding ucamlookup is a pretty straightforward process and is no more complex than adding any other django support module we may want for a particular application.
Coockiecutter enhancements
Some quality of life improvements have been added to the cookiecutter template:
- The poetry.lock file is generated when the boilerplate is created. This means that we at least start life with a fresh set of dependencies. It also means we don't need to maintain a poetry.lock file in this repo.
- If the boilerplate is not being created into an existing git repository, a new one is created and the boilerplate output is added as the first commit.
The auto-commit is intended to make it easier to have the "initial functionality" MR when starting a new project. One can commit the boilerplate output directly to main and have a MR containing just the changes from the boilerplate.
Closes #80 (closed)