blockstream-satellite-api/server/server.sh
Blockstream Satellite 9d421771e7 Port the satellite API to python
- Preserve the SQLite database and use SQLAlchemy to wrap db
  interactions.
- Use Alembic for database migrations.
- Organize all the python modules on the new server/ directory.
- Use pytest for unit tests and organize test modules at server/tests/.
2021-07-20 12:28:08 -03:00

19 lines
432 B
Bash

#!/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()"