Skip to content

Commit eb4545b

Browse files
committed
Implement Wasabi CDN synchronization workflow and integration with deployment pipeline
1 parent cd7ddd7 commit eb4545b

File tree

5 files changed

+116
-2
lines changed

5 files changed

+116
-2
lines changed

.github/workflows/pipeline.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ jobs:
118118
max-parallel: 1
119119
matrix:
120120
environment: [mst, dev, qas, tst, stg, prd]
121+
outputs:
122+
synccdn_needed: ${{ steps.check-sync-cdn.outputs.synccdn }}
123+
environment: ${{ matrix.environment }}
121124

122125
steps:
123126
- name: Checkout repository
@@ -170,4 +173,40 @@ jobs:
170173
if [ $COUNTER -eq $MAX_TRIES ]; then
171174
echo "Application did not become healthy in time."
172175
exit 1
173-
fi
176+
fi
177+
178+
- name: Check if CDN Sync is needed
179+
id: check-sync-cdn
180+
run: |
181+
if [[ "${{ matrix.environment }}" == "qas" || "${{ matrix.environment }}" == "tst" || "${{ matrix.environment }}" == "stg" || "${{ matrix.environment }}" == "prd" ]]; then
182+
echo "synccdn=true" >> $GITHUB_OUTPUT
183+
else
184+
echo "synccdn=false" >> $GITHUB_OUTPUT
185+
fi
186+
187+
Sync-CDN:
188+
runs-on: ubuntu-latest
189+
needs: Deploy
190+
if: needs.Deploy.outputs.synccdn_needed == 'true'
191+
192+
steps:
193+
- name: Checkout repository
194+
uses: actions/checkout@v3
195+
with:
196+
fetch-depth: 0 # Fetch all history for proper change detection
197+
198+
- name: Configure AWS credentials for Wasabi
199+
uses: aws-actions/configure-aws-credentials@v2
200+
with:
201+
aws-access-key-id: ${{ secrets.WASABI_ACCESS_KEY }}
202+
aws-secret-access-key: ${{ secrets.WASABI_SECRET_KEY }}
203+
aws-region: us-central-1
204+
205+
- name: Sync to Wasabi S3 bucket
206+
run: |
207+
echo "Starting sync of cdn.support.tools to Wasabi for environment ${{ needs.Deploy.outputs.environment }}"
208+
aws s3 sync ./cdn.support.tools/ s3://cdn.support.tools/ \
209+
--endpoint-url=https://s3.us-central-1.wasabisys.com \
210+
--exclude ".git/*" \
211+
--acl public-read
212+
echo "Sync completed successfully"

.github/workflows/wasabi-sync.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Sync CDN to Wasabi
2+
3+
on:
4+
# Trigger on changes to cdn.support.tools directory
5+
push:
6+
paths:
7+
- 'cdn.support.tools/**'
8+
9+
# Add manual trigger option
10+
workflow_dispatch:
11+
12+
# Optional: Add ability to call from other workflows
13+
workflow_call:
14+
inputs:
15+
environment:
16+
required: false
17+
type: string
18+
default: 'production'
19+
20+
jobs:
21+
sync-to-wasabi:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 0 # Fetch all history for proper change detection
29+
30+
- name: Configure AWS credentials for Wasabi
31+
uses: aws-actions/configure-aws-credentials@v2
32+
with:
33+
aws-access-key-id: ${{ secrets.WASABI_ACCESS_KEY }}
34+
aws-secret-access-key: ${{ secrets.WASABI_SECRET_KEY }}
35+
aws-region: us-central-1
36+
37+
- name: Sync to Wasabi S3 bucket
38+
run: |
39+
echo "Starting sync of cdn.support.tools to Wasabi"
40+
aws s3 sync ./cdn.support.tools/ s3://cdn.support.tools/ \
41+
--endpoint-url=https://s3.us-central-1.wasabisys.com \
42+
--exclude ".git/*" \
43+
--acl public-read
44+
echo "Sync completed successfully"

memory-bank/activeContext.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- **Social Media Content**: Developed BlueSky and LinkedIn posts to promote the new guide
77
- **Memory Bank Setup**: Established documentation structure for future work continuity
88
- **GitHub CodeQL Fix**: Resolved code scanning configuration conflict
9+
- **CDN-Wasabi Integration**: Implemented automated CDN synchronization to Wasabi cloud storage
910

1011
## Recent Changes
1112
1. Created comprehensive CKA Exam Preparation Guide:
@@ -39,6 +40,13 @@
3940
- Created documentation explaining the root cause and solution
4041
- Created `docs/github-codeql-fix.md` with detailed steps to resolve the issue
4142

43+
7. Implemented CDN synchronization to Wasabi:
44+
- Created dedicated GitHub Actions workflow for manual syncing (`wasabi-sync.yml`)
45+
- Integrated automatic CDN sync with main deployment pipeline for production environments
46+
- Configured sync to preserve existing files on the Wasabi bucket (no deletion)
47+
- Used AWS S3 sync command with Wasabi endpoint for optimal compatibility
48+
- Configured appropriate IAM credentials securely in GitHub Secrets
49+
4250
## Active Decisions and Considerations
4351
- **Training Series Structure**: Organized CKA content into logical sections following established blog training series pattern
4452
- **Kubernetes Best Practices**: Emphasized current Kubernetes best practices in all examples and solutions
@@ -47,6 +55,7 @@
4755
- **Technical Depth**: Emphasized advanced troubleshooting techniques over basic concepts to provide unique value
4856
- **Memory Bank Structure**: Implemented complete documentation structure for future reference
4957
- **CodeQL Configuration**: Prioritized custom workflow over default setup for better control and integration with CI/CD pipeline
58+
- **CDN Sync Strategy**: Implemented additive-only sync to Wasabi to prevent accidental file deletion
5059

5160
## Next Steps
5261
1. Test the new CKA Exam Preparation Guide with actual students to gather feedback
@@ -57,3 +66,5 @@
5766
6. Evaluate metrics to track engagement with the new content
5867
7. Explore additional social media platforms for content promotion
5968
8. Implement the recommended GitHub CodeQL fix to resolve the code scanning issue
69+
9. Test the new Wasabi CDN synchronization workflow with a manual trigger
70+
10. Monitor the first few automatic CDN syncs during deployment to ensure proper functionality

memory-bank/progress.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- **Deployment Pipeline**: ArgoCD configuration suggests functioning GitOps deployment
1111
- **CDN Configuration**: External asset hosting appears to be configured correctly
1212
- **Technical Documentation**: Created documentation for resolving GitHub CodeQL configuration issues
13+
- **CDN-Wasabi Integration**: Implemented automated sync of CDN assets to Wasabi cloud storage
1314

1415
## What's Left to Build
1516
- **Training Diagrams**: Consider adding visual diagrams to enhance the CKA training series
@@ -19,6 +20,7 @@
1920
- **Content Series**: Develop related content that builds on the Cilium troubleshooting guide and CKA training series
2021
- **Analytics Integration**: Ensure proper tracking of content engagement
2122
- **Additional Platforms**: Evaluate expanding social media presence beyond current platforms
23+
- **CDN Sync Monitoring**: Add monitoring and notification for CDN sync failures
2224

2325
## Current Status
2426
- **CKA Training Series**: Complete - 10-part comprehensive guide created for Kubernetes certification exam preparation
@@ -30,10 +32,12 @@
3032
- **CDN Resources**: Pending - need to evaluate if additional images are needed
3133
- **Deployment**: Pending - new content ready for deployment process
3234
- **GitHub CodeQL**: Documented solution - created guidance on fixing the configuration conflict
35+
- **CDN Sync Automation**: Complete - implemented GitHub Actions workflows for both manual and automatic synchronization to Wasabi
3336

3437
## Known Issues
3538
- GitHub CodeQL scanning reporting configuration conflict - solution documented in `docs/github-codeql-fix.md`
3639
- Need to verify how images are referenced in blog posts to ensure CDN paths are correct
3740
- CKA training series would benefit from accompanying diagrams to enhance understanding
3841
- May need to test if the social media post formatting displays correctly on actual platforms
3942
- Should confirm that 2025 publication date functions correctly with the Hugo platform
43+
- Wasabi sync configuration uses additive-only approach which may accumulate stale files over time

memory-bank/techContext.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- **Kubernetes**: Container orchestration (indicated by ArgoCD configs)
1414
- **ArgoCD**: GitOps-based deployment to Kubernetes
1515
- **Nginx**: Web server configuration present
16+
- **Wasabi**: Cloud storage provider used for CDN asset hosting
1617

1718
## Development Setup
1819
- Source code stored in GitHub repository
@@ -25,25 +26,40 @@
2526
- Image optimization for CDN delivery
2627
- Kubernetes deployment considerations
2728
- Container size and performance optimization
29+
- CDN synchronization timing with deployments
2830

2931
## Dependencies
3032
- Go dependencies managed through go.mod
3133
- Hugo theme dependencies (using theme m10c)
3234
- Container base images
3335
- Kubernetes infrastructure dependencies
36+
- AWS CLI for Wasabi S3 compatibility
3437

3538
## Infrastructure Setup
3639
### Hosting
3740
- Appears to be using Kubernetes (ArgoCD configurations present)
3841
- Multiple environments defined: dev, tst, qas, stg, prd
3942
- CDN setup for static assets at cdn.support.tools
43+
- Wasabi cloud storage (s3.us-central-1.wasabisys.com) hosts the CDN content
4044

4145
### CI/CD
42-
- Deployment appears to use ArgoCD for GitOps workflows
46+
- Deployment uses GitHub Actions workflow (`pipeline.yml`)
47+
- ArgoCD for GitOps deployments to Kubernetes clusters
4348
- `deploy.sh` script suggests automated deployment process
4449
- Build process includes Docker image creation
4550
- Multiple Kubernetes environments with dedicated configurations
51+
- CDN synchronization with Wasabi via GitHub Actions:
52+
- Standalone workflow (`wasabi-sync.yml`) for manual syncs
53+
- Integrated CDN sync job in main pipeline for production environments
54+
- AWS S3 sync command used with Wasabi endpoint for compatibility
4655

4756
## Domain Structure
4857
- Main site: support.tools
4958
- CDN: cdn.support.tools
59+
60+
## Cloud Services
61+
- Wasabi S3-compatible storage:
62+
- Bucket name: cdn.support.tools
63+
- Endpoint: s3.us-central-1.wasabisys.com
64+
- Authentication: IAM credentials stored in GitHub Secrets
65+
- Sync strategy: Additive-only (no file deletion)

0 commit comments

Comments
 (0)