@@ -48,11 +48,12 @@ This is an example configuration for a Python project.
48
48
49
49
.. code-block :: bash
50
50
51
- # Name of nodes to start
52
- # here we have a single node
53
- CELERYD_NODES=" w1"
54
- # or we could have three nodes:
55
- # CELERYD_NODES="w1 w2 w3"
51
+ # Names of nodes to start
52
+ # most will only start one node:
53
+ CELERYD_NODES=" worker1"
54
+ # but you can also start multiple and configure settings
55
+ # for each in CELERYD_OPTS (see `celery multi --help` for examples).
56
+ CELERYD_NODES=" worker1 worker2 worker3"
56
57
57
58
# Absolute or relative path to the 'celery' command:
58
59
CELERY_BIN=" /usr/local/bin/celery"
@@ -75,80 +76,30 @@ This is an example configuration for a Python project.
75
76
CELERYD_PID_FILE=" /var/run/celery/%N.pid"
76
77
77
78
# Workers should run as an unprivileged user.
79
+ # You need to create this user manually (or you can choose
80
+ # a user/group combination that already exists, e.g. nobody).
78
81
CELERYD_USER=" celery"
79
82
CELERYD_GROUP=" celery"
80
83
84
+ # If enabled pid and log directories will be created if missing,
85
+ # and owned by the userid/group configured.
86
+ CELERY_CREATE_DIRS=1
87
+
88
+
81
89
.. _generic-initd-celeryd-django-example :
82
90
83
91
Example Django configuration
84
92
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85
93
86
- This is an example configuration for those using `django-celery `:
87
-
88
- .. code-block :: bash
89
-
90
- # Name of nodes to start, here we have a single node
91
- CELERYD_NODES=" w1"
92
- # or we could have three nodes:
93
- # CELERYD_NODES="w1 w2 w3"
94
-
95
- # Where to chdir at start.
96
- CELERYD_CHDIR=" /opt/Myproject/"
97
-
98
- # How to call "manage.py celery"
99
- CELERY_BIN=" $CELERYD_CHDIR /manage.py celery"
100
-
101
- # Extra command-line arguments for the worker (see celery worker --help).
102
- CELERYD_OPTS=" --time-limit=300 --concurrency=8"
103
-
104
- # %n will be replaced with the nodename.
105
- CELERYD_LOG_FILE=" /var/log/celery/%n.log"
106
- CELERYD_PID_FILE=" /var/run/celery/%n.pid"
107
-
108
- # Workers should run as an unprivileged user.
109
- CELERYD_USER=" celery"
110
- CELERYD_GROUP=" celery"
111
-
112
- # Name of the projects settings module.
113
- export DJANGO_SETTINGS_MODULE=" MyProject.settings"
114
-
115
- .. _generic-initd-celeryd-django-with-env-example :
116
-
117
- Example Django configuration Using Virtualenv
118
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119
-
120
- In case you are using virtualenv, you should add the path to your
121
- environment's python interpreter:
94
+ You should use the same template as above, but make sure the
95
+ ``DJANGO_SETTINGS_MODULE `` variable is set (and exported), and that
96
+ ``CELERYD_CHDIR `` is set to the projects directory:
122
97
123
98
.. code-block :: bash
124
99
125
- # Name of nodes to start, here we start three nodes (worker1,
126
- # worker2, and worker3)
127
- CELERYD_NODES=" worker1 worker2 worker3"
128
-
129
- # Where to chdir at start.
130
- CELERYD_CHDIR=" /opt/Myproject/"
131
-
132
- # Python interpreter from environment.
133
- ENV_PYTHON=" $CELERYD_CHDIR /env/bin/python"
134
-
135
- # How to call "manage.py celery"
136
- CELERYD_MULTI=" $CELERYD_CHDIR /env/bin/celeryd-multi"
137
- CELERY_BIN=" $ENV_PYTHON $CELERYD_CHDIR /manage.py celery"
138
-
139
- # Extra command-line arguments to the worker (see celery worker --help)
140
- CELERYD_OPTS=" --time-limit=300 --concurrency=8"
141
-
142
- # %n will be replaced with the nodename.
143
- CELERYD_LOG_FILE=" /var/log/celery/%n.log"
144
- CELERYD_PID_FILE=" /var/run/celery/%n.pid"
145
-
146
- # Workers should run as an unprivileged user.
147
- CELERYD_USER=" celery"
148
- CELERYD_GROUP=" celery"
100
+ export DJANGO_SETTINGS_MODULE=" settings"
149
101
150
- # Name of the projects settings module.
151
- export DJANGO_SETTINGS_MODULE=" MyProject.settings"
102
+ CELERYD_CHDIR=" /opt/MyProject"
152
103
153
104
.. _generic-initd-celeryd-options :
154
105
@@ -157,6 +108,8 @@ Available options
157
108
158
109
* CELERY_APP
159
110
App instance to use (value for ``--app `` argument).
111
+ If you're still using the old API, or django-celery, then you
112
+ can omit this setting.
160
113
161
114
* CELERY_BIN
162
115
Absolute or relative path to the :program: `celery ` program.
@@ -167,19 +120,14 @@ Available options
167
120
* :file: `/virtualenvs/proj/bin/celery `
168
121
* :file: `/virtualenvs/proj/bin/python -m celery `
169
122
170
- * CELERYD_MULTI
171
- Absolute or relative path to the program `celeryd-multi `, which is used to start multiple celeryd instances,
172
- Examples:
173
-
174
- * :file: `celeryd-multi `
175
- * :file: `/virtualenvs/proj/bin/celeryd-multi `
176
-
177
123
* CELERYD_NODES
178
- Node names to start.
124
+ List of node names to start (separated by space) .
179
125
180
126
* CELERYD_OPTS
181
127
Additional command-line arguments for the worker, see
182
- `celery worker --help ` for a list.
128
+ `celery worker --help ` for a list. This also supports the extended
129
+ syntax used by `multi ` to configure settings for individual nodes.
130
+ See `celery multi --help ` for some multi-node configuration examples.
183
131
184
132
* CELERYD_CHDIR
185
133
Path to change directory to at start. Default is to stay in the current
@@ -251,53 +199,15 @@ This is an example configuration for a Python project:
251
199
Example Django configuration
252
200
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
253
201
254
- This is an example configuration for those using ` django-celery `
255
-
256
- `/etc/default/celerybeat ` :
202
+ You should use the same template as above, but make sure the
203
+ `` DJANGO_SETTINGS_MODULE `` variable is set (and exported), and that
204
+ `` CELERYD_CHDIR `` is set to the projects directory :
257
205
258
206
.. code-block :: bash
259
207
260
- # Where the Django project is.
261
- CELERYBEAT_CHDIR=" /opt/Project/"
262
-
263
- # Name of the projects settings module.
264
208
export DJANGO_SETTINGS_MODULE=" settings"
265
209
266
- # Path to celery command
267
- CELERBEAT=" /opt/Project/manage.py celery beat"
268
-
269
- # Extra arguments to celerybeat
270
- CELERYBEAT_OPTS=" --schedule=/var/run/celerybeat-schedule"
271
-
272
- # Overrider default log and/or PID file locations
273
- CELERYBEAT_LOG_FILE=" /var/log/celerybeat.log"
274
- CELERYBEAT_PID_FILE=" /var/run/celerybeat.pid"
275
-
276
- .. _generic-initd-celerybeat-django-width-env-example :
277
-
278
- Example Django configuration Using Virtualenv
279
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280
-
281
- In case you are using virtualenv, you should add the path to your
282
- environment's python interpreter:
283
-
284
- `/etc/default/celerybeat `:
285
-
286
- .. code-block :: bash
287
-
288
- # Where the Django project is.
289
- CELERYBEAT_CHDIR=" /opt/Project"
290
-
291
- # Name of the projects settings module.
292
- export DJANGO_SETTINGS_MODULE=" settings"
293
-
294
- # Path to celery command
295
- ENV_PYTHON=" $CELERYD_CHDIR /env/bin/python"
296
- CELERYBEAT=" $ENV_PYTHON $CELERYBEAT_CHDIR /manage.py celery beat"
297
-
298
- # Extra arguments to celerybeat
299
- CELERYBEAT_OPTS=" --schedule=/var/run/celerybeat-schedule"
300
-
210
+ CELERYD_CHDIR=" /opt/MyProject"
301
211
.. _generic-initd-celerybeat-options :
302
212
303
213
Available options
@@ -306,16 +216,6 @@ Available options
306
216
* CELERY_APP
307
217
App instance to use (value for ``--app `` argument).
308
218
309
- * CELERYBEAT
310
- Absolute or relative path to the :program: `celery beat ` program.
311
- Examples:
312
-
313
- * :file: `celerybeat `
314
- * :file: `/usr/local/bin/celerybeat `
315
- * :file: `/virtualenvs/proj/bin/celerybeat `
316
- * :file: `/opt/Project/manage.py celery beat `
317
- * :file: `/virtualenvs/proj/bin/python -m celerybeat `
318
-
319
219
* CELERYBEAT_OPTS
320
220
Additional arguments to celerybeat, see `celerybeat --help ` for a
321
221
list.
0 commit comments