@ -100,6 +100,8 @@ ENV CI_PROJECT_URL=${CI_PROJECT_URL}
|
||||
ENV CI_COMMIT_SHA=${CI_COMMIT_SHA}
|
||||
ENV CI_COMMIT_TAG=${CI_COMMIT_TAG}
|
||||
|
||||
ENV IS_WORKER=False
|
||||
|
||||
|
||||
COPY requirements.txt requirements.txt
|
||||
COPY requirements_test.txt requirements_test.txt
|
||||
|
@ -50,7 +50,7 @@ The [web container](https://hub.docker.com/r/nofusscomputing/centurion-erp) is t
|
||||
|
||||
### Background Worker Container
|
||||
|
||||
The [Background Worker container](https://hub.docker.com/r/nofusscomputing/centurion-erp) is a worker that waits for tasks sent to the RabbitMQ server. The worker is based upon [Celery](https://docs.celeryq.dev/en/stable/index.html). On the worker not being busy, it'll pickup and run the task. This container is scalable with nil additional requirements for launching additional workers. If deploying to Kubernetes the setting the deployment `replicas` to the number of desired containers is the simplest method to scale. The container start command will need to be set to `celery -A app worker -l INFO` so that the worker is started on container startup.
|
||||
The [Background Worker container](https://hub.docker.com/r/nofusscomputing/centurion-erp) is a worker that waits for tasks sent to the RabbitMQ server. The worker is based upon [Celery](https://docs.celeryq.dev/en/stable/index.html). On the worker not being busy, it'll pickup and run the task. This container is scalable with nil additional requirements for launching additional workers. If deploying to Kubernetes the setting the deployment `replicas` to the number of desired containers is the simplest method to scale. There is no container start command, however you will need to set environmental variable `IS_WORKER` to value `'True'` within the container.
|
||||
|
||||
Configuration for the worker resides in directory `/etc/itsm/` within the container. see below for the `CELERY_` configuration.
|
||||
|
||||
|
@ -7,6 +7,25 @@ if [ "$1" == "" ]; then
|
||||
|
||||
echo "[Info] Setup SupervisorD"
|
||||
|
||||
if [ ${IS_WORKER} == 'True' ] || [ ${IS_WORKER} == 'true' ]; then
|
||||
|
||||
|
||||
echo '[info] Creating worker service config';
|
||||
|
||||
cp /etc/supervisor/conf.source/worker.conf /etc/supervisor/conf.d/worker.conf;
|
||||
|
||||
if [ -f '/etc/supervisor/conf.d/worker.conf' ]; then
|
||||
|
||||
echo '[info] Worker service config Created';
|
||||
|
||||
else
|
||||
|
||||
echo '[crit] Worker service config not created';
|
||||
|
||||
fi;
|
||||
|
||||
|
||||
else
|
||||
|
||||
echo '[info] Creating gunicorn service config';
|
||||
|
||||
@ -38,6 +57,9 @@ if [ "$1" == "" ]; then
|
||||
fi;
|
||||
|
||||
|
||||
fi;
|
||||
|
||||
|
||||
echo "[Info] SupervisorD Setup successfully"
|
||||
|
||||
|
||||
|
10
includes/etc/supervisor/conf.source/worker.conf
Normal file
10
includes/etc/supervisor/conf.source/worker.conf
Normal file
@ -0,0 +1,10 @@
|
||||
[program:celery]
|
||||
priority=1
|
||||
startsecs=0
|
||||
stopwaitsecs=55
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/%(program_name)s.log
|
||||
stderr_logfile=/var/log/%(program_name)s.log
|
||||
directory=/app
|
||||
command=celery -A app worker -l INFO
|
Reference in New Issue
Block a user