Added Celery worker docker container

This docker container uses the Blender Cloud image, but a different entry
point. It is not intended to be network-reachable from the outside world.
All it needs are connections to the databases (mongo, redis, rabbit).
This commit is contained in:
2017-06-02 10:54:46 +02:00
parent c73efd5998
commit 9da841efc3
6 changed files with 44 additions and 20 deletions

View File

@@ -2,5 +2,8 @@ bash docker-entrypoint.sh
env | sort
apache2ctl start
apache2ctl graceful
/manage.sh operations worker -- -C
celery status --broker amqp://guest:guest@rabbit:5672//
celery events --broker amqp://guest:guest@rabbit:5672//
tail -n 40 -f /var/log/apache2/access.log
tail -n 40 -f /var/log/apache2/error.log

4
docker/4_run/celery-worker.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
source /install_scripts.sh
source /manage.sh operations worker -- -C

View File

@@ -1,22 +1,6 @@
#!/usr/bin/env bash
if [ ! -f /installed ]; then
SITEPKG=$(echo /opt/python/lib/python3.*/site-packages)
echo "Installing Blender Cloud packages into $SITEPKG"
# TODO: 'pip3 install -e' runs 'setup.py develop', which runs 'setup.py egg_info',
# which can't write the egg info to the read-only /data/git volume. This is why
# we manually install the links.
for SUBPROJ in /data/git/{pillar,pillar-python-sdk,attract,flamenco}; do
NAME=$(python3 $SUBPROJ/setup.py --name)
echo "... $NAME"
echo $SUBPROJ >> $SITEPKG/easy-install.pth
echo $SUBPROJ > $SITEPKG/$NAME.egg-link
done
echo "All packages installed."
touch /installed
fi
source /install_scripts.sh
# Make sure that log rotation works.
mkdir -p ${APACHE_LOG_DIR}

View File

@@ -0,0 +1,18 @@
if [ ! -f /installed ]; then
SITEPKG=$(echo /opt/python/lib/python3.*/site-packages)
echo "Installing Blender Cloud packages into $SITEPKG"
# TODO: 'pip3 install -e' runs 'setup.py develop', which runs 'setup.py egg_info',
# which can't write the egg info to the read-only /data/git volume. This is why
# we manually install the links.
for SUBPROJ in /data/git/{pillar,pillar-python-sdk,attract,flamenco}; do
NAME=$(python3 $SUBPROJ/setup.py --name)
echo "... $NAME"
echo $SUBPROJ >> $SITEPKG/easy-install.pth
echo $SUBPROJ > $SITEPKG/$NAME.egg-link
done
echo "All packages installed."
touch /installed
fi

View File

@@ -42,8 +42,7 @@ RUN a2enmod rewrite && a2enmod wsgi-py36
ADD apache2.conf /etc/apache2/apache2.conf
ADD 000-default.conf /etc/apache2/sites-available/000-default.conf
ADD docker-entrypoint.sh /docker-entrypoint.sh
ADD manage.sh /manage.sh
ADD *.sh /
# Remove some empty top-level directories we won't use anyway.
RUN rmdir /media /home 2>/dev/null || true

View File

@@ -14,7 +14,7 @@ redis:
ports:
- "127.0.0.1:6379:6379"
rabbit:
image: rabbitmq:3.6.7
image: rabbitmq:3.6.10
container_name: rabbit
restart: always
ports:
@@ -36,6 +36,22 @@ blender_cloud:
links:
- mongo
- redis
- rabbit
celery_worker:
image: armadillica/blender_cloud:latest
entrypoint: /celery-worker.sh
container_name: celery_worker
restart: always
volumes:
# format: HOST:CONTAINER
- /data/git:/data/git:ro
- /data/config:/data/config:ro
- /data/storage/pillar:/data/storage/pillar
- /data/log:/var/log
links:
- mongo
- redis
- rabbit
# notifserv:
# container_name: notifserv
# image: armadillica/pillar-notifserv:cd8fa678436563ac3b800b2721e36830c32e4656