-
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 #7 from umccr/refactor/toml
refactor: remove TOML config and related changes
- Loading branch information
Showing
28 changed files
with
2,047 additions
and
1,277 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,43 +1,94 @@ | ||
# Quickstart | ||
# htsget-deploy | ||
|
||
Here's how to deploy [htsget-rs's htsget-lambda](https://github.com/umccr/htsget-rs) to AWS: | ||
Deploy a cloud-based implementation of [htsget-rs]. This project contains a reusable CDK construct that deploys | ||
[htsget-lambda] using an AWS [API Gateway][aws-api-gateway] function and an example CDK stack. | ||
|
||
## Quickstart | ||
|
||
1. Authenticate to your AWS account (preferably using SSO). | ||
2. Modify the `bin/settings.ts`, according to your preferences. | ||
3. Modify `config/<YOUR_TOML_FILE>.toml` pointed by `bin/settings.ts` accordingly. | ||
4. Run `cdk deploy`. | ||
Here's how to deploy [htsget-rs's htsget-lambda](https://github.com/umccr/htsget-rs) to AWS: | ||
|
||
If the above guidance is insufficient, please refer to the [DEPLOY.md](DEPLOY.md) document for a more in-depth | ||
walkthrough settings and operations. | ||
1. Install packages by running `npm install` or `pnpm install`. | ||
2. Authenticate to your AWS account (preferably using SSO). | ||
3. Modify the [`bin/settings.ts`][htsget-settings], according to your preferences. All options are documented at [`docs/CONFIG.md`][docs-config]. | ||
4. Run `npx cdk deploy`. | ||
|
||
## Does it work? | ||
### Does it work? | ||
|
||
A simple `curl` command should be able to determine that: | ||
|
||
```sh | ||
curl "https://htsget-demo.ga4gh-demo.org/reads/service-info" | ||
curl "https://htsget.ga4gh-demo.org/reads/service-info" | ||
``` | ||
|
||
Should return a response similar to the following one (some fields elided for brevity): | ||
Should return a response similar to the following: | ||
|
||
```json | ||
{ | ||
"name": "umccr-htsget-rs", | ||
"version": "0.1", | ||
"id": "htsget-lambda/0.5.2", | ||
"createdAt": "2025-01-22T23:29:34.423733522+00:00", | ||
"name": "htsget-lambda", | ||
"version": "0.5.2", | ||
"updatedAt": "2025-01-22T23:29:34.423735886+00:00", | ||
"description": "A cloud-based instance of htsget-rs using AWS Lambda, which serves data according to the htsget protocol.", | ||
"organization": { | ||
"name": "UMCCR", | ||
"url": "https://umccr.org/" | ||
"name": "", | ||
"url": "" | ||
}, | ||
"documentationUrl": "https://github.com/umccr/htsget-rs", | ||
"type": { | ||
"group": "org.ga4gh", | ||
"artifact": "htsget", | ||
"version": "1.3.0" | ||
}, | ||
"htsget": { | ||
"datatype": "reads", | ||
"formats": [ | ||
"BAM", | ||
"CRAM" | ||
] | ||
}, | ||
"contactUrl": "https://umccr.org/", | ||
"documentationUrl": "https://github.com/umccr/htsget-rs", | ||
], | ||
"fieldsParametersEffective": false, | ||
"tagsParametersEffective": false | ||
} | ||
} | ||
``` | ||
|
||
Please note that the example above assumes a publicly accessible endpoint. If you have an authz'd deployment, please use `-H "Authorization: $JWT_TOKEN"` flags added to your `curl` command. | ||
Please note that the example above assumes a publicly accessible endpoint. If you have an authz'd deployment, please add `-H "Authorization: $JWT_TOKEN"` flags to your `curl` command. | ||
|
||
## Library | ||
|
||
The `HtsgetConstruct` is [published][htsget-npm] as an NPM package so that it can be used as construct in other projects. | ||
|
||
## Local development | ||
|
||
This project uses pnpm as the preferred package manager. To install and update the lock file, run: | ||
|
||
```sh | ||
pnpm install | ||
``` | ||
|
||
To generate the [config docs][docs-config], run: | ||
|
||
```sh | ||
npx typedoc | ||
``` | ||
|
||
[htsget-npm]: https://www.npmjs.com/package/htsget-lambda | ||
[docs-config]: docs/CONFIG.md | ||
[htsget-settings]: bin/settings.ts | ||
[cargo-lambda]: https://github.com/cargo-lambda/cargo-lambda | ||
[htsget-rs]: https://github.com/umccr/htsget-rs | ||
[aws-cdk]: https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html | ||
[cdk-context]: https://docs.aws.amazon.com/cdk/v2/guide/context.html | ||
[cdk-lookup-value]: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm.StringParameter.html#static-valuewbrfromwbrlookupscope-parametername | ||
[cdk-json]: cdk.json | ||
[aws-ssm]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html | ||
[aws-api-gateway]: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html | ||
[aws-cognito]: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html | ||
[jwt-authorizer]: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-jwt-authorizer.html | ||
[jwt-audience]: https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/apis-apiid-authorizers-authorizerid.html#apis-apiid-authorizers-authorizerid-model-jwtconfiguration | ||
[route-53]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html | ||
[rust-function]: https://www.npmjs.com/package/rust.aws-cdk-lambda | ||
[aws-cdk]: https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html | ||
[aws-cli]: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html | ||
[npm]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm | ||
[rust]: https://www.rust-lang.org/tools/install |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
import * as cdk from "aws-cdk-lib"; | ||
import { Construct } from "constructs"; | ||
import { HtsgetLambdaProps } from "../index"; | ||
import { SETTINGS } from "./settings"; | ||
import { HtsgetLambda } from "../lib/htsget-lambda"; | ||
|
||
export class HtsgetStack extends cdk.Stack { | ||
constructor( | ||
scope: Construct, | ||
id: string, | ||
settings: HtsgetLambdaProps, | ||
props?: cdk.StackProps, | ||
) { | ||
super(scope, id, props); | ||
|
||
new HtsgetLambda(this, "HtsgetLambda", settings); | ||
} | ||
} | ||
|
||
const app = new cdk.App(); | ||
new HtsgetStack(app, "HtsgetLambdaStack", SETTINGS, { | ||
stackName: "HtsgetLambdaStack", | ||
description: "A stack deploying htsget-rs with API gateway.", | ||
tags: { | ||
Stack: "HtsgetLambdaStack", | ||
}, | ||
env: { | ||
account: process.env.CDK_DEFAULT_ACCOUNT, | ||
region: process.env.CDK_DEFAULT_REGION, | ||
}, | ||
}); |
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 |
---|---|---|
@@ -1,26 +1,9 @@ | ||
import { HtsgetStatelessSettings } from "../lib/htsget-lambda-construct"; | ||
import { HtsgetStatefulSettings } from "../lib/htsget-lambda-construct"; | ||
import { HtsgetLambdaProps } from "../index"; | ||
|
||
/** | ||
* Settings to use for the htsget deployment. | ||
*/ | ||
export const SETTINGS: HtsgetStatelessSettings & HtsgetStatefulSettings = { | ||
config: "config/example_deploy.toml", | ||
domain: "demo.umccr.org", | ||
subDomain: "htsget", | ||
s3BucketResources: [], | ||
lookupHostedZone: true, | ||
createS3Bucket: true, | ||
export const SETTINGS: HtsgetLambdaProps = { | ||
domain: "ga4gh.org", | ||
copyTestData: true, | ||
copyExampleKeys: true, | ||
// Override the bucket name. | ||
// bucketName: "bucket", | ||
jwtAuthorizer: { | ||
// Set this to false if you want a private instance. | ||
public: true, | ||
cogUserPoolId: "", // i.e: ap-southeast-2_iWOHnsurL | ||
jwtAudience: [""], // Should match your cognito client id, i.e: 3jgmc7kqaaf8mqbv2sgmujslrp | ||
}, | ||
// Enable additional features for compiling htsget-rs. `s3-storage` is always enabled. | ||
features: ["experimental", "aws"], // i.e: Enables Crypt4Gh+htsget functionality | ||
}; |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.