Skip to content

feat: add local mock storage service for development#18

Merged
aydin-utting merged 2 commits into
mainfrom
feature/local-mock-storage-service
Nov 3, 2025
Merged

feat: add local mock storage service for development#18
aydin-utting merged 2 commits into
mainfrom
feature/local-mock-storage-service

Conversation

@aydin-utting

@aydin-utting aydin-utting commented Oct 29, 2025

Copy link
Copy Markdown
Collaborator
  • Uses a mounted folder to store uploads in the .data/ directory
  • This removes the dependency on S3 when developing

@aydin-utting aydin-utting requested a review from a team as a code owner October 29, 2025 15:59
@aydin-utting aydin-utting force-pushed the feature/local-mock-storage-service branch from 3284b12 to cd961c5 Compare October 31, 2025 11:22
* Uses a mounted folder to store uploads in the `.data` directory
* This removes the dependency on S3 locally
async def delete(cls, key: str) -> None:
with suppress(FileNotFoundError):
storage_path = Path(settings.LOCAL_STORAGE_PATH) / key
storage_path.unlink()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

two things:

  1. you can use .unlink(missing_ok=True) instead of suppress
  2. I wonder if we need a little bit more robustness in how we delete these files, given that it may have data protection implications/cause stability issues with disk space if running on bare metal (similar to how we have back up policies to delete files after a certain age on s3). For instance, if the file is in use, it may not be deleted. We could add a check on the clean up scheduler? It's probably overkill since you would almost certainly want managed storage in prod, so perhaps it's enough to just log a warning about the potential implications when using this service?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This definitely wasn't written with actually using it in production in mind, but I suppose it would work if you were running everything on the same box or with a volume mounted same as in docker compose. I'll add a log saying we recommend only using this for dev

@RichJackson RichJackson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good - left a couple of notes for consideration

@aydin-utting aydin-utting merged commit c474a75 into main Nov 3, 2025
13 of 15 checks passed
@aydin-utting aydin-utting deleted the feature/local-mock-storage-service branch November 3, 2025 10:47
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