General improvements.

This commit is contained in:
Scott Idem
2023-07-12 15:39:45 -04:00
parent 630bd1a61e
commit 7679a62cf1
3 changed files with 17 additions and 3 deletions

View File

@@ -61,6 +61,13 @@ AE_DB_NAME=aether_dev
AE_DB_USERNAME=osit_aether AE_DB_USERNAME=osit_aether
AE_DB_PASSWORD="the password with $$ escape" AE_DB_PASSWORD="the password with $$ escape"
# wait_timeout (MariaDB) is how long to keep an idle DB connection
AE_DB_WAIT_TIMEOUT=1800 # Not yet used!
# connection_timeout (MariaDB) is how long to try and create a new DB connection; bad handshake
AE_DB_CONNECTION_TIMEOUT=15
# pool_recycle (SQLAlchemy) is how long to keep using a particular connection that has passed a certain age
AE_DB_POOL_RECYCLE=1800
AE_DB_V5_SERVER=linode.oneskyit.com AE_DB_V5_SERVER=linode.oneskyit.com
AE_DB_V5_PORT=3306 AE_DB_V5_PORT=3306
AE_DB_V5_NAME=aether_v5_dev AE_DB_V5_NAME=aether_v5_dev
@@ -78,12 +85,15 @@ AE_SMTP_USERNAME=send_mail
# AE_SMTP_PASSWORD="not currently used" # AE_SMTP_PASSWORD="not currently used"
# Gunicorn workers and threads:
# https://docs.gunicorn.org/en/stable/design.html#how-many-workers
# Aether API specific config options (FastAPI) # Aether API specific config options (FastAPI)
# AE_API_CFG_ID=0 # NOT CURRENTLY NEED OR USED # AE_API_CFG_ID=0 # NOT CURRENTLY NEED OR USED
AE_API_ENV=development AE_API_ENV=development
AE_API_DIR=/srv/aether_api AE_API_DIR=/srv/aether_api
AE_API_LOG_PATH="/logs/aether_api.log" AE_API_LOG_PATH="/logs/aether_api.log"
AE_API_WORKERS=1 AE_API_WORKERS=2
AE_API_THREADS=1 AE_API_THREADS=1
AE_API_RELOAD=False AE_API_RELOAD=False
@@ -96,7 +106,7 @@ AE_APP_UX_MODE=default
# AE_APP_UX_MODE=native # AE_APP_UX_MODE=native
AE_APP_DIR=/srv/aether_app AE_APP_DIR=/srv/aether_app
AE_APP_LOG_PATH="/logs/aether_app.log" AE_APP_LOG_PATH="/logs/aether_app.log"
AE_APP_WORKERS=1 AE_APP_WORKERS=2
AE_APP_THREADS=1 AE_APP_THREADS=1
AE_APP_RELOAD=True AE_APP_RELOAD=True
# Generate a new key with: # python -c 'import os; print(os.urandom(16))' # Generate a new key with: # python -c 'import os; print(os.urandom(16))'

View File

@@ -26,6 +26,10 @@ class Settings(BaseSettings):
DB['username'] = os.getenv('AE_DB_USERNAME', None) # 'osit_aether' # 'onesky_aether' DB['username'] = os.getenv('AE_DB_USERNAME', None) # 'osit_aether' # 'onesky_aether'
DB['password'] = os.getenv('AE_DB_PASSWORD', None) # DB['password'] = os.getenv('AE_DB_PASSWORD', None) #
SQLALCHEMY_DB_URI = 'mysql://'+DB['username']+':'+DB['password']+'@'+DB['server']+'/'+DB['name'] SQLALCHEMY_DB_URI = 'mysql://'+DB['username']+':'+DB['password']+'@'+DB['server']+'/'+DB['name']
DB['wait_timeout'] = int(os.getenv('AE_DB_WAIT_TIMEOUT', 1800)) # default = 28800; Time (seconds) that the server waits for a connection to become active before closing it.
DB['connect_timeout'] = int(os.getenv('AE_DB_CONNECTION_TIMEOUT', 20)) # default = 10; Time (seconds) that the server waits for a connection to become active before closing it.
DB['pool_recycle'] = int(os.getenv('AE_DB_POOL_RECYCLE', 1800)) # default = ?; Related to SQLAlchemy
# Aether API log files paths # Aether API log files paths

View File

@@ -24,7 +24,7 @@ wsgi_app = "app.main:app"
# Setting a long timeout since some FastAPI API requests may take a while # Setting a long timeout since some FastAPI API requests may take a while
timeout = 2100 # default 30; 1200 is NOT enough; worker process silent then kill and restart timeout = 2100 # default 30; 1200 is NOT enough; worker process silent then kill and restart
graceful_timeout = 10 # default 30; timeout after restart signal graceful_timeout = 10 # default 30; timeout after restart signal
keepalive = 2 # default 2; setting higher because behind load balancer (nginx) keepalive = 30 # default 2; setting higher because behind load balancer (nginx)
# Reload does not work correctly with UvicornWorker # Reload does not work correctly with UvicornWorker
# https://github.com/benoitc/gunicorn/issues/2339 # https://github.com/benoitc/gunicorn/issues/2339