Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MongoDB health check to REST routes #87

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

blinkdog
Copy link
Contributor

No description provided.

@blinkdog blinkdog requested a review from dsschult January 30, 2020 01:32
@blinkdog
Copy link
Contributor Author

@blinkdog blinkdog requested a review from dsschult January 30, 2020 15:24
@blinkdog
Copy link
Contributor Author

@dsschult says this won't work against our current version of MongoDB, so we'll hold off on merging this PR for awhile.

@dsschult
Copy link
Contributor

It's a mongo 3.6 feature, and the current server is 3.0. Need to wait for @barnetspa to upgrade the server.

actions-user and others added 9 commits March 19, 2021 05:25
Automatically generated by python-semantic-release
Automatically generated by python-semantic-release
Automatically generated by python-semantic-release
Automatically generated by python-semantic-release
# configure access to MongoDB for health checks
mongodb_health_url = f"mongodb://{mongo_host}:{mongo_port}/admin"
if mongo_user and mongo_pass:
mongodb_health_url = f"mongodb://{mongo_user}:{mongo_pass}@{mongo_host}:{mongo_port}/admin"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one issue I can foresee already is which db the user/pass combo is registered in. Right now, the user only exists in the specific $LTA_MONGODB_DATABASE_NAME, not in admin.

One solution is to only use the admin db, and when connecting do things like this:

    logging.info(f'DB: {config["DB_URL"]}')
    db_url, db_name = config['DB_URL'].rsplit('/', 1)
    db = motor.motor_asyncio.AsyncIOMotorClient(db_url)
    logging.info(f'DB name: {db_name}')
    kwargs['db'] = db[db_name]

@blinkdog
Copy link
Contributor Author

DevOps Weekly had a link to some MongoDB monitoring.
Not directly relevant to this issue, but it may be useful for a related issue some day:
https://sematext.com/blog/mongodb-monitoring/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants