diff --git a/.github/workflows/mkdocs-material-gh-pages.yml b/.github/workflows/mkdocs-material-gh-pages.yml new file mode 100644 index 0000000..4d41272 --- /dev/null +++ b/.github/workflows/mkdocs-material-gh-pages.yml @@ -0,0 +1,41 @@ +name: deploy-mkdocs +on: + push: + branches: + - main +permissions: + contents: read + pages: write + id-token: write +concurrency: + group: "pages" + cancel-in-progress: false +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Install dependencies + run: pip install -r requirements.txt + - name: Build MkDocs site + run: mkdocs build + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './site' + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 77b7f53..d7d4f0e 100644 --- a/.gitignore +++ b/.gitignore @@ -417,4 +417,5 @@ FodyWeavers.xsd *.msm *.msp -.idea \ No newline at end of file +.idea +/site diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 6b37a60..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1,41 +0,0 @@ -title: LayeredCraft CDK Constructs -description: Reusable AWS CDK constructs for .NET serverless applications -baseurl: "/cdk-constructs" -url: "https://layeredcraft.github.io" - -# Theme settings -theme: minima -show_downloads: true -google_analytics: # Add your tracking ID if needed - -# Minima navigation -header_pages: - - constructs/lambda-function.md - - constructs/static-site.md - - constructs/dynamodb-table.md - - testing/index.md - - examples/index.md - -# Build settings -markdown: kramdown -plugins: - - jekyll-feed - - jekyll-sitemap - - jekyll-remote-theme - -# GitHub repository -github_username: LayeredCraft -repository: LayeredCraft/cdk-constructs - -# Exclude from processing -exclude: - - .sass-cache/ - - .jekyll-cache/ - - gemfiles/ - - Gemfile - - Gemfile.lock - - node_modules/ - - vendor/bundle/ - - vendor/cache/ - - vendor/gems/ - - vendor/ruby/ \ No newline at end of file diff --git a/docs/assets/css/style.scss b/docs/assets/css/style.scss index 399908a..c6166fd 100644 --- a/docs/assets/css/style.scss +++ b/docs/assets/css/style.scss @@ -1,7 +1,7 @@ --- --- -@import "minima"; +@import "{{ site.theme }}"; /* Custom styles for LayeredCraft CDK Constructs documentation */ diff --git a/icon.png b/docs/assets/icon.png similarity index 100% rename from icon.png rename to docs/assets/icon.png diff --git a/docs/constructs/dynamodb-table.md b/docs/constructs/dynamodb-table.md index 71cd55c..b00fc6b 100644 --- a/docs/constructs/dynamodb-table.md +++ b/docs/constructs/dynamodb-table.md @@ -1,22 +1,16 @@ ---- -layout: default -title: DynamoDB Table Construct -permalink: /constructs/dynamodb-table/ ---- - # DynamoDB Table Construct The `DynamoDbTableConstruct` provides a comprehensive, production-ready DynamoDB table with support for global secondary indexes, streams, TTL, and Lambda integration. -## Features +## :bar_chart: Features -- **Flexible Key Schema**: Support for partition keys, sort keys, and composite keys -- **Global Secondary Indexes**: Multiple GSIs with custom key schemas -- **DynamoDB Streams**: Real-time data processing with Lambda integration -- **TTL Support**: Automatic data expiration -- **CloudFormation Outputs**: Automatic exports for table ARN, name, and stream ARN -- **Lambda Integration**: Built-in method for attaching Lambda functions to streams -- **Billing Modes**: Support for both PAY_PER_REQUEST and PROVISIONED billing +- **:key: Flexible Key Schema**: Support for partition keys, sort keys, and composite keys +- **:index_pointing_at_the_viewer: Global Secondary Indexes**: Multiple GSIs with custom key schemas +- **:ocean: DynamoDB Streams**: Real-time data processing with Lambda integration +- **:hourglass: TTL Support**: Automatic data expiration +- **:outbox_tray: CloudFormation Outputs**: Automatic exports for table ARN, name, and stream ARN +- **:zap: Lambda Integration**: Built-in method for attaching Lambda functions to streams +- **:credit_card: Billing Modes**: Support for both PAY_PER_REQUEST and PROVISIONED billing ## Basic Usage @@ -274,8 +268,8 @@ var eventTable = new DynamoDbTableConstruct(this, "EventTable", new DynamoDbTabl ## Testing -See the [Testing Guide](../testing/) for comprehensive testing utilities and patterns specific to the DynamoDB Table construct. +See the [Testing Guide](../testing/index.md) for comprehensive testing utilities and patterns specific to the DynamoDB Table construct. ## Examples -For more real-world examples, see the [Examples](../examples/) section. \ No newline at end of file +For more real-world examples, see the [Examples](../examples/index.md) section. \ No newline at end of file diff --git a/docs/constructs/lambda-function.md b/docs/constructs/lambda-function.md index e48cf3e..9400537 100644 --- a/docs/constructs/lambda-function.md +++ b/docs/constructs/lambda-function.md @@ -1,22 +1,16 @@ ---- -layout: default -title: Lambda Function Construct -permalink: /constructs/lambda-function/ ---- - # Lambda Function Construct The `LambdaFunctionConstruct` provides a comprehensive, production-ready Lambda function with integrated OpenTelemetry support, IAM management, and environment configuration. -## Features +## :rocket: Features -- **OpenTelemetry Integration**: Built-in AWS OpenTelemetry collector layer -- **IAM Management**: Automatic role and policy creation with CloudWatch Logs permissions -- **Environment Configuration**: Easy environment variable management -- **Function URLs**: Optional HTTP endpoint generation -- **SnapStart Support**: Improved cold start performance for Java runtimes -- **Versioning & Aliases**: Automatic version management with "live" alias -- **Lambda Permissions**: Multi-target permission management (function, version, alias) +- **:chart_with_upwards_trend: OpenTelemetry Integration**: Built-in AWS OpenTelemetry collector layer +- **:shield: IAM Management**: Automatic role and policy creation with CloudWatch Logs permissions +- **:gear: Environment Configuration**: Easy environment variable management +- **:link: Function URLs**: Optional HTTP endpoint generation +- **:rocket: SnapStart Support**: Improved cold start performance for Java runtimes +- **:label: Versioning & Aliases**: Automatic version management with "live" alias +- **:key: Lambda Permissions**: Multi-target permission management (function, version, alias) ## Basic Usage @@ -174,15 +168,16 @@ var lambda = new LambdaFunctionConstruct(this, "MyLambda", new LambdaFunctionCon var domain = lambda.LiveAliasFunctionUrlDomain; // Returns the domain string ``` -## Runtime Configuration +## :computer: Runtime Configuration The Lambda functions use the following runtime configuration: -- **Runtime**: `PROVIDED_AL2023` (Amazon Linux 2023) -- **Handler**: `bootstrap` (for custom runtimes) -- **Architecture**: x86_64 -- **Log Retention**: 2 weeks -- **OpenTelemetry Layer**: AWS managed layer (us-east-1 region) +!!! info "Runtime Details" + - **Runtime**: `PROVIDED_AL2023` (Amazon Linux 2023) + - **Handler**: `bootstrap` (for custom runtimes) + - **Architecture**: x86_64 + - **Log Retention**: 2 weeks + - **OpenTelemetry Layer**: AWS managed layer (us-east-1 region) ## IAM Permissions @@ -206,8 +201,8 @@ The construct automatically creates: ## Testing -See the [Testing Guide](../testing/) for comprehensive testing utilities and patterns specific to the Lambda Function construct. +See the [Testing Guide](../testing/index.md) for comprehensive testing utilities and patterns specific to the Lambda Function construct. ## Examples -For more real-world examples, see the [Examples](../examples/) section. \ No newline at end of file +For more real-world examples, see the [Examples](../examples/index.md) section. \ No newline at end of file diff --git a/docs/constructs/static-site.md b/docs/constructs/static-site.md index 7205d5a..8e3cbfa 100644 --- a/docs/constructs/static-site.md +++ b/docs/constructs/static-site.md @@ -1,22 +1,16 @@ ---- -layout: default -title: Static Site Construct -permalink: /constructs/static-site/ ---- - # Static Site Construct The `StaticSiteConstruct` provides complete static website hosting with S3, CloudFront CDN, SSL certificates, Route53 DNS management, and optional API proxying. -## Features +## :globe_with_meridians: Features -- **S3 Website Hosting**: Optimized S3 bucket configuration for static websites -- **CloudFront CDN**: Global content delivery with custom error pages -- **SSL Certificates**: Automatic SSL certificate provisioning and management -- **Route53 DNS**: DNS record management for primary and alternate domains -- **API Proxy Support**: Optional CloudFront behavior for `/api/*` paths -- **Asset Deployment**: Automatic deployment with cache invalidation -- **Custom Error Pages**: 404 and 403 error page handling +- **:file_cabinet: S3 Website Hosting**: Optimized S3 bucket configuration for static websites +- **:zap: CloudFront CDN**: Global content delivery with custom error pages +- **:lock: SSL Certificates**: Automatic SSL certificate provisioning and management +- **:globe_with_meridians: Route53 DNS**: DNS record management for primary and alternate domains +- **:arrows_counterclockwise: API Proxy Support**: Optional CloudFront behavior for `/api/*` paths +- **:package: Asset Deployment**: Automatic deployment with cache invalidation +- **:warning: Custom Error Pages**: 404 and 403 error page handling ## Basic Usage @@ -211,8 +205,8 @@ var docs = new StaticSiteConstruct(this, "Docs", new StaticSiteConstructProps ## Testing -See the [Testing Guide](../testing/) for comprehensive testing utilities and patterns specific to the Static Site construct. +See the [Testing Guide](../testing/index.md) for comprehensive testing utilities and patterns specific to the Static Site construct. ## Examples -For more real-world examples, see the [Examples](../examples/) section. \ No newline at end of file +For more real-world examples, see the [Examples](../examples/index.md) section. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 7037054..32dcafb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,8 +3,6 @@ layout: default title: LayeredCraft CDK Constructs --- -# LayeredCraft CDK Constructs - [![Build Status](https://github.com/LayeredCraft/cdk-constructs/actions/workflows/build.yaml/badge.svg)](https://github.com/LayeredCraft/cdk-constructs/actions/workflows/build.yaml) [![NuGet](https://img.shields.io/nuget/v/LayeredCraft.Cdk.Constructs.svg)](https://www.nuget.org/packages/LayeredCraft.Cdk.Constructs/) [![Downloads](https://img.shields.io/nuget/dt/LayeredCraft.Cdk.Constructs.svg)](https://www.nuget.org/packages/LayeredCraft.Cdk.Constructs/) @@ -61,8 +59,10 @@ public class MyStack : Stack ## Available Constructs -### [Lambda Function Construct](constructs/lambda-function) +### [Lambda Function Construct](constructs/lambda-function.md) + Full-featured Lambda functions with: + - OpenTelemetry integration - IAM roles and policies - Environment variables @@ -70,16 +70,20 @@ Full-featured Lambda functions with: - SnapStart support - Versioning and aliases -### [Static Site Construct](constructs/static-site) +### [Static Site Construct](constructs/static-site.md) + Complete static website hosting with: + - S3 website hosting - CloudFront CDN - SSL certificates - Route53 DNS - API proxy support -### [DynamoDB Table Construct](constructs/dynamodb-table) +### [DynamoDB Table Construct](constructs/dynamodb-table.md) + Production-ready DynamoDB tables with: + - Global secondary indexes - DynamoDB streams - TTL configuration @@ -87,8 +91,8 @@ Production-ready DynamoDB tables with: ## Documentation -- **[Testing Guide](testing/)** - Comprehensive testing utilities and patterns -- **[Examples](examples/)** - Real-world usage examples and patterns +- **[Testing Guide](testing/index.md)** - Comprehensive testing utilities and patterns +- **[Examples](examples/index.md)** - Real-world usage examples and patterns ## Requirements @@ -103,4 +107,4 @@ See the main [README](https://github.com/LayeredCraft/cdk-constructs#contributin ## License -This project is licensed under the [MIT License](https://github.com/LayeredCraft/cdk-constructs/blob/main/LICENSE). \ No newline at end of file +This project is licensed under the [MIT License](https://github.com/LayeredCraft/cdk-constructs/blob/main/LICENSE). diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..937f4ad --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,123 @@ +site_name: LayeredCraft CDK Constructs +site_description: Reusable AWS CDK constructs for .NET serverless applications +site_url: https://layeredcraft.github.io/cdk-constructs/ +site_author: LayeredCraft Team + +# Repository +repo_name: LayeredCraft/cdk-constructs +repo_url: https://github.com/LayeredCraft/cdk-constructs +edit_uri: edit/main/docs/ + +# Copyright +copyright: Copyright © 2024 LayeredCraft Team + +# Configuration +theme: + name: material + language: en + logo: assets/icon.png + favicon: assets/icon.png + + features: + - content.code.copy + - content.code.select + - navigation.expand + - navigation.footer + - navigation.instant + - navigation.sections + - navigation.tabs + - navigation.tabs.sticky + - navigation.top + - search.highlight + - search.share + - search.suggest + - toc.follow + + # Dark/Light mode toggle + palette: + # Light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: indigo + accent: indigo + toggle: + icon: material/brightness-7 + name: Switch to dark mode + + # Dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: indigo + accent: indigo + toggle: + icon: material/brightness-4 + name: Switch to light mode + + font: + text: Roboto + code: Roboto Mono + +# Plugins +plugins: + - search + - minify: + minify_html: true + +# Extensions +markdown_extensions: + # Python Markdown + - abbr + - admonition + - attr_list + - def_list + - footnotes + - md_in_html + - toc: + permalink: true + + # Python Markdown Extensions + - pymdownx.betterem: + smart_enable: all + - pymdownx.caret + - pymdownx.details + - pymdownx.emoji: + emoji_generator: !!python/name:material.extensions.emoji.to_svg + emoji_index: !!python/name:material.extensions.emoji.twemoji + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - pymdownx.inlinehilite + - pymdownx.keys + - pymdownx.mark + - pymdownx.smartsymbols + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format + - pymdownx.tabbed: + alternate_style: true + - pymdownx.tasklist: + custom_checkbox: true + - pymdownx.tilde + +# Navigation +nav: + - Home: index.md + - Constructs: + - Lambda Function: constructs/lambda-function.md + - Static Site: constructs/static-site.md + - DynamoDB Table: constructs/dynamodb-table.md + - Testing: testing/index.md + - Examples: examples/index.md + +# Social links +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/LayeredCraft/cdk-constructs + name: GitHub Repository + - icon: fontawesome/solid/download + link: https://www.nuget.org/packages/LayeredCraft.Cdk.Constructs/ + name: NuGet Package \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6d58373 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +mkdocs>=1.5.3 +mkdocs-material>=9.4.6 +mkdocs-minify-plugin>=0.7.1 \ No newline at end of file diff --git a/src/LayeredCraft.Cdk.Constructs/LayeredCraft.Cdk.Constructs.csproj b/src/LayeredCraft.Cdk.Constructs/LayeredCraft.Cdk.Constructs.csproj index 0c03ee9..80cfa12 100644 --- a/src/LayeredCraft.Cdk.Constructs/LayeredCraft.Cdk.Constructs.csproj +++ b/src/LayeredCraft.Cdk.Constructs/LayeredCraft.Cdk.Constructs.csproj @@ -18,7 +18,7 @@ - +