Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2db73b0
init: new CDK deployment
Apr 29, 2026
a5d374b
fix Lambda deployment
Apr 29, 2026
05597ca
add Api Gateway for Lambdas and Cloudfront; update config for dev
May 4, 2026
f10d031
actually add config this time
May 4, 2026
542ec9c
autoformat CDK files
May 4, 2026
807ea0b
Code-Cleanup CDK
May 5, 2026
374658d
better document distribution methods
May 5, 2026
479d725
CDK-Dokumentation hinzugefügt
May 31, 2026
4370d83
AWS-Account immer aus Config nehmen
Jun 19, 2026
436dbb3
Aktualisierung Bucket Suffix
Jun 19, 2026
e98ae6f
Update auf neues ACM-Cert in Zielaccount
Jun 19, 2026
37ac4f0
don't share project buckets between dev and staging environments
Sep 3, 2026
e9c2833
add esbuild to yarn build process for lambdas
Sep 3, 2026
35a89c8
feat(deploy): allow uploading new assets to dev projects bucket from …
jh0ker Sep 7, 2026
284ac39
update Readme and autogenerated deployment.md
Sep 8, 2026
b83603c
Add initial gated deploy pipeline for dev
Sep 10, 2026
66136f3
Move / disable old workflows
Sep 10, 2026
cd2d911
add deploy workflow for dev and workflows for deploy and staging
Sep 15, 2026
6ea9d55
Disable hosted zones / Route53 for now
Sep 16, 2026
58bf37c
Update deployment workflows and documentation
Sep 16, 2026
babc5ae
set AWS account ID for all environments
Sep 21, 2026
7749790
Add BRANCH variable and bash shell features to workflows
Sep 21, 2026
df7eb84
Change allowedMethods from Cloudfront to project bucket
Sep 21, 2026
2a84c66
Bundle dependencies in Lambda with esbuild
Sep 22, 2026
463a036
Add entrypoint rewriting for /settings and /teilen, both for CloudFro…
Sep 22, 2026
3f6beef
Remove *.js from CDK .gitignore for Cloudfront Functions
Sep 23, 2026
e81eaeb
Route all page requests in the CloudFront Function, remove global err…
Sep 23, 2026
c4ac5ca
Add frontend deployment order, disable pruning for static assets but …
Sep 24, 2026
8f8f0c2
Fix Lambda memory size
Sep 24, 2026
534de3a
document Cloudfront Function
Sep 24, 2026
db61163
Update README.md and DEPLOYMENT.md
Sep 24, 2026
2cbe9d1
Add some useful CFN Outputs
Sep 24, 2026
b229325
Fix typo in workflow environemnt variable name
Sep 24, 2026
35a8cf9
Install optional Yarn dependencies to fix pr-checks
Sep 24, 2026
75d4ec7
Remove Netlify stuff to fix build
Sep 24, 2026
2234b38
add todo item
Sep 24, 2026
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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
S3_BUCKET_PREFIX=hackingstudio-code4maus-projects
S3_BUCKET_PREFIX=pmdm-projectbucket
AWS_REGION=eu-central-1
126 changes: 126 additions & 0 deletions .github/workflows/_deploy-gated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Deployment-Workflow mit Bestätigung, angedacht für staging und prod
# Job "plan": führt `cdk synth` aus und schreibt die Ánderungen bzw. das Diff in den Job-Output.
# cdk.out wird als Artefakt gespeichert
# Job "apply": lädt das neue Template (bzw. cdk.out) herunter und deployt es

name: deploy (gated)

on:
workflow_call:
inputs:
stage:
description: CDK-Stage (staging | prod)
required: true
type: string
environment:
description: Github-Environment (Approval-Gate + Secrets)
required: true
type: string

permissions:
contents: read

env:
AWS_REGION: eu-central-1
NODE_OPTIONS: --max-old-space-size=4096

jobs:
# ---- Plan: synth + diff, ohne etwas zu verändern -------------------------
plan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Node 24 einrichten
uses: actions/setup-node@v4
with:
node-version: 24
cache: yarn

- name: AWS-Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_2026 }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_2026 }}
aws-region: ${{ env.AWS_REGION }}

- name: Frontend-Dependencies installieren
run: yarn install --frozen-lockfile

- name: Frontend bauen
run: yarn build
env:
NODE_ENV: production
BRANCH: ${{ github.ref_name }}

- name: CDK-Dependencies installieren
run: npm ci
working-directory: cdk

- name: CDK synth
run: npx cdk synth --context stage=${{ inputs.stage }}
working-directory: cdk

# diff gegen den deployten Stack (change-set-basiert = autoritativ) in die
# Run-Summary schreiben, damit Reviewer:innen es VOR der Freigabe sehen.
- name: CDK diff → Summary
working-directory: cdk
shell: bash
run: |
npx cdk diff --app cdk.out "MausApp-${{ inputs.stage }}" 2>&1 | tee diff.txt
Comment thread
jh0ker marked this conversation as resolved.
{
echo "## CDK diff (${{ inputs.stage }})"
echo '```'
cat diff.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"

- name: Cloud Assembly sichern
uses: actions/upload-artifact@v4
with:
name: cloud-assembly-${{ inputs.stage }}
path: cdk/cdk.out
retention-days: 5

# ---- Apply: deployt exakt das geplante Assembly, nach Approval ------------
apply:
needs: plan
runs-on: ubuntu-latest
# Das Environment ist das Gate: hat es einen Required Reviewer (prod),
# pausiert der Run hier, bis freigegeben wird.
environment: ${{ inputs.environment }}
concurrency:
group: deploy-${{ inputs.stage }}
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Node 24 einrichten
uses: actions/setup-node@v4
with:
node-version: 24
cache: yarn

- name: AWS-Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_2026 }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_2026 }}
aws-region: ${{ env.AWS_REGION }}

# Nur die CDK-CLI wird gebraucht; nicht neu bauen/synthen.
- name: CDK-Dependencies installieren
run: npm ci
working-directory: cdk

- name: Cloud Assembly laden
uses: actions/download-artifact@v4
with:
name: cloud-assembly-${{ inputs.stage }}
path: cdk/cdk.out

- name: CDK deploy (exakt das reviewte Assembly)
working-directory: cdk
run: npx cdk deploy --app cdk.out "MausApp-${{ inputs.stage }}" --require-approval never
71 changes: 71 additions & 0 deletions .github/workflows/_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Baut Assets und `cdk deploy`t direkt, ohne Bestätigung
Comment thread
jh0ker marked this conversation as resolved.
# intendiert für dev
name: deploy

on:
workflow_call:
inputs:
stage:
description: CDK-Stage (dev / staging / prod)
required: true
type: string
environment:
description: GitHub-Environment
required: true
type: string

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-26.04 # noch in Test -> latest lieber vermeiden
#runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
# verhindert überlappende Deploys auf dieselbe Stage
concurrency:
group: deploy-${{ inputs.stage }}
cancel-in-progress: false
env:
Comment thread
jh0ker marked this conversation as resolved.
AWS_REGION: eu-central-1
NODE_OPTIONS: --max-old-space-size=4096
BRANCH: ${{ github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Node 24 einrichten
uses: actions/setup-node@v4
with:
node-version: 24
cache: yarn

- name: AWS-Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_2026 }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_2026 }}
aws-region: ${{ env.AWS_REGION }}

- name: Frontend-Dependencies installieren
run: yarn install --frozen-lockfile

- name: Frontend bauen
run: yarn build
env:
NODE_ENV: production

# CDK-Projekt (npm). esbuild für das Lambda-Bundling wird aus dem
# Repo-Root (yarn) aufgelöst und muss dort nicht erneut installiert werden
- name: CDK-Dependencies installieren
run: npm ci
working-directory: cdk

# Loggt das diff -> keine Bestätigung nötig
- name: CDK diff
run: npx cdk diff --context stage=${{ inputs.stage }}
working-directory: cdk

- name: CDK deploy
run: npx cdk deploy --context stage=${{ inputs.stage }} --require-approval never
working-directory: cdk
19 changes: 19 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Push auf develop -> Deploy auf Stage dev. Zusätzlich manuell per
# workflow_dispatch (praktisch, um einen Feature-Branch gegen dev zu testen).
name: Deploy dev

on:
push:
branches: [develop]
workflow_dispatch:

permissions:
contents: read

jobs:
deploy:
uses: ./.github/workflows/_deploy.yml
with:
stage: dev
environment: dev
secrets: inherit
19 changes: 19 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Push auf production -> Plan/Approve/Apply auf Stage prod.
# Das GitHub-Environment "prod" braucht einen Required Reviewer, damit der
# Apply-Job erst nach manueller Freigabe läuft.
name: Deploy production

on:
push:
branches: [production]

permissions:
contents: read

jobs:
deploy:
uses: ./.github/workflows/_deploy-gated.yml
with:
stage: prod
environment: prod
secrets: inherit
17 changes: 17 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Push auf staging -> Plan/Approve/Apply auf Stage staging.
name: Deploy staging

on:
push:
branches: [staging]

permissions:
contents: read

jobs:
deploy:
uses: ./.github/workflows/_deploy-gated.yml
with:
stage: staging
environment: staging
secrets: inherit
File renamed without changes.
44 changes: 44 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Validierung für Pull Requests gegen develop/staging/production – OHNE Deploy und ohne
# AWS-Credentials. Baut das Frontend und synthetisiert den CDK-Stack, um Bundling-,
# Config- und Template-Fehler vor dem Merge zu fangen.
name: PR checks

on:
pull_request:
branches: [develop, staging, production]

permissions:
contents: read

jobs:
validate:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --max-old-space-size=4096
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Node 24 einrichten
uses: actions/setup-node@v4
with:
node-version: 24
cache: yarn

- name: Frontend-Dependencies installieren
run: yarn install --frozen-lockfile

- name: Frontend bauen
run: yarn build
env:
NODE_ENV: production

- name: CDK-Dependencies installieren
run: npm ci
working-directory: cdk

# synth braucht keine AWS-Credentials (keine fromLookup-Aufrufe im Stack).
# dev ist vollständig konfiguriert und dient hier als Validierungs-Stage.
- name: CDK synth
run: npx cdk synth --context stage=dev
working-directory: cdk
7 changes: 7 additions & 0 deletions cdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out
6 changes: 6 additions & 0 deletions cdk/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
Loading
Loading