#!/bin/sh

WORK_DIR="/var/www/poizonstore"
CELERY_BIN="/var/www/poizonstore/env/bin"
PROJECT_NAME="poizonstore"

# Wait for worker to start
until timeout 10s $CELERY_BIN/celery -A $PROJECT_NAME --workdir=$WORK_DIR inspect ping; do
    >&2 echo "Celery workers not available"
done

# Run flower for Celery management
echo 'Starting Celery flower'
$CELERY_BIN/celery -A $PROJECT_NAME --workdir=$WORK_DIR flower --port=5555 --url_prefix=/flower --basic-auth=admin:meowmeow
