mirror of
https://github.com/Blockstream/satellite-api.git
synced 2024-11-19 04:50:01 +01:00
9d421771e7
- 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/.
19 lines
432 B
Bash
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()"
|