Skip to content

Commit

Permalink
auto db upgrades upon services start-up
Browse files Browse the repository at this point in the history
  • Loading branch information
zachliu committed Sep 16, 2024
1 parent 79bbb24 commit 783970b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,30 @@
set -e

scheduler() {
echo "Upgrading database..."

/app/manage.py db upgrade

echo "Starting RQ scheduler..."

exec /app/manage.py rq scheduler
}

dev_scheduler() {
echo "Upgrading database..."

/app/manage.py db upgrade

echo "Starting dev RQ scheduler..."

exec watchmedo auto-restart --directory=./redash/ --pattern=*.py --recursive -- ./manage.py rq scheduler
}

worker() {
echo "Upgrading database..."

/app/manage.py db upgrade

echo "Starting RQ worker..."

export WORKERS_COUNT=${WORKERS_COUNT:-2}
Expand All @@ -36,12 +48,20 @@ workers_healthcheck() {
}

dev_worker() {
echo "Upgrading database..."

/app/manage.py db upgrade

echo "Starting dev RQ worker..."

exec watchmedo auto-restart --directory=./redash/ --pattern=*.py --recursive -- ./manage.py rq worker $QUEUES
}

server() {
echo "Upgrading database..."

/app/manage.py db upgrade

# Recycle gunicorn workers every n-th request. See http://docs.gunicorn.org/en/stable/settings.html#max-requests for more details.
MAX_REQUESTS=${MAX_REQUESTS:-1000}
MAX_REQUESTS_JITTER=${MAX_REQUESTS_JITTER:-100}
Expand Down

0 comments on commit 783970b

Please sign in to comment.