Merge pull request #2796 from castrapel/read_replica_support
Read replica support
This commit is contained in:
commit
9da428c7fd
|
@ -19,6 +19,7 @@ from logging import Formatter, StreamHandler
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
from flask_replicated import FlaskReplicated
|
||||||
import logmatic
|
import logmatic
|
||||||
|
|
||||||
from lemur.certificates.hooks import activate_debug_dump
|
from lemur.certificates.hooks import activate_debug_dump
|
||||||
|
@ -53,6 +54,7 @@ def create_app(app_name=None, blueprints=None, config=None):
|
||||||
configure_blueprints(app, blueprints)
|
configure_blueprints(app, blueprints)
|
||||||
configure_extensions(app)
|
configure_extensions(app)
|
||||||
configure_logging(app)
|
configure_logging(app)
|
||||||
|
configure_database(app)
|
||||||
install_plugins(app)
|
install_plugins(app)
|
||||||
|
|
||||||
@app.teardown_appcontext
|
@app.teardown_appcontext
|
||||||
|
@ -158,6 +160,11 @@ def configure_blueprints(app, blueprints):
|
||||||
app.register_blueprint(blueprint, url_prefix="/api/{0}".format(API_VERSION))
|
app.register_blueprint(blueprint, url_prefix="/api/{0}".format(API_VERSION))
|
||||||
|
|
||||||
|
|
||||||
|
def configure_database(app):
|
||||||
|
if app.config.get("SQLALCHEMY_ENABLE_FLASK_REPLICATED"):
|
||||||
|
FlaskReplicated(app)
|
||||||
|
|
||||||
|
|
||||||
def configure_logging(app):
|
def configure_logging(app):
|
||||||
"""
|
"""
|
||||||
Sets up application wide logging.
|
Sets up application wide logging.
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
#
|
#
|
||||||
# pip-compile --no-index --output-file=requirements-dev.txt requirements-dev.in
|
# pip-compile --no-index --output-file=requirements-dev.txt requirements-dev.in
|
||||||
#
|
#
|
||||||
aspy.yaml==1.2.0 # via pre-commit
|
aspy.yaml==1.3.0 # via pre-commit
|
||||||
bleach==3.1.0 # via readme-renderer
|
bleach==3.1.0 # via readme-renderer
|
||||||
certifi==2019.3.9 # via requests
|
certifi==2019.3.9 # via requests
|
||||||
cfgv==1.6.0 # via pre-commit
|
cfgv==2.0.0 # via pre-commit
|
||||||
chardet==3.0.4 # via requests
|
chardet==3.0.4 # via requests
|
||||||
docutils==0.14 # via readme-renderer
|
docutils==0.14 # via readme-renderer
|
||||||
flake8==3.5.0
|
flake8==3.5.0
|
||||||
identify==1.4.3 # via pre-commit
|
identify==1.4.3 # via pre-commit
|
||||||
idna==2.8 # via requests
|
idna==2.8 # via requests
|
||||||
importlib-metadata==0.12 # via pre-commit
|
importlib-metadata==0.15 # via pre-commit
|
||||||
invoke==1.2.0
|
invoke==1.2.0
|
||||||
mccabe==0.6.1 # via flake8
|
mccabe==0.6.1 # via flake8
|
||||||
nodeenv==1.3.3
|
nodeenv==1.3.3
|
||||||
|
@ -21,7 +21,7 @@ pkginfo==1.5.0.1 # via twine
|
||||||
pre-commit==1.16.1
|
pre-commit==1.16.1
|
||||||
pycodestyle==2.3.1 # via flake8
|
pycodestyle==2.3.1 # via flake8
|
||||||
pyflakes==1.6.0 # via flake8
|
pyflakes==1.6.0 # via flake8
|
||||||
pygments==2.4.0 # via readme-renderer
|
pygments==2.4.2 # via readme-renderer
|
||||||
pyyaml==5.1
|
pyyaml==5.1
|
||||||
readme-renderer==24.0 # via twine
|
readme-renderer==24.0 # via twine
|
||||||
requests-toolbelt==0.9.1 # via twine
|
requests-toolbelt==0.9.1 # via twine
|
||||||
|
@ -30,7 +30,7 @@ six==1.12.0 # via bleach, cfgv, pre-commit, readme-renderer
|
||||||
toml==0.10.0 # via pre-commit
|
toml==0.10.0 # via pre-commit
|
||||||
tqdm==4.32.1 # via twine
|
tqdm==4.32.1 # via twine
|
||||||
twine==1.13.0
|
twine==1.13.0
|
||||||
urllib3==1.25.2 # via requests
|
urllib3==1.25.3 # via requests
|
||||||
virtualenv==16.6.0 # via pre-commit
|
virtualenv==16.6.0 # via pre-commit
|
||||||
webencodings==0.5.1 # via bleach
|
webencodings==0.5.1 # via bleach
|
||||||
zipp==0.5.1 # via importlib-metadata
|
zipp==0.5.1 # via importlib-metadata
|
||||||
|
|
|
@ -10,22 +10,22 @@ alembic-autogenerate-enums==0.0.2
|
||||||
alembic==1.0.10
|
alembic==1.0.10
|
||||||
amqp==2.4.2
|
amqp==2.4.2
|
||||||
aniso8601==6.0.0
|
aniso8601==6.0.0
|
||||||
arrow==0.13.1
|
arrow==0.13.2
|
||||||
asn1crypto==0.24.0
|
asn1crypto==0.24.0
|
||||||
asyncpool==1.0
|
asyncpool==1.0
|
||||||
babel==2.6.0 # via sphinx
|
babel==2.7.0 # via sphinx
|
||||||
bcrypt==3.1.6
|
bcrypt==3.1.6
|
||||||
billiard==3.6.0.0
|
billiard==3.6.0.0
|
||||||
blinker==1.4
|
blinker==1.4
|
||||||
boto3==1.9.150
|
boto3==1.9.157
|
||||||
botocore==1.12.150
|
botocore==1.12.157
|
||||||
celery[redis]==4.3.0
|
celery[redis]==4.3.0
|
||||||
certifi==2019.3.9
|
certifi==2019.3.9
|
||||||
certsrv==2.1.1
|
certsrv==2.1.1
|
||||||
cffi==1.12.3
|
cffi==1.12.3
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
click==7.0
|
click==7.0
|
||||||
cloudflare==2.1.0
|
cloudflare==2.3.0
|
||||||
cryptography==2.6.1
|
cryptography==2.6.1
|
||||||
dnspython3==1.15.0
|
dnspython3==1.15.0
|
||||||
dnspython==1.15.0
|
dnspython==1.15.0
|
||||||
|
@ -34,15 +34,16 @@ dyn==1.8.1
|
||||||
flask-bcrypt==0.7.1
|
flask-bcrypt==0.7.1
|
||||||
flask-cors==3.0.7
|
flask-cors==3.0.7
|
||||||
flask-mail==0.9.1
|
flask-mail==0.9.1
|
||||||
flask-migrate==2.4.0
|
flask-migrate==2.5.2
|
||||||
flask-principal==0.4.0
|
flask-principal==0.4.0
|
||||||
|
flask-replicated==1.2
|
||||||
flask-restful==0.3.7
|
flask-restful==0.3.7
|
||||||
flask-script==2.0.6
|
flask-script==2.0.6
|
||||||
flask-sqlalchemy==2.4.0
|
flask-sqlalchemy==2.4.0
|
||||||
flask==1.0.2
|
flask==1.0.3
|
||||||
future==0.17.1
|
future==0.17.1
|
||||||
gunicorn==19.9.0
|
gunicorn==19.9.0
|
||||||
hvac==0.8.2
|
hvac==0.9.1
|
||||||
idna==2.8
|
idna==2.8
|
||||||
imagesize==1.1.0 # via sphinx
|
imagesize==1.1.0 # via sphinx
|
||||||
inflection==0.3.1
|
inflection==0.3.1
|
||||||
|
@ -69,7 +70,7 @@ pyasn1-modules==0.2.5
|
||||||
pyasn1==0.4.5
|
pyasn1==0.4.5
|
||||||
pycparser==2.19
|
pycparser==2.19
|
||||||
pycryptodomex==3.8.1
|
pycryptodomex==3.8.1
|
||||||
pygments==2.4.0 # via sphinx
|
pygments==2.4.2 # via sphinx
|
||||||
pyjks==19.0.0
|
pyjks==19.0.0
|
||||||
pyjwt==1.7.1
|
pyjwt==1.7.1
|
||||||
pynacl==1.3.0
|
pynacl==1.3.0
|
||||||
|
@ -99,10 +100,10 @@ sphinxcontrib-jsmath==1.0.1 # via sphinx
|
||||||
sphinxcontrib-qthelp==1.0.2 # via sphinx
|
sphinxcontrib-qthelp==1.0.2 # via sphinx
|
||||||
sphinxcontrib-serializinghtml==1.1.3 # via sphinx
|
sphinxcontrib-serializinghtml==1.1.3 # via sphinx
|
||||||
sqlalchemy-utils==0.33.11
|
sqlalchemy-utils==0.33.11
|
||||||
sqlalchemy==1.3.3
|
sqlalchemy==1.3.4
|
||||||
tabulate==0.8.3
|
tabulate==0.8.3
|
||||||
twofish==0.3.0
|
twofish==0.3.0
|
||||||
urllib3==1.24.3
|
urllib3==1.25.3
|
||||||
vine==1.3.0
|
vine==1.3.0
|
||||||
werkzeug==0.15.4
|
werkzeug==0.15.4
|
||||||
xmltodict==0.12.0
|
xmltodict==0.12.0
|
||||||
|
|
|
@ -12,34 +12,34 @@ aws-sam-translator==1.11.0 # via cfn-lint
|
||||||
aws-xray-sdk==2.4.2 # via moto
|
aws-xray-sdk==2.4.2 # via moto
|
||||||
bandit==1.6.0
|
bandit==1.6.0
|
||||||
black==19.3b0
|
black==19.3b0
|
||||||
boto3==1.9.150 # via aws-sam-translator, moto
|
boto3==1.9.157 # via aws-sam-translator, moto
|
||||||
boto==2.49.0 # via moto
|
boto==2.49.0 # via moto
|
||||||
botocore==1.12.150 # via aws-xray-sdk, boto3, moto, s3transfer
|
botocore==1.12.157 # via aws-xray-sdk, boto3, moto, s3transfer
|
||||||
certifi==2019.3.9 # via requests
|
certifi==2019.3.9 # via requests
|
||||||
cffi==1.12.3 # via cryptography
|
cffi==1.12.3 # via cryptography
|
||||||
cfn-lint==0.20.3 # via moto
|
cfn-lint==0.21.3 # via moto
|
||||||
chardet==3.0.4 # via requests
|
chardet==3.0.4 # via requests
|
||||||
click==7.0 # via black, flask
|
click==7.0 # via black, flask
|
||||||
coverage==4.5.3
|
coverage==4.5.3
|
||||||
cryptography==2.6.1 # via moto
|
cryptography==2.6.1 # via moto
|
||||||
docker-pycreds==0.4.0 # via docker
|
docker==4.0.1 # via moto
|
||||||
docker==3.7.2 # via moto
|
|
||||||
docutils==0.14 # via botocore
|
docutils==0.14 # via botocore
|
||||||
ecdsa==0.13.2 # via python-jose
|
ecdsa==0.13.2 # via python-jose
|
||||||
factory-boy==2.12.0
|
factory-boy==2.12.0
|
||||||
faker==1.0.7
|
faker==1.0.7
|
||||||
flask==1.0.2 # via pytest-flask
|
flask==1.0.3 # via pytest-flask
|
||||||
freezegun==0.3.11
|
freezegun==0.3.11
|
||||||
future==0.17.1 # via aws-xray-sdk, python-jose
|
future==0.17.1 # via aws-xray-sdk, python-jose
|
||||||
gitdb2==2.0.5 # via gitpython
|
gitdb2==2.0.5 # via gitpython
|
||||||
gitpython==2.1.11 # via bandit
|
gitpython==2.1.11 # via bandit
|
||||||
idna==2.8 # via moto, requests
|
idna==2.8 # via moto, requests
|
||||||
|
importlib-metadata==0.15 # via pluggy
|
||||||
itsdangerous==1.1.0 # via flask
|
itsdangerous==1.1.0 # via flask
|
||||||
jinja2==2.10.1 # via flask, moto
|
jinja2==2.10.1 # via flask, moto
|
||||||
jmespath==0.9.4 # via boto3, botocore
|
jmespath==0.9.4 # via boto3, botocore
|
||||||
jsondiff==1.1.2 # via moto
|
jsondiff==1.1.2 # via moto
|
||||||
jsonpatch==1.23 # via cfn-lint
|
jsonpatch==1.23 # via cfn-lint
|
||||||
jsonpickle==1.1 # via aws-xray-sdk
|
jsonpickle==1.2 # via aws-xray-sdk
|
||||||
jsonpointer==2.0 # via jsonpatch
|
jsonpointer==2.0 # via jsonpatch
|
||||||
jsonschema==2.6.0 # via aws-sam-translator, cfn-lint
|
jsonschema==2.6.0 # via aws-sam-translator, cfn-lint
|
||||||
markupsafe==1.1.1 # via jinja2
|
markupsafe==1.1.1 # via jinja2
|
||||||
|
@ -48,7 +48,7 @@ more-itertools==7.0.0 # via pytest
|
||||||
moto==1.3.8
|
moto==1.3.8
|
||||||
nose==1.3.7
|
nose==1.3.7
|
||||||
pbr==5.2.0 # via stevedore
|
pbr==5.2.0 # via stevedore
|
||||||
pluggy==0.11.0 # via pytest
|
pluggy==0.12.0 # via pytest
|
||||||
py==1.8.0 # via pytest
|
py==1.8.0 # via pytest
|
||||||
pyasn1==0.4.5 # via rsa
|
pyasn1==0.4.5 # via rsa
|
||||||
pycparser==2.19 # via cffi
|
pycparser==2.19 # via cffi
|
||||||
|
@ -65,7 +65,7 @@ requests==2.21.0 # via cfn-lint, docker, moto, requests-mock, responses
|
||||||
responses==0.10.6 # via moto
|
responses==0.10.6 # via moto
|
||||||
rsa==4.0 # via python-jose
|
rsa==4.0 # via python-jose
|
||||||
s3transfer==0.2.0 # via boto3
|
s3transfer==0.2.0 # via boto3
|
||||||
six==1.12.0 # via aws-sam-translator, bandit, cfn-lint, cryptography, docker, docker-pycreds, faker, freezegun, mock, moto, pytest, python-dateutil, python-jose, requests-mock, responses, stevedore, websocket-client
|
six==1.12.0 # via aws-sam-translator, bandit, cfn-lint, cryptography, docker, faker, freezegun, mock, moto, pytest, python-dateutil, python-jose, requests-mock, responses, stevedore, websocket-client
|
||||||
smmap2==2.0.5 # via gitdb2
|
smmap2==2.0.5 # via gitdb2
|
||||||
stevedore==1.30.1 # via bandit
|
stevedore==1.30.1 # via bandit
|
||||||
text-unidecode==1.2 # via faker
|
text-unidecode==1.2 # via faker
|
||||||
|
@ -76,3 +76,4 @@ websocket-client==0.56.0 # via docker
|
||||||
werkzeug==0.15.4 # via flask, moto, pytest-flask
|
werkzeug==0.15.4 # via flask, moto, pytest-flask
|
||||||
wrapt==1.11.1 # via aws-xray-sdk
|
wrapt==1.11.1 # via aws-xray-sdk
|
||||||
xmltodict==0.12.0 # via moto
|
xmltodict==0.12.0 # via moto
|
||||||
|
zipp==0.5.1 # via importlib-metadata
|
||||||
|
|
|
@ -22,6 +22,7 @@ Flask-Script
|
||||||
Flask-SQLAlchemy
|
Flask-SQLAlchemy
|
||||||
Flask
|
Flask
|
||||||
Flask-Cors
|
Flask-Cors
|
||||||
|
flask_replicated
|
||||||
future
|
future
|
||||||
gunicorn
|
gunicorn
|
||||||
hvac # required for the vault destination plugin
|
hvac # required for the vault destination plugin
|
||||||
|
|
|
@ -9,21 +9,21 @@ alembic-autogenerate-enums==0.0.2
|
||||||
alembic==1.0.10 # via flask-migrate
|
alembic==1.0.10 # via flask-migrate
|
||||||
amqp==2.4.2 # via kombu
|
amqp==2.4.2 # via kombu
|
||||||
aniso8601==6.0.0 # via flask-restful
|
aniso8601==6.0.0 # via flask-restful
|
||||||
arrow==0.13.1
|
arrow==0.13.2
|
||||||
asn1crypto==0.24.0 # via cryptography
|
asn1crypto==0.24.0 # via cryptography
|
||||||
asyncpool==1.0
|
asyncpool==1.0
|
||||||
bcrypt==3.1.6 # via flask-bcrypt, paramiko
|
bcrypt==3.1.6 # via flask-bcrypt, paramiko
|
||||||
billiard==3.6.0.0 # via celery
|
billiard==3.6.0.0 # via celery
|
||||||
blinker==1.4 # via flask-mail, flask-principal, raven
|
blinker==1.4 # via flask-mail, flask-principal, raven
|
||||||
boto3==1.9.150
|
boto3==1.9.157
|
||||||
botocore==1.12.150
|
botocore==1.12.157
|
||||||
celery[redis]==4.3.0
|
celery[redis]==4.3.0
|
||||||
certifi==2019.3.9
|
certifi==2019.3.9
|
||||||
certsrv==2.1.1
|
certsrv==2.1.1
|
||||||
cffi==1.12.3 # via bcrypt, cryptography, pynacl
|
cffi==1.12.3 # via bcrypt, cryptography, pynacl
|
||||||
chardet==3.0.4 # via requests
|
chardet==3.0.4 # via requests
|
||||||
click==7.0 # via flask
|
click==7.0 # via flask
|
||||||
cloudflare==2.1.0
|
cloudflare==2.3.0
|
||||||
cryptography==2.6.1
|
cryptography==2.6.1
|
||||||
dnspython3==1.15.0
|
dnspython3==1.15.0
|
||||||
dnspython==1.15.0 # via dnspython3
|
dnspython==1.15.0 # via dnspython3
|
||||||
|
@ -32,15 +32,16 @@ dyn==1.8.1
|
||||||
flask-bcrypt==0.7.1
|
flask-bcrypt==0.7.1
|
||||||
flask-cors==3.0.7
|
flask-cors==3.0.7
|
||||||
flask-mail==0.9.1
|
flask-mail==0.9.1
|
||||||
flask-migrate==2.4.0
|
flask-migrate==2.5.2
|
||||||
flask-principal==0.4.0
|
flask-principal==0.4.0
|
||||||
|
flask-replicated==1.2
|
||||||
flask-restful==0.3.7
|
flask-restful==0.3.7
|
||||||
flask-script==2.0.6
|
flask-script==2.0.6
|
||||||
flask-sqlalchemy==2.4.0
|
flask-sqlalchemy==2.4.0
|
||||||
flask==1.0.2
|
flask==1.0.3
|
||||||
future==0.17.1
|
future==0.17.1
|
||||||
gunicorn==19.9.0
|
gunicorn==19.9.0
|
||||||
hvac==0.8.2
|
hvac==0.9.1
|
||||||
idna==2.8 # via requests
|
idna==2.8 # via requests
|
||||||
inflection==0.3.1
|
inflection==0.3.1
|
||||||
itsdangerous==1.1.0 # via flask
|
itsdangerous==1.1.0 # via flask
|
||||||
|
@ -84,10 +85,10 @@ retrying==1.3.3
|
||||||
s3transfer==0.2.0 # via boto3
|
s3transfer==0.2.0 # via boto3
|
||||||
six==1.12.0
|
six==1.12.0
|
||||||
sqlalchemy-utils==0.33.11
|
sqlalchemy-utils==0.33.11
|
||||||
sqlalchemy==1.3.3 # via alembic, flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils
|
sqlalchemy==1.3.4 # via alembic, flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils
|
||||||
tabulate==0.8.3
|
tabulate==0.8.3
|
||||||
twofish==0.3.0 # via pyjks
|
twofish==0.3.0 # via pyjks
|
||||||
urllib3==1.24.3 # via botocore, requests
|
urllib3==1.25.3 # via botocore, requests
|
||||||
vine==1.3.0 # via amqp, celery
|
vine==1.3.0 # via amqp, celery
|
||||||
werkzeug==0.15.4 # via flask
|
werkzeug==0.15.4 # via flask
|
||||||
xmltodict==0.12.0
|
xmltodict==0.12.0
|
||||||
|
|
Loading…
Reference in New Issue