blockstream-satellite-api/server/server.sh

19 lines
432 B
Bash
Raw Normal View History

#!/bin/bash
set -e
# Run database migrations
alembic upgrade head
# Start the server
# set number of worker based on suggestion in:
# https://docs.gunicorn.org/en/stable/design.html#how-many-workers
n_cores=$(nproc --all)
n_workers=$(expr $n_cores \* 2 + 1)
gunicorn \
--bind 0.0.0.0:9292 \
--workers=$n_workers \
--worker-class=gevent \
--access-logfile=- \
--access-logformat='%(t)s "%(r)s" %(s)s' \
"server:create_app()"