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

Deploy documentation to S3 #900

Merged
merged 8 commits into from
Jul 4, 2024
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Smart Forms Workflow
name: Smart Forms Build-Test-Lint Workflow

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_app.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Smart Forms App S3 Deployment Workflow
name: Smart Forms App Deployment Workflow

on:
push:
Expand Down
25 changes: 10 additions & 15 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ name: Smart Forms Docs Deployment Workflow

on:
push:
branches: ['main']

permissions:
contents: read
pages: write
id-token: write

jobs:
deploy-docusaurus:
name: Deploy Docusaurus to GitHub Pages
environment:
name: github-pages
url: ${{ steps.build-publish.outputs.page_url }}

deploy-docusaurus-s3:
name: Deploy Docusaurus to S3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -26,20 +21,20 @@ jobs:
node-version: 18
cache: npm

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::209248795938:role/SmartFormsReactAppDeployment
aws-region: ap-southeast-2

- name: Install dependencies
run: npm ci

- name: Build documentation website
run: npm run build -w documentation

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: documentation/build

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Upload static Docusaurus site to S3
run: aws s3 sync documentation/build s3://smart-forms-docs/docs

deploy-storybook:
name: Deploy Storybook to S3
Expand Down
27 changes: 26 additions & 1 deletion deployment/cloudfront/SmartFormsRedirectToCorrectRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,26 @@ function handler(event) {
}
}


// Replace http://example.com/ig/* into http://example.com/ig/*/index.html
// if (uri.match(/\/ig\/[a-z0-9]+\//i)) {
// request.uri += "index.html";
// return request;
// }


var uriChunks = uri.split('/');
var lastUriChunk = uriChunks[uriChunks.length - 1];
if (!lastUriChunk.includes('.')) {
request.uri += '.html';
return request;
}

}

// Handle Storybook routes
if (uri.includes('/storybook')) {
// Reroute to smartforms.csiro.au/ig/index.html
// Reroute to smartforms.csiro.au/storybook/index.html
if (uri === '/storybook/') {
request.uri += 'index.html';
return request;
Expand All @@ -78,6 +81,28 @@ function handler(event) {
return request;
}


// Handle Docz routes
if (uri.includes('/docz')) {
// Reroute to smartforms.csiro.au/docz/index.html
if (uri === '/docz/') {
request.uri += 'index.html';
return request;
}

if (uri === '/docz') {
request.uri = '/redirect.html';
return request;
}

if (!uri.includes('.')) {
request.uri += '/index.html';
return request;
}

return request;
}

// Handle Forms Server API routes
if (uri.includes('/api')) {
// Remove the /api prefix
Expand Down
5 changes: 4 additions & 1 deletion deployment/forms-server/assemble-endpoint/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export class AssembleEndpoint extends Construct {
logging: AwsLogDriver.awsLogs({
streamPrefix: 'forms-server-assemble',
logRetention: RetentionDays.ONE_MONTH
})
}),
environment: {
FORMS_SERVER_URL: 'https://smartforms.csiro.au/api/fhir'
}
});

this.service = new FargateService(this, 'FormsServerAssembleService', {
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/sdc/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The SDC specification provides a set of guidance around the use of Questionnaire

:::tip

Before diving into this section, it might be worth reading the [usage examples guide](/docs/components#usage-examples) in the Components section.
Before diving into this section, it might be worth reading the [usage examples guide](/docs/components#usage-examples-guide) in the Components section.

:::

Expand Down
5 changes: 2 additions & 3 deletions documentation/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ const config: Config = {

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'aehrc', // Usually your GitHub org/user name.
projectName: 'smart-forms', // Usually your repo name.\
trailingSlash: false,
organizationName: '', // Usually your GitHub org/user name.
projectName: '', // Usually your repo name.\

onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
Expand Down
23 changes: 0 additions & 23 deletions documentation/src/theme/NotFound/Content/LoadingPage.tsx

This file was deleted.

34 changes: 0 additions & 34 deletions documentation/src/theme/NotFound/Content/NotFoundPage.tsx

This file was deleted.

24 changes: 0 additions & 24 deletions documentation/src/theme/NotFound/Content/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion push-extract-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ cd services/extract-express && npm run compile && cd -
# Build the Docker image for multiple architectures, then push to Docker Hub.
docker buildx build --file ./services/extract-express/Dockerfile \
--tag aehrc/smart-forms-extract:latest \
--tag aehrc/smart-forms-extract:v0.3.0 \
--tag aehrc/smart-forms-extract:v0.3.1 \
--platform linux/amd64,linux/arm64/v8 --push --no-cache .
6 changes: 6 additions & 0 deletions services/assemble-express/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ app.use(
origin: '*'
})
);

// Allows the app to accept JSON and URL encoded data up to 50MB
app.use(express.json({ limit: '50mb' }));
app.use(express.urlencoded({ extended: true }));

// Allows the app to work behind reverse proxies, forwarding the correct req.protocol to the /StructureMap/$transform call
// Without this, doing a HTTPS $extract call will result in a HTTP $transform call
app.set('trust proxy', true);

app.get('/fhir/Questionnaire/\\$assemble', (_, res) => {
res.send(
'This service is healthy!\nPerform a POST request to the same path for Questionnaire $assemble.'
Expand Down
2 changes: 1 addition & 1 deletion services/extract-express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "extract-express",
"version": "0.3.0",
"version": "0.3.1",
"description": "",
"main": "lib/index.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions services/extract-express/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ app.use(
origin: '*'
})
);

// Allows the app to accept JSON and URL encoded data up to 50MB
app.use(express.json({ limit: '50mb' }));
app.use(express.urlencoded({ extended: true }));

// Allows the app to work behind reverse proxies, forwarding the correct req.protocol to the /StructureMap/$transform call
// Without this, doing a HTTPS $extract call will result in a HTTP $transform call
app.set('trust proxy', true);

app.get('/fhir/QuestionnaireResponse/\\$extract', (_, res) => {
res.send(
'This service is healthy!\nPerform a POST request to the same path for QuestionnaireResponse $extract.'
Expand Down
2 changes: 1 addition & 1 deletion services/extract-express/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function invokeTransform(
);
}

return await response.json();
return response.json();
}

export interface TransformInputParameters extends Parameters {
Expand Down
2 changes: 1 addition & 1 deletion services/populate-express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "populate-express",
"version": "2.2.6",
"version": "2.2.7",
"description": "",
"main": "lib/index.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions services/populate-express/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ app.use(
origin: '*'
})
);

// Allows the app to accept JSON and URL encoded data up to 50MB
app.use(express.json({ limit: '50mb' }));
app.use(express.urlencoded({ extended: true }));

// Allows the app to work behind reverse proxies, forwarding the correct req.protocol to the /StructureMap/$transform call
// Without this, doing a HTTPS $extract call will result in a HTTP $transform call
app.set('trust proxy', true);

app.get('/fhir/Questionnaire/\\$populate', (_, res) => {
res.send(
'This service is healthy!\nPerform a POST request to the same path for Questionnaire $populate.'
Expand Down
Loading