ansible / eda-server

Event Driven Ansible for AAP
Apache License 2.0
59 stars 35 forks source link

feat: run scheduled tasks to sync shared resources from gateway #932

Closed bzwei closed 1 month ago

bzwei commented 1 month ago

Resync the resources every 15 seconds minutes. Enabled only when DIRECT_SHARED_RESOURCE_MANAGEMENT_ENABLED is turned no. Need to configure the RESOURCE_SERVER's URL, SECRET_KEY, and RESOURCE_JWT_USER_ID before use.

AAP-23724: EDA: Schedule Sync Task

STEPS to prepare the dev environment:

  1. start the gateway
  2. find the jwt_user_id through API https://<gateway>/api/gateway/v1/users (for the first time) find the ansible_id of user _system
  3. create a secret_key on the gateway shell (inside the gateway container) (for the first time) django-admin generate_service_secret eda
  4. export the following ENVS and start eda-server: EDA_RESOURCE_SERVER__URL=https://<gateway ip, not localhost> EDA_RESOURCE_JWT_USER_ID=<ansible_id from step 2> EDA_RESOURCE_SERVER__SECRET_KEY=<output from step 3> There will be errors in the default worker logs. Proceed to step 5.
  5. run service migrate data on the gateway shell (for the first time) django-admin migrate_service_data --api-slug eda --username admin Worker errors should go away.
bzwei commented 1 month ago

Added

@bzwei could you extend the docstring here to document these new variables? They seem important enough to clarify them. https://github.com/ansible/eda-server/blob/main/src/aap_eda/settings/default.py#L14

bzwei commented 1 month ago

@jamesmarshall24 @rooftopcellist This PR expects EDA_RESOURCE_SERVERURL, EDA_RESOURCE_SERVERSECRET_KEY , EDA_RESOURCE_SERVER__VALIDATE_HTTPS, EDA_RESOURCE_JWT_USER_ID, and optionally EDA_RESOURCE_SERVICE_PATH