Skip to content

Commit 644aef9

Browse files
author
Lars Solberg
committed
celery/worker fixes
1 parent af7d5a6 commit 644aef9

5 files changed

Lines changed: 13 additions & 6 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ before_install:
1111

1212
script:
1313
- docker-compose build
14-
- docker-compose run -e DONTSTART=api `bash <(curl -s https://codecov.io/env)` api /data/opa/scripts/release-test.sh
14+
- docker-compose run -e MODE=manual `bash <(curl -s https://codecov.io/env)` api /data/opa/scripts/release-test.sh
1515
- curl -X POST ${CONTAINER_BUILD_TRIGGER}

api/root/etc/services.d/api/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/with-contenv sh
22

3-
[[ "${DONTSTART}" == "api" || "${MODE}" == "worker" || "${MODE}" == "manual" ]] && ( /usr/bin/s6-stopdisable api && exit 0 )
3+
[[ "${MODE:-api}" == "api" ]] || ( /usr/bin/s6-stopdisable api && exit 0 )
44

55
cd /data
66

api/root/etc/services.d/worker/run

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/with-contenv sh
22

3-
[[ "${DONTSTART}" == "worker" || "${MODE}" == "api" || "${MODE}" == "manual" ]] && ( /usr/bin/s6-stopdisable worker && exit 0 )
3+
[[ "${MODE}" == "worker" ]] || ( /usr/bin/s6-stopdisable worker && exit 0 )
44

55
cd /data
66

7-
exec sleep 1000
8-
7+
exec celery worker -A opa.main ${CELERY_PARAMS}

examples/docker-compose/celery-task/docker-compose.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ services:
1010
volumes:
1111
- ./plugins:/plugins
1212

13+
worker:
14+
image: opastack/api:latest
15+
environment:
16+
OPA_PLUGIN_PATHS: "/plugins"
17+
MODE: "worker"
18+
volumes:
19+
- ./plugins:/plugins
20+
1321
redis:
1422
image: "redis:5"
1523

examples/docker-compose/celery-task/plugins/celerydemo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from opa import get_router, Hook, get_instance, app
1+
from opa import get_router, Hook, get_instance
22

33

44
class celery_config(Hook):

0 commit comments

Comments
 (0)