-
Notifications
You must be signed in to change notification settings - Fork 12
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
📝 [#521] Update docs for setup-config #527
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fe94eb9
:arrow_up: [#521] Upgrade django-setup-configuration to 0.7.1
stevenbal 377c664
:arrow_up: [#521] Upgrade zgw-consumers to 0.37.0
stevenbal a161510
:arrow_up: [#521] Upgrade notifications-api-common to 0.6.0
stevenbal b640b28
:arrow_up: [#521] Upgrade mozilla-django-oidc-db to 0.22.0
stevenbal 0494098
:memo: [#521] Update docs for setup-config
stevenbal ee5a75f
:alien: [#521] Fix ObjectsKanaal.get_kenmerken for new lib version
stevenbal 9b6dabd
:white_check_mark: [#521] Fix tests for changed setup-configuration b…
stevenbal 395ffaf
:wrench: [#521] Install gdal packages in readthedocs build
stevenbal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,216 +5,73 @@ | |
Configuration (CLI) | ||
=================== | ||
|
||
After deploying Objecttypes API and Objects API, they need to be configured to be fully functional. The | ||
command line tool `setup_configuration`_ assist with this configuration: | ||
|
||
You can get the full command documentation with: | ||
|
||
.. code-block:: bash | ||
|
||
src/manage.py setup_configuration --help | ||
|
||
.. warning:: This command is declarative - if configuration is manually changed after | ||
running the command and you then run the exact same command again, the manual | ||
changes will be reverted. | ||
|
||
.. _`setup_configuration`: https://github.com/maykinmedia/django-setup-configuration/ | ||
|
||
Preparation | ||
=========== | ||
|
||
The command executes the list of pluggable configuration steps, and each step | ||
requires specific configuration information, that should be prepared. | ||
Here is the description of all available configuration steps and the configuration | ||
format, use by each step. | ||
.. setup-config-usage:: | ||
:show_command_usage: true | ||
:show_steps: false | ||
:show_steps_toc: false | ||
:show_steps_autodoc: false | ||
|
||
Objects API | ||
=========== | ||
|
||
Objecttypes configuration | ||
------------------------- | ||
|
||
To configure objecttypes the following configuration could be used: | ||
|
||
.. code-block:: yaml | ||
|
||
zgw_consumers_config_enable: true | ||
zgw_consumers: | ||
services: | ||
- identifier: objecttypen-foo | ||
label: Objecttypen API Foo | ||
api_root: http://objecttypen.foo/api/v1/ | ||
api_type: orc | ||
auth_type: api_key | ||
header_key: Authorization | ||
header_value: Token ba9d233e95e04c4a8a661a27daffe7c9bd019067 | ||
|
||
- identifier: objecttypen-bar | ||
label: Objecttypen API Bar | ||
api_root: http://objecttypen.bar/api/v1/ | ||
api_type: orc | ||
auth_type: api_key | ||
header_key: Authorization | ||
header_value: Token b9f100590925b529664ed9d370f5f8da124b2c20 | ||
|
||
objecttypes_config_enable: true | ||
objecttypes: | ||
items: | ||
- uuid: b427ef84-189d-43aa-9efd-7bb2c459e281 | ||
name: Object Type 1 | ||
service_identifier: objecttypen-foo | ||
|
||
- uuid: b0e8553f-8b1a-4d55-ab90-6d02f1bcf2c2 | ||
name: Object Type 2 | ||
service_identifier: objecttypen-bar | ||
... | ||
|
||
.. note:: The ``uuid`` field will be used to lookup existing ``ObjectType``'s. | ||
|
||
Objecttypes require a corresponding ``Service`` to work correctly. Creating | ||
these ``Service``'s can be done by defining these in the same yaml file. ``Service`` | ||
instances will be created before the ``ObjectType``'s are created. | ||
|
||
Objecttypes connection configuration | ||
------------------------------------ | ||
|
||
In order to be able to retrieve objecttypes, a corresponding ``Service`` should be | ||
created. An example of a configuration could be seen below: | ||
.. setup-config-usage:: | ||
:show_command_usage: false | ||
|
||
.. code-block:: yaml | ||
|
||
zgw_consumers_config_enable: true | ||
zgw_consumers: | ||
services: | ||
- identifier: objecttypes-api-1 | ||
label: Objecttypes API 1 | ||
api_root: http://objecttypes-1.local/api/v1/ | ||
api_connection_check_path: objecttypes | ||
api_type: orc | ||
auth_type: api_key | ||
header_key: Authorization | ||
header_value: Token ba9d233e95e04c4a8a661a27daffe7c9bd019067 | ||
- identifier: objecttypes-api-2 | ||
label: Objecttypes API 2 | ||
api_root: http://objecttypes-2.local/api/v1/ | ||
api_connection_check_path: objecttypes | ||
api_type: orc | ||
auth_type: api_key | ||
header_key: Authorization | ||
header_value: Token b9f100590925b529664ed9d370f5f8da124b2c20 | ||
|
||
|
||
Tokens configuration | ||
-------------------- | ||
Create or update the (single) YAML configuration file with your settings: | ||
|
||
.. code-block:: yaml | ||
Objecttypes API | ||
=============== | ||
|
||
tokenauth_config_enable: true | ||
tokenauth: | ||
items: | ||
- identifier: token-1 | ||
token: ba9d233e95e04c4a8a661a27daffe7c9bd019067 | ||
contact_person: Person 1 | ||
email: [email protected] | ||
organization: Organization XYZ # optional | ||
application: Application XYZ # optional | ||
administration: Administration XYZ # optional | ||
permissions: | ||
- object_type: b427ef84-189d-43aa-9efd-7bb2c459e281 | ||
mode: read_and_write | ||
|
||
- identifier: token-2 | ||
token: 7b2b212d9f16d171a70a1d927cdcfbd5ca7a4799 | ||
contact_person: Person 2 | ||
email: [email protected] | ||
permissions: | ||
- object_type: b0e8553f-8b1a-4d55-ab90-6d02f1bcf2c2 | ||
mode: read_only | ||
use_fields: true | ||
fields: | ||
'1': | ||
- record__data__leeftijd | ||
- record__data__kiemjaar | ||
|
||
.. note:: To ensure the proper functioning of the tokens, it is essential to first configure the ``objecttypes``. | ||
Then, the token configuration must be completed to guarantee the correct configuration of the ``Permissions``. | ||
|
||
|
||
Mozilla-django-oidc-db | ||
---------------------- | ||
|
||
Create or update the (single) YAML configuration file with your settings: | ||
.. FIXME these can currently only be included manually, because these docs are built in | ||
.. the objects API repo | ||
|
||
.. code-block:: yaml | ||
.. autoclass:: django_setup_configuration.contrib.sites.steps.SitesConfigurationStep | ||
:noindex: | ||
.. setup-config-example:: django_setup_configuration.contrib.sites.steps.SitesConfigurationStep | ||
|
||
oidc_db_config_enable: true | ||
oidc_db_config_admin_auth: | ||
items: | ||
- identifier: admin-oidc | ||
oidc_rp_client_id: client-id | ||
oidc_rp_client_secret: secret | ||
endpoint_config: | ||
oidc_op_authorization_endpoint: https://example.com/realms/test/protocol/openid-connect/auth | ||
oidc_op_token_endpoint: https://example.com/realms/test/protocol/openid-connect/token | ||
oidc_op_user_endpoint: https://example.com/realms/test/protocol/openid-connect/userinfo | ||
.. autoclass:: mozilla_django_oidc_db.setup_configuration.steps.AdminOIDCConfigurationStep | ||
:noindex: | ||
.. setup-config-example:: mozilla_django_oidc_db.setup_configuration.steps.AdminOIDCConfigurationStep | ||
|
||
# workaround for https://github.com/maykinmedia/django-setup-configuration/issues/27 | ||
userinfo_claims_source: id_token | ||
|
||
More details about configuring mozilla-django-oidc-db through ``setup_configuration`` | ||
can be found at the _`documentation`: https://mozilla-django-oidc-db.readthedocs.io/en/latest/setup_configuration.html. | ||
**objecttypes.setup_configuration.steps.token_auth.TokenAuthConfigurationStep** | ||
------------------------------------------------------------------------------- | ||
|
||
Sites configuration | ||
------------------- | ||
Configure tokens with permissions for other applications to access Objectstypes API | ||
|
||
.. code-block:: yaml | ||
|
||
sites_config_enable: true | ||
sites_config: | ||
items: | ||
- domain: example.com | ||
name: Example site | ||
- domain: test.example.com | ||
name: Test site | ||
tokenauth_config_enable: true | ||
tokenauth: | ||
|
||
More details about sites configuration through ``setup_configuration`` | ||
can be found at the _`site documentation`: https://github.com/maykinmedia/django-setup-configuration/blob/main/docs/sites_config.rst | ||
|
||
|
||
Notifications configuration | ||
--------------------------- | ||
|
||
To configure sending notifications for the application ensure there is a ``services`` | ||
item present that matches the ``notifications_api_service_identifier`` in the | ||
``notifications_config`` namespace: | ||
|
||
.. code-block:: yaml | ||
# REQUIRED: true | ||
items: | ||
- | ||
|
||
zgw_consumers_config_enable: true | ||
zgw_consumers: | ||
services: | ||
- identifier: notifications-api | ||
label: Notificaties API | ||
api_root: http://notificaties.local/api/v1/ | ||
api_connection_check_path: notificaties | ||
api_type: nrc | ||
auth_type: api_key | ||
# DESCRIPTION: A human-friendly label to refer to this token | ||
# REQUIRED: true | ||
identifier: objects-api | ||
|
||
notifications_config_enable: true | ||
notifications_config: | ||
notifications_api_service_identifier: notifications-api | ||
notification_delivery_max_retries: 1 | ||
notification_delivery_retry_backoff: 2 | ||
notification_delivery_retry_backoff_max: 3 | ||
# REQUIRED: true | ||
token: modify-this | ||
|
||
Execution | ||
========= | ||
# DESCRIPTION: Name of the person in the organization who can access the API | ||
# REQUIRED: true | ||
contact_person: example_string | ||
|
||
# DESCRIPTION: Email of the person, who can access the API | ||
# REQUIRED: true | ||
email: example_string | ||
|
||
With the full command invocation, everything is configured at once and immediately | ||
tested. | ||
# DESCRIPTION: Organization which has access to the API | ||
# DEFAULT VALUE: "" | ||
# REQUIRED: false | ||
organization: example_string | ||
|
||
.. code-block:: bash | ||
# DESCRIPTION: Application which has access to the API | ||
# DEFAULT VALUE: "" | ||
# REQUIRED: false | ||
application: example_string | ||
|
||
src/manage.py setup_configuration --yaml-file /path/to/config.yaml | ||
# DESCRIPTION: Administration which has access to the API | ||
# DEFAULT VALUE: "" | ||
# REQUIRED: false | ||
administration: example_string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there is a better way to do this, unless we want to give Objecttypes its own RTD page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good for now
Not sure if we want a separate RTD and separate issue tracker for Objecttypes