Repository navigation
fix(pages): add Pages deploy workflow, Turnstile bot protection, and CSS/SEO fixes #22
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d06ec06
fix(pages): add Pages deploy workflow, Turnstile bot protection, and …
anwar3606 3975570
fix(contact): reset Turnstile on error and scope page-headline selectors
anwar3606 9204d37
ci(pages): allow deployment trigger on push to website-revamp-fixes
anwar3606 b6463a3
chore: update GitHub Actions workflow to latest versions and specify …
anwar3606 4c77258
fix(contact): update Turnstile site key to dedicated website widget a…
anwar3606 a3a8461
fix(contact): add client-side email format validation
anwar3606 60e6705
fix(contact): ensure pure ES5 browser compatibility without async/awa…
anwar3606 bc86223
docs: rename app.ts to cdk.ts in website-contact-form file structure
anwar3606 97b13ae
chore: restrict deployment workflow to main branch only
anwar3606 a8f0d56
Fix formatting of turnstileToken assignment
anwar3606 bd44f5a
Update deployment trigger details in README
anwar3606 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,46 @@ | ||
| name: Deploy Jekyll site to Pages | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
| - name: Setup Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '3.3' | ||
| bundler-cache: true | ||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v6 | ||
| - name: Build with Jekyll | ||
| run: bundle exec jekyll build --destination ./_site | ||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v5 | ||
| 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@v5 | ||
This file contains hidden or 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,2 +1,7 @@ | ||
| .idea | ||
| .tags | ||
| _site/ | ||
| .sass-cache/ | ||
| .jekyll-cache/ | ||
| .jekyll-metadata | ||
| vendor/ |
This file contains hidden or 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 hidden or 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,116 @@ | ||
| # Provenant Website (`provenant.net`) | ||
|
|
||
| Static corporate website for [Provenant](https://provenant.net), built with Jekyll and deployed automatically to GitHub Pages. | ||
|
|
||
| --- | ||
|
|
||
| ## 1. Overview & Architecture | ||
|
|
||
| ``` | ||
| [Visitor Browser] | ||
| │ | ||
| ├─► Static Content & Assets (GitHub Pages / CDN) | ||
| │ • Jekyll 4.x static site generator | ||
| │ • Automated deployment via GitHub Actions | ||
| │ | ||
| └─► Contact Form Submission (`/contact`) | ||
| │ | ||
| ├─► 1. Cloudflare Turnstile Widget (Bot Defense) | ||
| │ • In-browser challenge validation | ||
| │ • Produces single-use `cf-turnstile-response` token | ||
| │ | ||
| └─► 2. POST https://inbound-inquiries.provenant.net/contact | ||
| • Managed via CDK in `origin-infrastructure/utils/website-contact-form` | ||
| • Amazon API Gateway (HTTP API) with route-level rate limiting | ||
| • AWS Lambda (Node.js 24) verifies token with Cloudflare API | ||
| • Dispatches email notifications via Amazon SES to `info@provenant.net` | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Contact Form & Anti-Bot Protection | ||
|
|
||
| The contact page (`contact.html`) integrates Cloudflare Turnstile and an AWS serverless backend to eliminate form spam without intrusive CAPTCHAs. | ||
|
|
||
| ### Frontend Integration (`contact.html` & `assets/js/contact.js`) | ||
|
|
||
| 1. **Turnstile Script & Widget**: | ||
| The Cloudflare Turnstile API script is loaded asynchronously in `contact.html`: | ||
| ```html | ||
| <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script> | ||
| ``` | ||
| The widget is mounted inside the form: | ||
| ```html | ||
| <div class="cf-turnstile" data-sitekey="<TURNSTILE_SITE_KEY>" data-theme="light"></div> | ||
| ``` | ||
|
|
||
| 2. **Submission Flow**: | ||
| - `assets/js/contact.js` captures form submit events. | ||
| - Extracts the user inputs and `cf-turnstile-response` token. | ||
| - Submits JSON payload to the API endpoint (`https://inbound-inquiries.provenant.net/contact`). | ||
| - If submission fails, `turnstile.reset()` is invoked automatically to issue a fresh token for immediate retry. | ||
| - The API URL can be overridden in development environments via `window.CONTACT_API_URL`. | ||
|
|
||
| ### Backend Infrastructure (`origin-infrastructure`) | ||
|
|
||
| The backend stack is managed as Infrastructure as Code using AWS CDK in the `origin-infrastructure` repository under: | ||
| ``` | ||
| utils/website-contact-form/ | ||
| ├── README.md | ||
| └── cdk/ | ||
| ├── bin/cdk.ts | ||
| ├── lib/website-contact-form-stack.ts | ||
| └── lambda/contact-handler/index.ts | ||
| ``` | ||
|
|
||
| - **Amazon API Gateway**: HTTP API with CORS restricted to `https://provenant.net` and `https://www.provenant.net`. Throttling is configured at 2 req/s (burst 5) at the edge. | ||
| - **AWS Lambda**: Node.js 24 runtime with reserved concurrency capped at 2. Validates payload fields, verifies the Turnstile token against `https://challenges.cloudflare.com/turnstile/v0/siteverify`, and formats the SES email. | ||
| - **AWS Secrets Manager**: Stores the Turnstile secret key under `website-contact-form/turnstile-secret`. The Lambda retrieves and caches this key in memory across warm invocations. | ||
| - **Amazon SES**: Sends inquiry notifications to `info@provenant.net` with identity-scoped IAM permissions. | ||
|
|
||
| --- | ||
|
|
||
| ## 3. Local Development | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Ruby 3.3+ | ||
| - Bundler (`gem install bundler`) | ||
|
|
||
| ### Setup & Run | ||
|
|
||
| 1. Clone repository and install Ruby dependencies: | ||
| ```bash | ||
| bundle install | ||
| ``` | ||
|
|
||
| 2. Start the local Jekyll server: | ||
| ```bash | ||
| bundle exec jekyll serve | ||
| ``` | ||
|
|
||
| 3. Open `http://localhost:4000` in your browser. | ||
|
|
||
| *Note: The Turnstile widget configured for `provenant-website` includes `localhost` in its allowed domain list, allowing end-to-end form verification during local development.* | ||
|
|
||
| --- | ||
|
|
||
| ## 4. Deployment & CI/CD | ||
|
|
||
| Deployment is fully automated through GitHub Actions (`.github/workflows/deploy.yml`): | ||
|
|
||
| - **Trigger**: Every push to the default branch (`main`) (or a manual `workflow_dispatch`). | ||
| - **Build**: Compiles Jekyll assets with `bundle exec jekyll build --destination ./_site`. | ||
| - **Deploy**: Packages and uploads the `_site/` directory to GitHub Pages using `actions/deploy-pages`. | ||
|
|
||
| ### DNS Configuration (Route 53) | ||
|
|
||
| Authoritative DNS for `provenant.net` is managed in AWS Route 53: | ||
|
|
||
| - **Apex (`provenant.net`)**: A records pointing to GitHub Pages Anycast IPs: | ||
| - `185.199.108.153` | ||
| - `185.199.109.153` | ||
| - `185.199.110.153` | ||
| - `185.199.111.153` | ||
| - **Subdomain (`www.provenant.net`)**: CNAME pointing to `provenant-dev.github.io`. | ||
| - **API Subdomain (`inbound-inquiries.provenant.net`)**: Managed by the CDK stack in `origin-infrastructure`. |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.