Skip to content

Commit 781a4d5

Browse files
author
Zinovii Dmytriv
authored
Refarch (#563)
Setup for reference architecture documentation
1 parent d67a18c commit 781a4d5

17 files changed

+350
-307
lines changed

.github/workflows/website-deploy-preview.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ jobs:
4949
with:
5050
fetch-depth: 0
5151

52+
- name: Setup Node
53+
uses: actions/setup-node@v3
54+
with:
55+
node-version-file: ".nvmrc"
56+
5257
- name: "Checkout 'terraform-aws-components' Repository"
5358
uses: actions/checkout@v3
5459
with:
@@ -62,33 +67,33 @@ jobs:
6267
with:
6368
python-version: '3.10'
6469

65-
- name: "Install deps"
70+
- name: "Install Python Dependencies"
6671
run: |
6772
make init
6873
pip install -r scripts/docs-collator/requirements.txt
6974
70-
- name: "Render docs for components"
75+
- name: "Render Documentation for Terraform Components"
7176
run: |
7277
./scripts/render-docs-for-components.sh
7378
74-
- name: "Render docs for modules"
79+
- name: "Render Documentation for Terraform Modules"
7580
env:
76-
PUBLIC_REPO_ACCESS_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
81+
PUBLIC_REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
7782
run: |
7883
./scripts/render-docs-for-modules.sh
7984
8085
- name: "Render Documentation for GitHub Actions"
8186
env:
82-
PUBLIC_REPO_ACCESS_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
87+
PUBLIC_REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
8388
run: |
8489
./scripts/render-docs-for-github-actions.sh
8590
8691
- name: Install Dependencies and Build Website
8792
env:
8893
GOOGLE_TAG_MANAGER: GTM-ABCD123
8994
run: |
90-
make deps-production
91-
make build
95+
make init
96+
make build-production
9297
9398
- name: Copy Website to S3 Bucket PR Folder
9499
run: |

.github/workflows/website-deploy-release.yml

Lines changed: 9 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -10,92 +10,20 @@ on:
1010
types:
1111
- published
1212

13-
env:
14-
AWS_REGION: us-east-2
15-
IAM_ROLE_ARN: arn:aws:iam::557075604627:role/cplive-plat-ue2-prod-cloudposse-docs-gha
16-
IAM_ROLE_SESSION_NAME: cloudposse-docs-ci-deploy-release
17-
S3_BUCKET_NAME: cplive-plat-ue2-prod-cloudposse-docs-origin
18-
DEPLOYMENT_HOST: docs.cloudposse.com
19-
ALGOLIA_INDEX_NAME: docs.cloudposse.com
20-
ALGOLIA_APP_ID: 32YOERUX83
21-
22-
# These permissions are needed to interact with the GitHub's OIDC Token endpoint
23-
permissions:
24-
id-token: write
25-
contents: read
26-
2713
jobs:
28-
website-deploy-release:
14+
trigger_documentation_deployment:
2915
runs-on: ubuntu-latest
3016

3117
environment:
3218
name: production
33-
url: https://${{ env.DEPLOYMENT_HOST }}
19+
url: https://docs.cloudposse.com
3420

3521
steps:
36-
# https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions
37-
- name: Configure AWS Credentials
38-
uses: aws-actions/configure-aws-credentials@v1
39-
with:
40-
aws-region: ${{ env.AWS_REGION }}
41-
role-to-assume: ${{ env.IAM_ROLE_ARN }}
42-
role-session-name: ${{ env.IAM_ROLE_SESSION_NAME }}
43-
44-
- name: Checkout Repository
45-
uses: actions/checkout@v3
46-
with:
47-
fetch-depth: 0
48-
49-
- name: "Checkout 'terraform-aws-components' Repository"
50-
uses: actions/checkout@v3
51-
with:
52-
fetch-depth: 1
53-
repository: cloudposse/terraform-aws-components
54-
ref: master
55-
path: tmp/components/terraform-aws-components
56-
57-
- name: "Setup Python"
58-
uses: actions/setup-python@v4
59-
with:
60-
python-version: '3.10'
61-
62-
- name: "Install deps"
63-
run: |
64-
make init
65-
pip install -r scripts/docs-collator/requirements.txt
66-
67-
- name: "Render Documentation for Terraform Components"
68-
run: |
69-
./scripts/render-docs-for-components.sh
70-
71-
- name: "Render Documentation for Terraform Modules"
72-
env:
73-
PUBLIC_REPO_ACCESS_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
74-
run: |
75-
./scripts/render-docs-for-modules.sh
76-
77-
- name: "Render Documentation for GitHub Actions"
78-
env:
79-
PUBLIC_REPO_ACCESS_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
80-
run: |
81-
./scripts/render-docs-for-github-actions.sh
82-
83-
- name: Install Dependencies and Build Website
84-
env:
85-
GOOGLE_TAG_MANAGER: ${{ vars.GOOGLE_TAG_MANAGER }}
86-
run: |
87-
make deps-production
88-
make build
89-
90-
- name: Copy Website to S3 Bucket
91-
run: |
92-
cd build
93-
aws sts get-caller-identity
94-
aws s3 sync . s3://${{ env.S3_BUCKET_NAME }} --delete
95-
aws s3 ls s3://${{ env.S3_BUCKET_NAME }} --recursive --human-readable --summarize
96-
97-
- name: ReIndex with Algolia
98-
env:
99-
ALGOLIA_SCRAPER_API_KEY: ${{ secrets.ALGOLIA_SCRAPER_API_KEY }}
22+
- name: Trigger Documentation Deployment
10023
run: |
101-
./algolia/reindex.sh
24+
curl \
25+
-X POST \
26+
-H "Authorization: Bearer ${{ secrets.TRIGGER_DOCS_REDEPLOY_WORKFLOW_REFARCH }}" \
27+
-H "Accept: application/vnd.github.everest-preview+json" \
28+
https://api.github.com/repos/cloudposse/refarch-scaffold/dispatches \
29+
-d '{"event_type": "redeploy_documentation"}'

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ algolia.index.json
5858
content/components/catalog/aws/**
5959
content/modules/catalog/**
6060
content/github-actions/catalog/actions/**
61+
content/reference-architecture/**
62+
static/assets/refarch/**
63+
!content/reference-architecture/reference-architecture-overview.md
64+
!content/reference-architecture/refarch.json
65+
!content/reference-architecture/sitemap.xml

Makefile

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
SHELL := /bin/bash
22

3-
export COMPONENTS_DIR ?= content/components
4-
export DOCUSAURUS_PORT ?= 3000
5-
6-
export DOCKER_ORG ?= cloudposse
7-
export DOCKER_IMAGE ?= $(DOCKER_ORG)/docs
8-
export DOCKER_TAG ?= latest
9-
export DOCKER_IMAGE_NAME ?= $(DOCKER_IMAGE):$(DOCKER_TAG)
10-
export DOCKER_BUILD_FLAGS =
11-
export DOCKER_RUN_FLAGS ?= --rm
12-
export DOCKER_RUN ?= docker run $(DOCKER_RUN_FLAGS) -v $(CURDIR):/src -p $(DOCUSAURUS_PORT):$(DOCUSAURUS_PORT) $(DOCKER_IMAGE_NAME)
13-
143
-include $(shell curl -sSL -o .build-harness "https://cloudposse.tools/build-harness"; echo .build-harness)
154

165
.DEFAULT_GOAL := all
176

187
all: real-clean build
198
@exit 0
209

21-
deps: docker/build
22-
$(DOCKER_RUN) npm install
23-
24-
deps-production: docker/build
25-
$(DOCKER_RUN) npm install --only=production
10+
deps:
11+
npm install --only=production
2612

2713
.PHONY: build
2814

2915
build: deps
30-
$(DOCKER_RUN) npm run build
16+
npm run build
17+
18+
# removed all files from `assets/js/*.js` and made 2 new special files `main.*.js` and `runtime~main.*.js`. This way we will not gonna get 404 by browser and page will load faster.
19+
build-production: build
20+
ASSETS_DIR="build/assets/js" && \
21+
ASSETS_MAIN_FILE="$$(ls -1 $${ASSETS_DIR}/main.*.js)" && \
22+
ASSETS_RUNTIME_MAIN_FILE="$$(ls -1 $${ASSETS_DIR}/runtime~main.*.js)" && \
23+
rm -rf $${ASSETS_DIR}/* && \
24+
touch $${ASSETS_MAIN_FILE} && \
25+
touch $${ASSETS_RUNTIME_MAIN_FILE}
3126

3227
start:
3328
npm start
3429

30+
start-production:
31+
npm run serve
32+
3533
real-clean:
3634
rm -fr .docusaurus && \
3735
rm -fr build && \

algolia/reindex.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
ALGOLIA_INDEX_NAME=${ALGOLIA_INDEX_NAME:-test}
44
DEPLOYMENT_HOST=${DEPLOYMENT_HOST:-'docs.cloudposse.com'}
55
ALGOLIA_APP_ID=${ALGOLIA_APP_ID:-'32YOERUX83'}
6+
ALGOLIA_CRAWLER_USER=${ALGOLIA_CRAWLER_USER:-test}
7+
ALGOLIA_CRAWLER_PASSWORD=${ALGOLIA_CRAWLER_PASSWORD:-test}
68

79
[ -z "$ALGOLIA_SCRAPER_API_KEY" ] && echo "Need to set ALGOLIA_SCRAPER_API_KEY" && exit 1;
810

@@ -19,5 +21,7 @@ cat algolia.index.json
1921
docker run \
2022
--env APPLICATION_ID="${ALGOLIA_APP_ID}" \
2123
--env API_KEY="${ALGOLIA_SCRAPER_API_KEY}" \
24+
--env DOCSEARCH_BASICAUTH_USERNAME="${ALGOLIA_CRAWLER_USER}" \
25+
--env DOCSEARCH_BASICAUTH_PASSWORD="${ALGOLIA_CRAWLER_PASSWORD}" \
2226
--env "CONFIG=$(cat algolia.index.json | jq -r tostring)" \
2327
algolia/docsearch-scraper

content/account/confirmation.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Account Confirmation
3+
---
4+
5+
# Account Confirmation
6+
7+
Your registration must be approved by an administrator.

content/account/email_verification.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Email Verification
3+
---
4+
5+
# Email Verification
6+
7+
Please verify your email in order to proceed.

content/reference-architecture/.gitkeep

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Reference Architecture Overview"
3+
sidebar_position: 100
4+
---
5+
6+
# Reference Architecture Overview
7+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
3+
xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
4+
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
5+
</urlset>

docusaurus.config.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @ts-check
2-
2+
const { redirects } = require("./redirects");
33
const lightCodeTheme = require('prism-react-renderer/themes/vsDark');
44
const darkCodeTheme = require('prism-react-renderer/themes/nightOwl');
55

@@ -54,6 +54,29 @@ const config = {
5454
sidebarPath: require.resolve('./sidebars-github-actions.js')
5555
},
5656
],
57+
[
58+
'@docusaurus/plugin-content-docs',
59+
{
60+
id: 'reference-architecture',
61+
path: 'content/reference-architecture',
62+
routeBasePath: 'reference-architecture/',
63+
sidebarPath: require.resolve('./sidebars-refarch.js')
64+
},
65+
],
66+
[
67+
'@docusaurus/plugin-content-pages',
68+
{
69+
id: 'account',
70+
path: 'content/account/',
71+
routeBasePath: 'account/'
72+
},
73+
],
74+
[
75+
'@docusaurus/plugin-client-redirects',
76+
{
77+
redirects
78+
},
79+
],
5780
[
5881
"@docusaurus/plugin-google-gtag",
5982
{
@@ -134,6 +157,12 @@ const config = {
134157
position: 'left',
135158
label: 'GitHub Actions',
136159
},
160+
{
161+
href: '/reference-architecture/reference-architecture-overview/',
162+
position: 'left',
163+
html: 'Reference Architecture',
164+
target: '_self',
165+
},
137166
{
138167
type: 'dropdown',
139168
label: 'Community',

0 commit comments

Comments
 (0)