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

Data bucket fix #2682

Merged
merged 1 commit into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/update-prod-curator-db-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Migrate prod database schema
on:
push:
# Run workflow when the schema changes. The branch name should always reflect the current release!
branches: [1.9-stable]
branches: [1.11-stable]
paths:
- "data-serving/scripts/setup-db/migrations/**"
- ".github/workflows/update-prod-curator-db-schema.yaml"
workflow_dispatch:
# Run workflow when the schema changes. The branch name should always reflect the current release!
branches: [1.9-stable]
branches: [1.11-stable]
paths:
- "data-serving/scripts/setup-db/migrations/**"
- ".github/workflows/update-prod-curator-db-schema.yaml"
Expand Down
8 changes: 5 additions & 3 deletions verification/curator-service/api/src/controllers/cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const defaultOutputQuery =
export default class CasesController {
constructor(
private readonly dataServerURL: string,
private readonly completeDataBucket: string,
private readonly countryDataBucket: string,
private readonly s3Client: AWS.S3,
) {}

Expand Down Expand Up @@ -200,7 +202,7 @@ export default class CasesController {
const filename = `gh_${year}-${month}-${day}.tar`;

const params = {
Bucket: 'covid-19-data-export',
Bucket: this.completeDataBucket,
Key: 'latest/latestdata-csv.tar',
Expires: 5 * 60,
ResponseContentDisposition:
Expand Down Expand Up @@ -248,7 +250,7 @@ export default class CasesController {
const filename = `${country}.${format}.gz`;
const filepath = `${format}/${filename}`;
const params = {
Bucket: 'covid-19-country-export',
Bucket: this.countryDataBucket,
Key: filepath,
Expires: 5 * 60,
ResponseContentDisposition:
Expand Down Expand Up @@ -305,7 +307,7 @@ export default class CasesController {
const filepath = `${format}/${country}.${format}.gz`;
const contains = await this.s3Client
.headObject({
Bucket: 'covid-19-country-export',
Bucket: this.countryDataBucket,
Key: filepath,
})
.promise()
Expand Down
6 changes: 5 additions & 1 deletion verification/curator-service/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ async function makeApp() {
);

// Configure cases controller proxying to data service.
const casesController = new CasesController(env.DATASERVER_URL, s3Client);
const casesController = new CasesController(
env.DATASERVER_URL,
env.COMPLETE_DATA_BUCKET,
env.COUNTRY_DATA_BUCKET,
s3Client);
apiRouter.get(
'/cases',
authenticateByAPIKey,
Expand Down
10 changes: 10 additions & 0 deletions verification/curator-service/api/src/util/validate-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export default function validateEnv(): Readonly<{
AWS_ACCESS_KEY_ID: string;
AWS_SECRET_ACCESS_KEY: string;
AWS_SERVICE_REGION: string;
COMPLETE_DATA_BUCKET: string;
COUNTRY_DATA_BUCKET: string;
CURATOR_VERSION: string;
DATASERVER_URL: string;
DB_CONNECTION_STRING: string;
Expand Down Expand Up @@ -44,6 +46,14 @@ export default function validateEnv(): Readonly<{
desc: 'AWS region in which to interact with services/resources',
default: 'eu-central-1',
}),
COMPLETE_DATA_BUCKET: str({
desc: 'S3 bucket containing case data by country',
devDefault: 'covid-19-data-export-dev-eu',
}),
COUNTRY_DATA_BUCKET: str({
desc: 'S3 bucket containing case data by country',
devDefault: 'covid-19-country-export-dev-eu',
}),
CURATOR_VERSION: str({
desc: 'version string to display in UI for bug reports etc.',
devDefault: '(local testing)',
Expand Down