Skip to content

Conversation

@slint
Copy link
Member

@slint slint commented Aug 21, 2025

@slint slint changed the title read replica Configure DB read replica Aug 21, 2025
@slint slint changed the title Configure DB read replica Configure DB read replica and routing Aug 21, 2025
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://zenodo:zenodo@localhost/zenodo"

# fmt: off
ZENODO_UI_READ_ONLY_ENDPOINTS = [
Copy link
Member Author

Choose a reason for hiding this comment

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

These need a second look. I removed from the initiali list all the POST/PUT/DELETE routes and did a manual pass to make sure none of these routes have hidden DB writes (like e.g. the /confirm route).

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you observing high traffic in all these endpoints? Otherwise you can evaluate adding only a subset of those and then progressively expanding it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, but I thought narrowing down all the read endpoints and filtering afterwards will make sure we don't miss anything (like e.g. the legacy redirect endpoints, which are linked to around the web already).

Comment on lines +253 to +258
if IS_LOCAL_DEV:
SQLALCHEMY_BINDS = {
"read_replica": "postgresql+psycopg2://zenodo_ro:zenodo_ro@localhost/zenodo"
}

DB_SESSION_BIND_FUNC = routed_bind
Copy link
Member Author

Choose a reason for hiding this comment

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

This needs some additional thought regarding how it will be rolled out for QA/Production via env config

@slint slint force-pushed the read-replica branch 2 times, most recently from 9c16e0c to 29ad5d4 Compare August 22, 2025 08:05
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.

2 participants