-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #759 from umccr/feat/htsget
feat(htsget): add htsget support
- Loading branch information
Showing
10 changed files
with
250 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
AppStage, | ||
cognitoApiGatewayConfig, | ||
corsAllowOrigins, | ||
logsApiGatewayConfig, | ||
vpcProps, | ||
} from '../constants'; | ||
import { HtsgetStackConfigurableProps } from '../../lib/workload/stateless/stacks/htsget/stack'; | ||
|
||
export const getHtsgetProps = (stage: AppStage): HtsgetStackConfigurableProps => { | ||
return { | ||
vpcProps, | ||
apiGatewayCognitoProps: { | ||
...cognitoApiGatewayConfig, | ||
corsAllowOrigins: corsAllowOrigins[stage], | ||
apiGwLogsConfig: logsApiGatewayConfig[stage], | ||
apiName: 'Htsget', | ||
customDomainNamePrefix: 'htsget-file', | ||
}, | ||
}; | ||
}; |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# htsget stack | ||
|
||
This stack deploys [htsget-rs] to access files. Any files accessible by filemanager are also accessible using htsget. | ||
|
||
The deployed instance of the htsget-rs can be reached using stage at `https://htsget-file.<stage>.umccr.org` | ||
and the orcabus API token. To retrieve the token, run: | ||
|
||
```sh | ||
export TOKEN=$(aws secretsmanager get-secret-value --secret-id orcabus/token-service-jwt --output json --query SecretString | jq -r 'fromjson | .id_token') | ||
``` | ||
|
||
Then, the API can be queried: | ||
|
||
```sh | ||
curl -H "Authorization: Bearer $TOKEN" "https://htsget-file.dev.umccr.org/reads/service-info" | jq | ||
``` | ||
|
||
[htsget-rs]: https://github.com/umccr/htsget-rs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# TODO this will eventually be removed for props-only configuration. | ||
|
||
ticket_server_cors_allow_headers = "All" | ||
ticket_server_cors_allow_origins = "Mirror" | ||
ticket_server_cors_allow_methods = "All" | ||
ticket_server_cors_allow_credentials = true | ||
ticket_server_cors_max_age = 300 | ||
|
||
data_server_enabled = false | ||
|
||
name = "orcabus-htsget-rs" | ||
version = "0.1.0" | ||
organization_name = "UMCCR" | ||
organization_url = "https://umccr.org/" | ||
contact_url = "https://umccr.org/" | ||
documentation_url = "https://github.com/umccr/htsget-rs" | ||
|
||
# The role should prevent any access to other files, although it should probably | ||
# be set here as well. | ||
[[resolvers]] | ||
regex = '^(?P<bucket>.*?)/(?P<key>.*)$' | ||
substitution_string = '$key' | ||
storage.backend = 'S3' | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Construct } from 'constructs'; | ||
import { Stack, StackProps } from 'aws-cdk-lib'; | ||
import { Role } from 'aws-cdk-lib/aws-iam'; | ||
import { IVpc, Vpc, VpcLookupOptions } from 'aws-cdk-lib/aws-ec2'; | ||
import { ApiGatewayConstruct, ApiGatewayConstructProps } from '../../../components/api-gateway'; | ||
import path from 'path'; | ||
import { HtsgetLambdaConstruct } from 'htsget-lambda'; | ||
|
||
/** | ||
* Configurable props for the htsget stack. | ||
*/ | ||
export type HtsgetStackConfigurableProps = { | ||
/** | ||
* Props to lookup vpc. | ||
*/ | ||
vpcProps: VpcLookupOptions; | ||
/** | ||
* API gateway construct props. | ||
*/ | ||
apiGatewayCognitoProps: ApiGatewayConstructProps; | ||
}; | ||
|
||
/** | ||
* Props for the data migrate stack. | ||
*/ | ||
export type HtsgetStackProps = HtsgetStackConfigurableProps & { | ||
/** | ||
* The role to use. | ||
*/ | ||
role: Role; | ||
}; | ||
|
||
/** | ||
* Deploys htsget-rs with access to filemanager data. | ||
*/ | ||
export class HtsgetStack extends Stack { | ||
private readonly vpc: IVpc; | ||
private readonly apiGateway: ApiGatewayConstruct; | ||
|
||
constructor(scope: Construct, id: string, props: StackProps & HtsgetStackProps) { | ||
super(scope, id, props); | ||
|
||
this.vpc = Vpc.fromLookup(this, 'MainVpc', props.vpcProps); | ||
this.apiGateway = new ApiGatewayConstruct(this, 'ApiGateway', props.apiGatewayCognitoProps); | ||
|
||
const configPath = path.join(__dirname, 'deploy.toml'); | ||
new HtsgetLambdaConstruct(this, 'Htsget', { | ||
config: configPath, | ||
vpc: this.vpc, | ||
role: props.role, | ||
httpApi: this.apiGateway.httpApi, | ||
}); | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.