Merged
Conversation
lab596
commented
Feb 24, 2026
|
|
||
| ServiceResponse<Boolean> serviceResponse = new ServiceResponse<>(); | ||
| // Use absolute path in /tmp to ensure file is created in a known location | ||
| String dumpFilePath = "/tmp/db_dump.sql.gz"; |
Contributor
Author
There was a problem hiding this comment.
S3 upload needs an absolute filepath
| ("mysqldump", "--host=db", String.format("--user=%s", db_user), | ||
| String.format("--password=%s", db_password), "--all-databases"); | ||
|
|
||
| File outputFile = new File(dumpFilePath); |
Contributor
Author
There was a problem hiding this comment.
here we are writing the dump file so we can acess using the dumpFilePath
| Logger.info("DbDumpService", "Database dump created: " + dumpFilePath); | ||
|
|
||
| // Step 2: Upload to S3 if endpoint is configured | ||
| String s3Endpoint = System.getenv("S3_BACKUP_ENDPOINT"); // Read dynamically |
Contributor
Author
There was a problem hiding this comment.
This is currently hidden in the docket compose until auth is taken care of
| * | ||
| * @return kit ID string | ||
| */ | ||
| private String getKitId() { |
Contributor
Author
There was a problem hiding this comment.
reason for this is to add this to the name of the S3 dump so we can identify it
Add new java version fix
lab596
commented
Mar 3, 2026
| import femr.data.daos.core.IEncounterRepository; | ||
| import femr.data.daos.core.IPatientRepository; | ||
| import femr.data.daos.core.IPrescriptionRepository; | ||
| import femr.data.models.core.IConceptDiagnosis; |
Contributor
Author
There was a problem hiding this comment.
unrelated failing test fix
Contributor
Author
BrendannnD
approved these changes
Mar 5, 2026
| public class DbDumpService implements IDbDumpService { | ||
|
|
||
| // S3 upload timeout configuration | ||
| private static final int S3_UPLOAD_TIMEOUT = 30000; // 30 seconds |
Contributor
There was a problem hiding this comment.
With very crappy computers I'm not sure if this timeout is too restrictive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This pull request introduces a new mechanism for database backup in the
DbDumpService, enabling automated database dumps and uploads to an S3-compatible endpoint, with robust fallback and configuration logic. It also adds comprehensive unit and integration tests to ensure the reliability of the new backup workflow.Key changes:
Database Dump and S3 Upload Enhancements
DbDumpServiceto create a database dump, compress it, and upload it to an S3 endpoint if configured. If the S3 endpoint is unavailable, the service falls back to storing the dump locally. The S3 endpoint and kit ID are now dynamically read from environment variables, and the upload process includes detailed logging and error handling.KIT_ID,TRIP_ID, hostname, or a default), and to handle HTTP response reading and error reporting for the S3 upload.Testing and Validation
DbDumpServiceTestto provide integration tests for the S3 backup process, including tests for database dump creation, S3 endpoint configuration, and kit ID detection. These tests use environment variables and conditional logic to adapt to different test environments.DbDumpServiceMockTestwith unit tests to validate configuration reading, file path construction, endpoint URL formatting, timeout configuration, fallback behavior, and kit ID priority logic, all without requiring a live database or AWS account.