-
Notifications
You must be signed in to change notification settings - Fork 6
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 move files to s3 bucket #3898
Conversation
AWS_ACCESS_KEY_ID=your-access-key-id | ||
AWS_SECRET_ACCESS_KEY=your-secret-access-key | ||
AWS_REGION=eu-west-1 | ||
S3_BUCKET_NAME=fra-platform-s3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to test this branch setting these env vars in .env
// This should be changed to all files, | ||
// left for testing purpose (all files 5.7gb, this subset around 80mb) | ||
const files = await client.query(` | ||
select * from public.file | ||
where | ||
octet_length(file) / 1024.0 / 1024.0 < 2 | ||
and name ilike '%fin%'; | ||
`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: only subset is migrated for testing purposes
2bf6ff9
to
b570cd6
Compare
@@ -0,0 +1,96 @@ | |||
import * as path from 'path' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
major change 1
@@ -0,0 +1,77 @@ | |||
import { Readable } from 'stream' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
major change 2
Purpose of PR: We introduce new service With following methods: The base props taken are |
We also deprecate static file server: This is to migrate the files later to S3 |
const chunks = [] | ||
// eslint-disable-next-line no-restricted-syntax | ||
for await (const chunk of cachedPdfInfo.file.file) { | ||
chunks.push(chunk) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use Promises.each ?
@@ -1,6 +1,6 @@ | |||
import { Request, Response } from 'express' | |||
|
|||
import { FileRepository, fileTypes } from 'server/service/file' | |||
import { FileRepository, fileTypes } from 'server/service/file_deprecated' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have file_deprecated ?
|
implementation:
FileStorage
to write and read filesfile
frompublic.file
todo:
public.file
with public migrationpublic.file
todo/check: