diff options
Diffstat (limited to 'install/ishtar-prepare-instance')
-rwxr-xr-x | install/ishtar-prepare-instance | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/install/ishtar-prepare-instance b/install/ishtar-prepare-instance index fcc5cb629..60fd0e39f 100755 --- a/install/ishtar-prepare-instance +++ b/install/ishtar-prepare-instance @@ -261,11 +261,34 @@ EOF fi echo $UWSGI_PORT > $PORT_FILE - ### __init__.py + # manage celery daemon + CELERY_CONF="" + if [ -v USE_CELERY ]; then + RBMQ_PASSWORD=$(apg -a 0 -M ncl -n 1 -x 10 -m 10) + /usr/sbin/rabbitmqctl add_vhost /ishtar$INSTANCE + /usr/sbin/rabbitmqctl add_user ishtar$INSTANCE $RBMQ_PASSWORD + /usr/sbin/rabbitmqctl set_permissions -p /ishtar$INSTANCE ishtar$INSTANCE ".*" ".*" ".*" + CELERY_CONF="BROKER_URL = 'ampq://ishtar"$INSTANCE":"$RBMQ_PASSWORD"@localhost//ishtar"$INSTANCE"'" + CELERY_CONF=$CELERY_CONF"\nUSE_BACKGROUND_TASK = True" + sed -s "s|#APP_NAME#|$INSTANCE|g;" \ + "install/celeryd.default.template" > \ + "/etc/default/celeryd-"$INSTANCE + sed -s "s|#APP_NAME#|$INSTANCE|g;\ + s|#INSTALL_PATH#|$INSTALL_PATH|g;"\ + "install/celery.service.template" > \ + "/etc/default/celeryd-"$INSTANCE + systemctl daemon-reload + systemctl enable celeryd-$INSTANCE + systemctl start celeryd-$INSTANCE + fi + ### __init__.py cd $INSTANCE - # ln -s __init__.py.celery.sample __init__.py - ln -s __init__.py.base.sample __init__.py + if [ -v USE_CELERY ]; then + ln -s __init__.py.celery.sample __init__.py + else + ln -s __init__.py.base.sample __init__.py + fi ### local_settings.py @@ -282,6 +305,8 @@ EOF "install/local_settings.py.sample" > \ "$INSTANCE/local_settings.py" + echo $CELERY_CONF >> "$INSTANCE/local_settings.py" + if [ -f $CONFIG_PATH"extra_settings.py" ]; then ln -s $CONFIG_PATH"extra_settings.py" >> "$INSTANCE/extra_settings.py" fi |