Skip to content

Commit

Permalink
Add support for other task serializers
Browse files Browse the repository at this point in the history
By adding `CELERY_RESULT_SERIALIZER`, `CELERY_TASK_SERIALIZER`
and `CELERY_ACCEPT_CONTENT` configs.
  • Loading branch information
slafs committed Dec 18, 2015
1 parent 7976785 commit bb038d2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2015-12-18

- added `CELERY_RESULT_SERIALIZER`, `CELERY_TASK_SERIALIZER`
and `CELERY_ACCEPT_CONTENT` configs to avoid `C_FORCE_ROOT` env var
(default values support `pickle` for backwards compatibility).

## 2015-11-16

- updated ``Sentry`` to 7.7.4
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ You can also set a different ``BROKER_URL`` via environment file by adding this:
You can run as many celery worker containers as you want but remember that only one of them should be run with ``-B`` option.
If you're using default values for `CELERY_RESULT_SERIALIZER`, `CELERY_TASK_SERIALIZER`
and `CELERY_ACCEPT_CONTENT` (default values support `pickle`)
you have to set `C_FORCE_ROOT` env var (to say `1`)
to be able to run celery as a `root` user.
You can avoid this by setting those three to `json`.
Refer to [Celery's serializer docs](docs.celeryproject.org/en/latest/userguide/security.html#serializers)
for more info about security implications of using `pickle` as a task serialization format.
#### Time-series storage with redis
To have [time-series data](http://sentry.readthedocs.org/en/latest/tsdb/index.html) you must add
Expand Down Expand Up @@ -189,7 +197,8 @@ See the ``AUTH_REMOTE_USER_*`` env variables below for further configuration.
## Available environment variables
Refer to [sentry documentation](http://sentry.readthedocs.org/en/latest/config/index.html),
[django documentation](https://docs.djangoproject.com/en/1.5/ref/settings/)
[django documentation](https://docs.djangoproject.com/en/1.6/ref/settings/),
[celery documentation](http://docs.celeryproject.org/en/latest/)
and [django-auth-ldap documentation](https://pythonhosted.org/django-auth-ldap/reference.html)
for the meaning of each setting.
Expand All @@ -201,6 +210,9 @@ DATABASE_URL | DATABASES
CACHE_URL | CACHES | | locmem:// |
CELERY_ALWAYS_EAGER | CELERY_ALWAYS_EAGER | bool | True |
SENTRY_BROKER_URL | BROKER_URL | | ``redis://<SENTRY_REDIS_HOST>:<SENTRY_REDIS_PORT>/1`` |
CELERY_RESULT_SERIALIZER | CELERY_RESULT_SERIALIZER | | ``pickle`` | You may want change it to ``json``. See http://docs.celeryproject.org/en/stable/configuration.html#celery-result-serializer
CELERY_TASK_SERIALIZER | CELERY_TASK_SERIALIZER | | ``pickle`` | You may want change it to ``json``. See http://docs.celeryproject.org/en/stable/configuration.html#celery-task-serializer
CELERY_ACCEPT_CONTENT | CELERY_ACCEPT_CONTENT | list | ``pickle,json`` | Comma separated values. You may want change it to ``json``. See http://docs.celeryproject.org/en/stable/configuration.html#celery-accept-content
SENTRY_REDIS_HOST | | | redis |
SENTRY_REDIS_PORT | | int | 6379 |
SENTRY_WEB_HOST | SENTRY_WEB_HOST | | 0.0.0.0 |
Expand Down
6 changes: 6 additions & 0 deletions environment.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ SECRET_KEY=
## celery
#CELERY_ALWAYS_EAGER=False
#SENTRY_BROKER_URL=redis://redis:6379/1
#CELERY_RESULT_SERIALIZER=json
#CELERY_TASK_SERIALIZER=json
#CELERY_ACCEPT_CONTENT=json

# if you're accepting pickled tasks (the default) you should enable this
#C_FORCE_ROOT=1

## make everything "public" (readable by all logged in users)
#SENTRY_PUBLIC=True
Expand Down
4 changes: 4 additions & 0 deletions sentry_docker_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def nydus_config(from_env_var):

BROKER_URL = config('SENTRY_BROKER_URL', default=DEFAULT_BROKER_URL)

CELERY_RESULT_SERIALIZER = config('CELERY_RESULT_SERIALIZER', default='pickle')
CELERY_TASK_SERIALIZER = config('CELERY_TASK_SERIALIZER', default='pickle')
CELERY_ACCEPT_CONTENT = config('CELERY_ACCEPT_CONTENT', default='pickle,json', cast=lambda x: x.split(','))

####################
# Update Buffers ##
####################
Expand Down

0 comments on commit bb038d2

Please sign in to comment.