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

scale and configure 2 postgres instances #4750

Closed
1 task
rshewitt opened this issue May 14, 2024 · 1 comment
Closed
1 task

scale and configure 2 postgres instances #4750

rshewitt opened this issue May 14, 2024 · 1 comment
Assignees
Labels
H2.0/Harvest-DB Postgres and related DB tickets

Comments

@rshewitt
Copy link
Contributor

rshewitt commented May 14, 2024

User Story

In order to isolate database interaction between applications, datagov wants to create 2 instances of postgres with the flask app talking to one and harvesting logic talking to the other.

Acceptance Criteria

[ACs should be clearly demoable/verifiable whenever possible. Try specifying them using BDD.]

  • GIVEN the flask app and harvesting logic app
    WHEN a call is made from an app
    THEN the associated db is used

Background

  • we're currently using 2 databases. postgres for the flask app and an in-memory sqlite instance for the harvesting logic app.
  • part of #4731 is updating the data type of the "notification_emails" column in the harvest source table to an array of strings. sqlite doesn't support arrays as column data types so we're replacing sqlite with our postgres instance. the flask app and harvesting logic app are then interacting with the same database. this poses a problem.
  • the harvesting logic app modifies the state of the database in its tests which interferes with the functionality of the flask app.
  • we want to create 2 database instances to prevent interference of applications.

Security Considerations (required)

[Any security concerns that might be implicated in the change. "None" is OK, just be explicit here!]

Sketch

  • add another instance of the db service in the compose file using the --scale flag
  • use different ports for each database and configure the environment such that the flask app uses 1 db and harvesting logic uses the another
@rshewitt rshewitt added the H2.0/Harvest-DB Postgres and related DB tickets label May 14, 2024
@rshewitt
Copy link
Contributor Author

@jbrown-xentity comments from slack

We could use scale, but I would suggest using project-name:
https://forums.docker.com/t/docker-compose-create-multiple-instances/90086/2
https://docs.docker.com/compose/project-name/
Use environment variable precedence and the docker-compose cli to overwrite the DB port mapping to the local machine, and thereby have a unique instance of the DB that is used for integration testing, different from the current manual app/testing that is occurring. This will more closely replicate what will happen on cloud.gov.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
H2.0/Harvest-DB Postgres and related DB tickets
Projects
Status: 🗄 Closed
Development

No branches or pull requests

3 participants