migrate from BROKER_URL to CELERY_BROKER_URL

This commit is contained in:
j 2019-07-16 20:58:10 +01:00
parent 68b56f0c9e
commit 2c41b17bc4
5 changed files with 21 additions and 14 deletions

View file

@ -24,7 +24,7 @@ DATABASES = {
'PORT': 5432,
}
}
BROKER_URL = "amqp://{0}:{1}@rabbitmq:5672//".format(os.environ.get('RABBITMQ_DEFAULT_USER'), os.environ.get('RABBITMQ_DEFAULT_PASS'))
CELERY_BROKER_URL = "amqp://{0}:{1}@rabbitmq:5672//".format(os.environ.get('RABBITMQ_DEFAULT_USER'), os.environ.get('RABBITMQ_DEFAULT_PASS'))
XACCELREDIRECT = True
DEBUG = False

View file

@ -200,7 +200,7 @@ CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json']
BROKER_URL = 'amqp://pandora:box@localhost:5672//pandora'
CELERY_BROKER_URL = 'amqp://pandora:box@localhost:5672//pandora'
SEND_CELERY_ERROR_EMAILS = False
@ -262,6 +262,10 @@ COLLECTION_ICON = join(SCRIPT_ROOT, 'list_icon.py')
DB_GIN_TRGM = False
ALLOWED_HOSTS = ['*']
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
DATA_UPLOAD_MAX_MEMORY_SIZE = 32 * 1024 * 1024
RELOADER_RUNNING = False
#you can ignore things below this line
@ -293,12 +297,4 @@ except NameError:
INSTALLED_APPS = tuple(list(INSTALLED_APPS) + LOCAL_APPS)
ALLOWED_HOSTS = ['*']
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
DATA_UPLOAD_MAX_MEMORY_SIZE = 32 * 1024 * 1024
try:
CELERY_BROKER_URL
except NameError:
CELERY_BROKER_URL = BROKER_URL

View file

@ -27,7 +27,7 @@ class Worker(ConsumerMixin):
message.ack()
def run():
with Connection(settings.BROKER_URL) as conn:
with Connection(settings.CELERY_BROKER_URL) as conn:
try:
worker = Worker(conn)
worker.run()

View file

@ -261,6 +261,17 @@ if __name__ == "__main__":
run('./pandora/manage.py', 'createcachetable')
if old <= 6108:
run('./bin/pip', 'install', '-r', 'requirements.txt')
if old <= 6160:
run('./bin/pip', 'install', '-r', 'requirements.txt')
with open('pandora/local_settings.py', 'r') as f:
local_settings = f.read()
if 'BROKER_URL' in local_settings and 'CELERY_BROKER_URL' not in local_settings:
local_settings = [
'CELERY_' + l if l.startswith('BROKER_URL') else l
for l in local_settings.split('\n')
]
with open('pandora/local_settings.py', 'w') as f:
f.write('\n'.join(local_settings))
else:
if len(sys.argv) == 1:
branch = get_branch()

View file

@ -117,9 +117,9 @@ if [ "$RABBITMQ" == "local" ]; then
rabbitmqctl add_user pandora $RABBITPWD
rabbitmqctl add_vhost /pandora
rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
BROKER_URL="amqp://pandora:$RABBITPWD@localhost:5672//pandora"
CELERY_BROKER_URL="amqp://pandora:$RABBITPWD@localhost:5672//pandora"
else
BROKER_URL="$RABBITMQ"
CELERY_BROKER_URL="$RABBITMQ"
fi
# checkout pandora from git
@ -145,7 +145,7 @@ DATABASES = {
'PASSWORD': '',
}
}
BROKER_URL = '$BROKER_URL'
CELERY_BROKER_URL = '$CELERY_BROKER_URL'
XACCELREDIRECT = True
DEBUG = False