Skip to content

Commit

Permalink
Merge pull request #4192 from magfest/config_update_super2023
Browse files Browse the repository at this point in the history
Config update super2023
  • Loading branch information
bitbyt3r authored Aug 3, 2023
2 parents 982ef0d + 099ce19 commit 8302da9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ ENV DEFAULT_URL=/uber
ENV DEBUG=false
ENV SESSION_HOST=redis
ENV SESSION_PORT=6379
ENV SESSION_PREFIX=uber
ENV BROKER_PROTOCOL=amqp
ENV BROKER_HOST=rabbitmq
ENV BROKER_PORT=5672
ENV BROKER_USER=celery
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ Jinja2==2.11.3
requests==2.27.1
signnow_python_sdk==2.0.1
Authlib==1.0.1
pyyaml==6.0
pyyaml==6.0
librabbitmq==2.0.0
1 change: 1 addition & 0 deletions sideboard-development.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ server.socket_timeout = 1
server.thread_pool = 100
tools.sessions.host = "${SESSION_HOST}"
tools.sessions.port = ${SESSION_PORT}
tools.sessions.prefix = "${SESSION_PREFIX}"
tools.sessions.storage_type = "redis"
tools.sessions.timeout = 60

Expand Down
2 changes: 1 addition & 1 deletion uber-development.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ hostname = "${HOSTNAME}"
url_root = "http://${HOSTNAME}:${PORT}"

[secret]
broker_url = "amqp://${BROKER_USER}:${BROKER_PASS}@${BROKER_HOST}:${BROKER_PORT}/${BROKER_VHOST}"
broker_url = "${BROKER_PROTOCOL}://${BROKER_USER}:${BROKER_PASS}@${BROKER_HOST}:${BROKER_PORT}/${BROKER_VHOST}"
12 changes: 0 additions & 12 deletions uber-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
#!/bin/bash
set -e

# SESSION_HOST and BROKER_HOST may point to SRV records that need to get resolved to a host/port
SESSION_REC=$(dig srv +noall +answer +short "$SESSION_HOST" | cut -d ' ' -f 3,4 | head -1)
BROKER_REC=$(dig srv +noall +answer +short "$BROKER_HOST" | cut -d ' ' -f 3,4 | head -1)
if [[ ! -z "$SESSION_REC" ]]; then
SESSION_HOST=$(echo $SESSION_REC | cut -d ' ' -f 2)
SESSION_PORT=$(echo $SESSION_REC | cut -d ' ' -f 1)
fi
if [[ ! -z "$BROKER_REC" ]]; then
BROKER_HOST=$(echo $BROKER_REC | cut -d ' ' -f 2)
BROKER_PORT=$(echo $BROKER_REC | cut -d ' ' -f 1)
fi

# This will replace any variable references in these files
# If you want to add any additional settings here just add
# the variables to the environment when running this.
Expand Down
7 changes: 5 additions & 2 deletions uber/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
celery.conf.beat_schedule = {}
celery.conf.beat_startup_tasks = []
celery.conf.update(config_dict['celery'])
celery.conf.update(broker_url=config_dict['secret']['broker_url'])
celery.conf.update(result_backend=config_dict['secret']['broker_url'].replace("amqp://", "rpc://"))

broker_url = config_dict['secret']['broker_url']

celery.conf.update(broker_url=broker_url)
celery.conf.update(result_backend=broker_url.replace("amqps://", "rpc://"))
celery.conf.update(task_ignore_result=True)

def celery_on_startup(fn, *args, **kwargs):
Expand Down

0 comments on commit 8302da9

Please sign in to comment.