Repository navigation
Store uploads in Azure Blob Storage - #8
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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 PR adds Azure Blob Storage as a file storage backend, so uploaded images survive restarts of the backend.
Why
FILE_STORAGE_PROVIDER=local, so uploads are written to the container's filesystem.uploaded_filesrows still point to them.What changed
AzureBlobObjectStorageinstorage/service.py, selected withFILE_STORAGE_PROVIDER=azureAZURE_STORAGE_CONNECTION_STRING.DefaultAzureCredential, so there is no storage key anywhere.docker-compose.ymlfor local developmentazure-storage-blob,azure-identityTesting
ResourceNotFoundErrorget_storage("azure")returns the new backenddocker runrather than as a service container, because services can't take--skipApiVersionCheck. Without that flag, Azurite 3.34.0 rejects the API version used byazure-storage-blob12.31.Deployment
Already created in
rg-supportagent-dev:stsupportagentdevin Sweden Central: no public blob access, TLS 1.2, shared key access disableduploadsStorage Blob Data Contributorrole for the app's identityid-supportagent-dev, scoped to theuploadscontainer onlyAfter this PR is merged and deployed, set these on the Container App:
FILE_STORAGE_PROVIDER=azureAZURE_STORAGE_ACCOUNT_URL=https://stsupportagentdev.blob.core.windows.netAZURE_STORAGE_CONTAINER=uploadsAZURE_CLIENT_ID= the client ID ofid-supportagent-dev. The app uses a user-assigned identity, soDefaultAzureCredentialneeds to be told which one to use.Deploy the code before changing the config. The running code doesn't know the
azureprovider, so switching the config first would make every upload fail.There are no existing files to copy, because
uploaded_filesis empty in the dev database.Follow-ups (not in this PR)
SupabaseObjectStorageand its test once Supabase is gone for goodupload_imageis anasyncendpoint but makes blocking storage, LLM and database calls