django-cloud-tasks icon indicating copy to clipboard operation
django-cloud-tasks copied to clipboard

IAM Documentation and additional configurations

Open jrobichaud opened this issue 1 year ago • 3 comments

Hi,

The documentation states we must enable 3 API (Cloud Task, Cloud Scheduler and Admin SDK) in GCP and the rest appears to be django project configuration.

However I believe there is more to do in order to be fully configured unless there is something I missed. Ex: add IAM to the service account and create pubsub.

On Demand Task:

I suppose we must add Cloud Tasks Enqueuer at least https://cloud.google.com/tasks/docs/reference-access-control

Any others?

Periodic Task

What IAM are needed for

python manage.py schedule_tasks

to work?

Publisher

I suppose some pubsub IAM are needed for publisher or subscriber

Its not stated but I assume the topics must be created manually as well (using GCP's interface or with terraform) and are not managed by a django command.

jrobichaud avatar Jan 12 '24 22:01 jrobichaud

I confirm Cloud Tasks Enqueuer is required to be able to enqueue a task.

Cloud Tasks Queue Admin is required if you want to let gcp-pilot create the queue for you. Not needed if you created it yourself (ex: with terraform).

jrobichaud avatar Jan 16 '24 18:01 jrobichaud

This should be specified in the documentation too:

INSTALLED_APPS = [
    #...
    "django_cloud_tasks",
    #...
]

jrobichaud avatar Jan 16 '24 20:01 jrobichaud

I keep hitting IAM issues with my setup here. Service account has all of the mentioned roles but the error below happens whenever testing.

File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 81, in error_remapped_callable raise exceptions.from_grpc_error(exc) from exc google.api_core.exceptions.PermissionDenied: 403 Permission denied on resource project appspot.gserviceaccount.com. [links { description: "Google developers console" url: "https://console.developers.google.com" } , reason: "CONSUMER_INVALID" domain: "googleapis.com" metadata { key: "service" value: "cloudtasks.googleapis.com" } metadata { key: "consumer" value: "projects/appspot.gserviceaccount.com" }

jc15100 avatar Feb 19 '24 02:02 jc15100