Changeset View
Changeset View
Standalone View
Standalone View
services/swh-listers-worker/entrypoint.sh
Show All 15 Lines | *) | ||||
wait_pgsql | wait_pgsql | ||||
echo Setup ${POSTGRES_DB} database for ${SWH_WORKER_INSTANCE} | echo Setup ${POSTGRES_DB} database for ${SWH_WORKER_INSTANCE} | ||||
if psql -lqt | cut -d \| -f 1 | grep -qw ${POSTGRES_DB}; then | if psql -lqt | cut -d \| -f 1 | grep -qw ${POSTGRES_DB}; then | ||||
echo Database already exists, nothing to do | echo Database already exists, nothing to do | ||||
else | else | ||||
echo Creating database | echo Creating database | ||||
createdb ${POSTGRES_DB} | createdb ${POSTGRES_DB} | ||||
fi | fi | ||||
echo Initialize database | echo Initialize database | ||||
python -m swh.lister.cli \ | swh lister -C ${SWH_CONFIG_FILENAME} db-init | ||||
--db-url postgres://${PGUSER}@${PGHOST}/${POSTGRES_DB} \ | |||||
all | echo Register lister task types in scheduler database | ||||
swh lister -C ${SWH_CONFIG_FILENAME} register-task-types | |||||
echo Waiting for RabbitMQ to start | echo Waiting for RabbitMQ to start | ||||
wait-for-it amqp:5672 -s --timeout=0 | wait-for-it amqp:5672 -s --timeout=0 | ||||
echo Starting the swh-lister Celery worker for ${SWH_WORKER_INSTANCE} | echo Starting the swh-lister Celery worker for ${SWH_WORKER_INSTANCE} | ||||
exec python -m celery worker \ | exec python -m celery worker \ | ||||
--app=swh.scheduler.celery_backend.config.app \ | --app=swh.scheduler.celery_backend.config.app \ | ||||
--pool=prefork --events \ | --pool=prefork --events \ | ||||
--concurrency=${CONCURRENCY} \ | --concurrency=${CONCURRENCY} \ | ||||
--maxtasksperchild=${MAX_TASKS_PER_CHILD} \ | --maxtasksperchild=${MAX_TASKS_PER_CHILD} \ | ||||
-Ofair --loglevel=${LOGLEVEL} --without-gossip \ | -Ofair --loglevel=${LOGLEVEL} --without-gossip \ | ||||
--without-mingle \ | --without-mingle \ | ||||
--heartbeat-interval 10 \ | --heartbeat-interval 10 \ | ||||
--hostname "${SWH_WORKER_INSTANCE}@%h" | --hostname "${SWH_WORKER_INSTANCE}@%h" | ||||
;; | ;; | ||||
esac | esac |