|
| 1 | +# Contributing to AWS CloudFront Proxy for LaunchDarkly |
| 2 | + |
| 3 | +Thank you for your interest in contributing to this project! We welcome contributions from the community. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors. Please be kind, professional, and constructive in all interactions. |
| 8 | + |
| 9 | +## How to Contribute |
| 10 | + |
| 11 | +### Reporting Issues |
| 12 | + |
| 13 | +Before creating a new issue, please: |
| 14 | + |
| 15 | +1. **Search existing issues** to avoid duplicates |
| 16 | +2. **Use a clear, descriptive title** that summarizes the problem |
| 17 | +3. **Provide detailed information** including: |
| 18 | + - Steps to reproduce the issue |
| 19 | + - Expected vs. actual behavior |
| 20 | + - AWS region and CloudFormation stack details |
| 21 | + - LaunchDarkly SDK version and configuration |
| 22 | + - Error messages or logs (sanitized of sensitive data) |
| 23 | + |
| 24 | +### Suggesting Enhancements |
| 25 | + |
| 26 | +We welcome suggestions for new features or improvements: |
| 27 | + |
| 28 | +1. **Check existing issues** to see if your idea has been discussed |
| 29 | +2. **Create a new issue** with the "enhancement" label |
| 30 | +3. **Describe the enhancement** including: |
| 31 | + - Use case and problem it solves |
| 32 | + - Proposed solution |
| 33 | + - Any alternatives considered |
| 34 | + - Potential impact on existing users |
| 35 | + |
| 36 | +### Pull Requests |
| 37 | + |
| 38 | +1. **Fork the repository** and create a feature branch |
| 39 | +2. **Make your changes** following the guidelines below |
| 40 | +3. **Test your changes** thoroughly |
| 41 | +4. **Update documentation** as needed |
| 42 | +5. **Submit a pull request** with a clear description |
| 43 | + |
| 44 | +#### Pull Request Guidelines |
| 45 | + |
| 46 | +- Use a clear, descriptive title |
| 47 | +- Reference any related issues (e.g., "Fixes #123") |
| 48 | +- Provide a detailed description of changes |
| 49 | +- Include testing instructions |
| 50 | +- Keep changes focused and atomic |
| 51 | + |
| 52 | +## Development Guidelines |
| 53 | + |
| 54 | +### CloudFormation Templates |
| 55 | + |
| 56 | +- **Validate templates** using `aws cloudformation validate-template` |
| 57 | +- **Follow AWS best practices** for resource naming and tagging |
| 58 | +- **Use parameters** for configurable values |
| 59 | +- **Include comprehensive outputs** for important resource references |
| 60 | +- **Add detailed descriptions** for parameters and resources |
| 61 | + |
| 62 | +#### Template Structure |
| 63 | +```yaml |
| 64 | +AWSTemplateFormatVersion: '2010-09-09' |
| 65 | +Description: 'Clear, concise description' |
| 66 | + |
| 67 | +Parameters: |
| 68 | + # Parameters with descriptions and constraints |
| 69 | + |
| 70 | +Resources: |
| 71 | + # Resources with logical names and proper dependencies |
| 72 | + |
| 73 | +Outputs: |
| 74 | + # Important outputs with descriptions |
| 75 | +``` |
| 76 | + |
| 77 | +### Documentation |
| 78 | + |
| 79 | +- **Keep README.md updated** with any new features or changes |
| 80 | +- **Use clear, actionable language** in documentation |
| 81 | +- **Include examples** for configuration options |
| 82 | +- **Test all documented commands** to ensure they work |
| 83 | +- **Update deployment tables** if adding new regions |
| 84 | + |
| 85 | +### Testing |
| 86 | + |
| 87 | +#### Manual Testing Checklist |
| 88 | + |
| 89 | +Before submitting changes, please verify: |
| 90 | + |
| 91 | +- [ ] CloudFormation template validates without errors |
| 92 | +- [ ] Stack deploys successfully in at least one AWS region |
| 93 | +- [ ] Custom domain configuration works (if applicable) |
| 94 | +- [ ] LaunchDarkly SDK can connect through the proxy |
| 95 | +- [ ] Streaming endpoints work correctly |
| 96 | +- [ ] Stack cleanup completes successfully |
| 97 | +- [ ] One-click deploy links work correctly |
| 98 | + |
| 99 | +#### Testing Commands |
| 100 | + |
| 101 | +```bash |
| 102 | +# Validate CloudFormation template |
| 103 | +aws cloudformation validate-template --template-body file://infrastructure/templates/cloudfront.yaml |
| 104 | + |
| 105 | +# Deploy test stack |
| 106 | +aws cloudformation deploy \ |
| 107 | + --template-file infrastructure/templates/cloudfront.yaml \ |
| 108 | + --stack-name test-ld-cloudfront-proxy \ |
| 109 | + --parameter-overrides UseCustomDomain=false \ |
| 110 | + --capabilities CAPABILITY_IAM |
| 111 | + |
| 112 | +# Test SDK connectivity (replace with your values) |
| 113 | +Once deployed, configure your LaunchDarkly SDKs to use your CloudFront proxy by specifying the options with the reverse proxy URL. |
| 114 | + |
| 115 | +### React SDK (React Applications) |
| 116 | +```javascript |
| 117 | +const LDProvider = await asyncWithLDProvider({ |
| 118 | + clientSideID: 'your-client-side-id', |
| 119 | + context: { |
| 120 | + kind: "device", |
| 121 | + key: "unique-device-id" |
| 122 | + }, |
| 123 | + options: { |
| 124 | + baseUrl: 'https://flags.my-company-domain.com', |
| 125 | + eventsUrl: 'https://flags.my-company-domain.com', |
| 126 | + streamUrl: 'https://flags.my-company-domain.com |
| 127 | + } |
| 128 | +}); |
| 129 | +``` |
| 130 | +
|
| 131 | +# Cleanup test stack |
| 132 | +aws cloudformation delete-stack --stack-name test-ld-cloudfront-proxy |
| 133 | +``` |
| 134 | +
|
| 135 | +## Style Guidelines |
| 136 | +
|
| 137 | +### CloudFormation |
| 138 | +
|
| 139 | +- Use **PascalCase** for resource logical names |
| 140 | +- Use **kebab-case** for parameter names |
| 141 | +- Include **descriptions** for all parameters and important resources |
| 142 | +- Group related resources together |
| 143 | +- Use consistent indentation (2 spaces) |
| 144 | +
|
| 145 | +### Documentation |
| 146 | +
|
| 147 | +- Use **clear, concise language** |
| 148 | +- Include **code examples** where helpful |
| 149 | +- Use **consistent formatting** for commands and code |
| 150 | +- Keep **line lengths reasonable** (80-100 characters) |
| 151 | +
|
| 152 | +## Release Process |
| 153 | +
|
| 154 | +This project uses automated deployments via GitHub Actions and follows semantic versioning: |
| 155 | +
|
| 156 | +1. **Changes to `infrastructure/templates/cloudfront.yaml`** main branch trigger automatic S3 updates |
| 157 | +2. **One-click deploy links** are automatically updated |
| 158 | +3. **Templates are validated** before deployment |
| 159 | +
|
| 160 | +### Version Management |
| 161 | +
|
| 162 | +This project uses multiple version tracking methods: |
| 163 | +
|
| 164 | +#### 1. Git Tags (Primary) |
| 165 | +```bash |
| 166 | +# Create a new release version |
| 167 | +git tag -a v1.1.0 -m "Add new caching policy for streaming endpoints" |
| 168 | +git push origin v1.1.0 |
| 169 | +
|
| 170 | +# List all versions |
| 171 | +git tag -l |
| 172 | +``` |
| 173 | +
|
| 174 | +#### 2. VERSION File |
| 175 | +Update the `VERSION` file in the repository root with the current version number. |
| 176 | +
|
| 177 | +#### 3. CloudFormation Template Metadata |
| 178 | +Both CloudFormation templates include version metadata: |
| 179 | +```yaml |
| 180 | +Metadata: |
| 181 | + Version: '1.1.0' |
| 182 | + LastUpdated: '2024-10-08' |
| 183 | + Author: 'AWS CloudFront Proxy for LaunchDarkly' |
| 184 | +``` |
| 185 | +
|
| 186 | +#### 4. GitHub Releases |
| 187 | +Create GitHub releases from tags to provide user-facing release notes. |
| 188 | +
|
| 189 | +### Version Update Workflow |
| 190 | +
|
| 191 | +When creating a new release: |
| 192 | +
|
| 193 | +1. **Update VERSION file** with new version number |
| 194 | +2. **Update CloudFormation template metadata** in both templates |
| 195 | +3. **Update CHANGELOG.md** moving items from "Unreleased" to new version |
| 196 | +4. **Commit changes** with message like "Bump version to v1.1.0" |
| 197 | +5. **Create and push Git tag** `git tag -a v1.1.0 -m "Release description"` |
| 198 | +6. **Create GitHub release** from the tag with release notes |
| 199 | +
|
| 200 | +### Branch Strategy |
| 201 | +
|
| 202 | +- **`main` branch** contains production-ready code |
| 203 | +- **Feature branches** should be created from `main` |
| 204 | +- **Pull requests** should target `main` |
| 205 | +
|
| 206 | +## Getting Help |
| 207 | +
|
| 208 | +If you need help or have questions: |
| 209 | +
|
| 210 | +1. **Check existing issues** and documentation first |
| 211 | +2. **Create a new issue** with the "question" label |
| 212 | +3. **Provide context** about what you're trying to achieve |
| 213 | +
|
| 214 | +## Recognition |
| 215 | +
|
| 216 | +Contributors will be recognized in the project. Significant contributions may be highlighted in release notes. |
| 217 | +
|
| 218 | +## License |
| 219 | +
|
| 220 | +By contributing to this project, you agree that your contributions will be licensed under the Apache License 2.0, the same license that covers the project. See the [LICENSE](LICENSE) file for details. |
| 221 | +
|
| 222 | +--- |
| 223 | +
|
| 224 | +Thank you for contributing to make this CloudFront reverse proxy solution better for everyone! 🚀 |
0 commit comments