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

3855 - Check all files exist in S3 #4207

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

sorja
Copy link
Contributor

@sorja sorja commented Jan 13, 2025

dev note: Avoid run many times back to back -
// Note: Running this script many times may cause runners IP to timeout as protection mechanism

@sorja sorja self-assigned this Jan 13, 2025
@sorja sorja changed the title 3855 test migration 3855 - Check all files exist in S3 Jan 13, 2025
@sorja sorja requested a review from minotogna January 13, 2025 15:08
@sorja sorja marked this pull request as ready for review January 13, 2025 15:08
const batchResults = await Promises.each(batches, async (batch) => {
return Promises.each(batch, async ({ uuid: key }) => {
const exists = await FileStorage.fileExists({ key })
if (!exists) Logger.info(`Missing file in S3: ${key}`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I deleted one file from S3 manually to see output from this command
All other files are there (and the file was there before manual deletion ;) )

0077fe28-....-....-....-5809eb1d364c

@sorja
Copy link
Contributor Author

sorja commented Jan 13, 2025

@minotogna I tried figuring out the best way to test this - but I think in the end, the most important part is that the files exist in S3 - everything else should be reduntant because we didn't change other logic.
The URLs for files are equal and untouched, so if the node server routes correctly to S3 using the file uuid and the file exists, then there is no problems

I couldn't cause other issues in the platform other than a timeout from S3 from spamming requests

@sorja sorja force-pushed the 3855-test-migration branch from 72ef59e to dbb1525 Compare January 13, 2025 15:17
Copy link
Member

@minotogna minotogna left a comment

Choose a reason for hiding this comment

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

👍

@mergify mergify bot merged commit 79058bd into 3855-move-files-to-s3-bucket Jan 13, 2025
5 checks passed
@mergify mergify bot deleted the 3855-test-migration branch January 13, 2025 15:45
mergify bot added a commit that referenced this pull request Jan 20, 2025
* 3855 - file storage using s3

* 3855 - deprecate old static files

* 3855 - migration step: files to s3

* 3855 - responses: add sendFileStream

* 3855 - repository/file: don't return file data from postgres/db

* 3855 - user profile picture get/put to s3

* 3855 - report get/put to s3

* 3855 - user profile picture get/put to s3

* 3855 - upload file to s3 - tool

* 3855 - create and read files from s3

* eol .env.template

* FileSize

* add default path to uploads

* 3855 - fileStorage: fileExists

* 3855 - Add checks to avoid duplicate file uploads and ensure idempotent migration

* remove double clause

* type and migration fix

* remove column public.file.file

* Migrate all files

* 3855 - Check all files exist in S3 (#4207)

* 3855 - Add Arrays.chunk

* 3855 - Add env var: authCookie

* 3855 - Update test

* 3855 - Remove authCookie env var

* 3855 - Separate upload files (#4215)

* rename testAllFilesUploaded

* 3855 - Separate file uploading

* 3855 - Move s3Files under tools

* 3855 - Include public.file in db copy (#4217)

* 3855 - minor fixes (#4224)

* 3855 - delete file from s3 (#4225)

* 3855 - Remove file from public.file (#4226)

* 3855 - Remove unused files from S3 (#4231)

* 3855 - Add transaction for public.file row removal (#4232)

* 3855 - Show file size after uploading (#4233)

* 3855 - Add transaction for public.file row removal

* 3855 - Show file size after upload

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

---------

Co-authored-by: Mino Togna <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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