Skip to content

Commit

Permalink
Merge pull request teamhephy#33 from jianxiaoguo/dev
Browse files Browse the repository at this point in the history
chore(controller): CELERY_BROKER use rabbitmq and modify celery-deplo…
  • Loading branch information
duanhongyi authored Jan 18, 2021
2 parents 1579ee4 + 3fd00b8 commit b6118e4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions charts/controller/templates/controller-celery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ spec:
labels:
app: drycc-controller-celery
spec:
serviceAccount: drycc-controller-celery
containers:
- name: drycc-controller-celery-high
image: {{.Values.image_registry}}{{.Values.org}}/controller:{{.Values.image_tag}}
Expand Down Expand Up @@ -62,4 +61,4 @@ spec:
{{- include "controller.envs" . | indent 10 }}
{{- include "controller.volumeMounts" . | indent 10 }}
imagePullPolicy: {{.Values.image_pull_policy}}
{{- include "controller.volumes" . | indent 6 }}
{{- include "controller.volumes" . | indent 6 }}
3 changes: 1 addition & 2 deletions charts/controller/templates/controller-cronjob-daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- /bin/bash
- -c
args:
- python /app/manage.py push_data_to_influxdb
- python /app/manage.py load_db_state_to_k8s
{{- include "controller.envs" . | indent 12 }}
volumeMounts:
- mountPath: /etc/slugrunner
Expand Down Expand Up @@ -79,4 +79,3 @@ spec:
{{- include "controller.envs" . | indent 12 }}
{{- include "controller.volumeMounts" . | indent 12 }}
{{- include "controller.volumes" . | indent 10 }}

1 change: 1 addition & 0 deletions rootfs/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositor
shadow \
postgresql \
redis \
rabbitmq-server \
&& mkdir -p /run/postgresql $PGDATA \
&& chown -R postgres:postgres /run/postgresql $PGDATA \
&& apk del .build-deps \
Expand Down
3 changes: 1 addition & 2 deletions rootfs/api/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,7 @@
CELERY_TASK_TIME_LIMIT = 30 * 60
CELERYD_MAX_TASKS_PER_CHILD = 200
CELERY_TASK_RESULT_EXPIRES = 24 * 60 * 60
CELERY_BROKER_URL ='redis://:{}@{}'.format(DRYCC_REDIS_PASSWORD, DRYCC_REDIS_ADDRS[0]) # noqa
CELERY_RESULT_BACKEND = 'redis://:{}@{}'.format(DRYCC_REDIS_PASSWORD, DRYCC_REDIS_ADDRS[0]) # noqa
CELERY_BROKER_URL = os.environ.get('DRYCC_RABBITMQ_URL', 'amqp://guest:[email protected]:5672/') # noqa
CELERY_CACHE_BACKEND = 'django-cache'
CELERY_DEFAULT_QUEUE = 'priority.middle'

Expand Down
7 changes: 7 additions & 0 deletions rootfs/bin/test-unit
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ function start_redis() {
cd -
}

function start_rabbitmq() {
cd /tmp
nohup rabbitmq-server > /var/log/rabbitmq.log 2>&1 &
cd -
}

function start_celery() {
cd /tmp
nohup su-exec nobody celery -A api worker -Q priority.low,priority.middle,priority.high --loglevel=info > /var/log/celery.log 2>&1 &
Expand All @@ -20,6 +26,7 @@ function start_celery() {

su-exec postgres pg_ctl -D "$PGDATA" start
start_redis
start_rabbitmq
start_celery
python3 manage.py check
coverage run manage.py test --settings=api.settings.testing --noinput api scheduler.tests
Expand Down

0 comments on commit b6118e4

Please sign in to comment.